@@ -61,9 +61,8 @@ class StructureMoleculeComponent(MPComponent):
61
61
62
62
default_scene_settings = {
63
63
"extractAxis" : True ,
64
- # For visual diff testing, we change the renderer
65
- # to SVG since this WebGL support is more difficult
66
- # in headless browsers / CI.
64
+ # For visual diff testing, we change the renderer to SVG since this WebGL
65
+ # support is more difficult in headless browsers / CI.
67
66
"renderer" : "svg" if SETTINGS .TEST_MODE else "webgl" ,
68
67
"secondaryObjectView" : False ,
69
68
}
@@ -235,9 +234,7 @@ def __init__(
235
234
self ._initial_data ["scene" ] = scene
236
235
237
236
# hide axes inset for molecules
238
- if isinstance (struct_or_mol , Molecule ) or isinstance (
239
- struct_or_mol , MoleculeGraph
240
- ):
237
+ if isinstance (struct_or_mol , (Molecule , MoleculeGraph )):
241
238
self .scene_kwargs = {"axisView" : "HIDDEN" }
242
239
else :
243
240
self .scene_kwargs = {}
@@ -268,11 +265,9 @@ def generate_callbacks(self, app, cache):
268
265
}
269
266
""" ,
270
267
Output (self .id ("graph_generation_options" ), "data" ),
271
- [
272
- Input (self .id ("bonding_algorithm" ), "value" ),
273
- Input (self .id ("bonding_algorithm_custom_cutoffs" ), "data" ),
274
- Input (self .id ("unit-cell-choice" ), "value" ),
275
- ],
268
+ Input (self .id ("bonding_algorithm" ), "value" ),
269
+ Input (self .id ("bonding_algorithm_custom_cutoffs" ), "data" ),
270
+ Input (self .id ("unit-cell-choice" ), "value" ),
276
271
)
277
272
278
273
app .clientside_callback (
@@ -286,8 +281,8 @@ def generate_callbacks(self, app, cache):
286
281
}
287
282
""" ,
288
283
Output (self .id ("scene" ), "toggleVisibility" ),
289
- [ Input (self .id ("hide-show" ), "value" )] ,
290
- [ State (self .id ("hide-show" ), "options" )] ,
284
+ Input (self .id ("hide-show" ), "value" ),
285
+ State (self .id ("hide-show" ), "options" ),
291
286
)
292
287
293
288
app .clientside_callback (
@@ -307,12 +302,10 @@ def generate_callbacks(self, app, cache):
307
302
}
308
303
""" ,
309
304
Output (self .id ("display_options" ), "data" ),
310
- [
311
- Input (self .id ("color-scheme" ), "value" ),
312
- Input (self .id ("radius_strategy" ), "value" ),
313
- Input (self .id ("draw_options" ), "value" ),
314
- ],
315
- [State (self .id ("display_options" ), "data" )],
305
+ Input (self .id ("color-scheme" ), "value" ),
306
+ Input (self .id ("radius_strategy" ), "value" ),
307
+ Input (self .id ("draw_options" ), "value" ),
308
+ State (self .id ("display_options" ), "data" ),
316
309
)
317
310
318
311
@app .callback (
@@ -411,20 +404,16 @@ def update_color_options(legend_data):
411
404
# app.clientside_callback(
412
405
# """
413
406
# function (legendData) {
414
- #
415
- # var colorOptions = [
407
+ # const colorOptions = [
416
408
# {label: "Jmol", value: "Jmol"},
417
409
# {label: "VESTA", value: "VESTA"},
418
410
# {label: "Accessible", value: "accessible"},
419
411
# ]
420
- #
421
- #
422
- #
423
412
# return colorOptions
424
413
# }
425
414
# """,
426
415
# Output(self.id("color-scheme"), "options"),
427
- # [ Input(self.id("legend_data"), "data")]
416
+ # Input(self.id("legend_data"), "data"),
428
417
# )
429
418
430
419
@app .callback (
@@ -945,7 +934,7 @@ def _preprocess_input_to_graph(
945
934
# we assume most uses of this class will give a structure as an input argument,
946
935
# meaning we have to calculate the graph for bonding information, however if
947
936
# the graph is already known and supplied, we will use that
948
- if isinstance (input , StructureGraph ) or isinstance ( input , MoleculeGraph ):
937
+ if isinstance (input , ( StructureGraph , MoleculeGraph ) ):
949
938
graph = input
950
939
else :
951
940
if (
@@ -1001,7 +990,7 @@ def _get_struct_or_mol(
1001
990
return graph .structure
1002
991
elif isinstance (graph , MoleculeGraph ):
1003
992
return graph .molecule
1004
- elif isinstance (graph , Structure ) or isinstance ( graph , Molecule ):
993
+ elif isinstance (graph , ( Structure , Molecule ) ):
1005
994
return graph
1006
995
else :
1007
996
raise ValueError
0 commit comments