-
Notifications
You must be signed in to change notification settings - Fork 361
/
snapshot.py
37 lines (33 loc) · 984 Bytes
/
snapshot.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import matplotlib
import itertools
import glob
matplotlib.use('Agg') # don't display plots
import matplotlib.pyplot as plt
import subprocess
import argparse
import json
import mpld3
from visualize_tests import (
ExecFile,
JS_TEMPLATE,
TEMPLATE,
MPLD3_TEMPLATE
)
import os
import diffimg
def main():
description = "Run plots thorugh mpld3 and get their d3 sreenshots"
parser = argparse.ArgumentParser(description=description)
parser.add_argument("files", nargs='*', type=str)
args = parser.parse_args()
if len(args.files) == 0:
input_test_files = ['mpld3/test_plots/*.py', 'examples/*.py']
else:
input_test_files = args.files
if isinstance(input_test_files, str):
filenames = glob.glob(input_test_files)
else:
filenames = itertools.chain(*(glob.glob(w) for w in input_test_files))
mpld3.tests.export.snapshot_multiple_mpld3_plots(plot_filenames=filenames)
if __name__ == '__main__':
main()