Skip to content

Commit fea595e

Browse files
committed
Linting/formatting
1 parent e536a7e commit fea595e

File tree

1 file changed

+37
-36
lines changed

1 file changed

+37
-36
lines changed

test/image/make_exports.py

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,64 @@
44
import plotly.io as pio
55

66
root = os.getcwd()
7-
dirIn = os.path.join(root, 'test', 'image', 'mocks')
8-
dirOut = os.path.join(root, 'build', 'test_images')
7+
dirIn = os.path.join(root, "test", "image", "mocks")
8+
dirOut = os.path.join(root, "build", "test_images")
99
os.makedirs(dirOut, exist_ok=True)
1010

11-
pio.templates.default = 'none'
12-
pio.kaleido.scope.plotlyjs = os.path.join(root, 'build', 'plotly.js')
11+
pio.templates.default = "none"
12+
pio.kaleido.scope.plotlyjs = os.path.join(root, "build", "plotly.js")
1313

14-
allFormats = ['svg', 'jpg', 'jpeg', 'webp', 'pdf']
14+
allFormats = ["svg", "jpg", "jpeg", "webp", "pdf"]
1515
# 'png' is tested by image-test
1616

1717
allNames = [
18-
'plot_types',
19-
'annotations',
20-
'shapes',
21-
'range_slider',
22-
'contour_legend-colorscale',
23-
'layout_image',
24-
'image_astronaut_source',
25-
'gl2d_no-clustering2',
26-
'gl3d_surface-heatmap-treemap_transparent-colorscale',
27-
'map_density-multiple_legend',
28-
'smith_modes',
29-
'zsmooth_methods',
30-
'fonts',
31-
'worldcup',
32-
'mathjax'
18+
"plot_types",
19+
"annotations",
20+
"shapes",
21+
"range_slider",
22+
"contour_legend-colorscale",
23+
"layout_image",
24+
"image_astronaut_source",
25+
"gl2d_no-clustering2",
26+
"gl3d_surface-heatmap-treemap_transparent-colorscale",
27+
"map_density-multiple_legend",
28+
"smith_modes",
29+
"zsmooth_methods",
30+
"fonts",
31+
"worldcup",
32+
"mathjax",
3333
]
3434

3535
failed = 0
36-
for name in allNames :
37-
for fmt in allFormats :
38-
print(name + ' --> ' + fmt)
36+
for name in allNames:
37+
for fmt in allFormats:
38+
print(name + " --> " + fmt)
3939

40-
with open(os.path.join(dirIn, name + '.json'), 'r') as _in :
40+
with open(os.path.join(dirIn, name + ".json"), "r") as _in:
4141
fig = json.load(_in)
4242

4343
width = 700
4444
height = 500
45-
if 'layout' in fig :
46-
layout = fig['layout']
47-
if 'autosize' not in layout or layout['autosize'] != True :
48-
if 'width' in layout :
49-
width = layout['width']
50-
if 'height' in layout :
51-
height = layout['height']
45+
if "layout" in fig:
46+
layout = fig["layout"]
47+
if "autosize" not in layout or layout["autosize"] != True:
48+
if "width" in layout:
49+
width = layout["width"]
50+
if "height" in layout:
51+
height = layout["height"]
5252

53-
try :
53+
try:
5454
pio.write_image(
5555
fig=fig,
56-
file=os.path.join(dirOut, name + '.' + fmt),
56+
file=os.path.join(dirOut, name + "." + fmt),
5757
width=width,
5858
height=height,
59-
validate=False
59+
validate=False,
6060
)
6161

62-
except Exception as e :
62+
except Exception as e:
6363
print(e)
6464
failed += 1
6565

66-
if failed > 0 : sys.exit(1)
66+
if failed > 0:
67+
sys.exit(1)

0 commit comments

Comments
 (0)