@@ -453,7 +453,7 @@ def to_graph_objs(self, caller=True):
453
453
'key_type' in INFO [info_key ]['keymeta' ][key ].keys ()):
454
454
if INFO [info_key ]['keymeta' ][key ]['key_type' ] == 'object' :
455
455
class_name = KEY_TO_NAME [key ]
456
- obj = _factory (class_name )
456
+ obj = get_class_instance_by_name (class_name )
457
457
if isinstance (obj , PlotlyDict ):
458
458
if not isinstance (self [key ], dict ):
459
459
try :
@@ -794,7 +794,8 @@ def to_graph_objs(self, caller=True): # TODO TODO TODO! check logic!
794
794
"""
795
795
for index , entry in enumerate (self ):
796
796
if isinstance (entry , PlotlyDict ):
797
- self [index ] = _factory (entry .__class__ .__name__ , entry )
797
+ self [index ] = get_class_instance_by_name (
798
+ entry .__class__ .__name__ , entry )
798
799
elif isinstance (entry , dict ):
799
800
if 'type' not in entry : # assume 'scatter' if not given
800
801
entry ['type' ] = 'scatter'
@@ -805,7 +806,7 @@ def to_graph_objs(self, caller=True): # TODO TODO TODO! check logic!
805
806
obj = self ,
806
807
index = index
807
808
)
808
- obj = _factory (obj_name )
809
+ obj = get_class_instance_by_name (obj_name )
809
810
for k , v in list (entry .items ()):
810
811
obj [k ] = v
811
812
self [index ] = obj
@@ -845,7 +846,7 @@ def to_graph_objs(self, caller=True):
845
846
"different kind of graph object." ,
846
847
)
847
848
elif isinstance (entry , dict ):
848
- obj = _factory ('Annotation' )
849
+ obj = get_class_instance_by_name ('Annotation' )
849
850
for k , v in list (entry .items ()):
850
851
obj [k ] = v
851
852
self [index ] = obj
@@ -908,9 +909,9 @@ def to_graph_objs(self, caller=True):
908
909
continue # not an XAxis or YAxis object after all
909
910
if isinstance (self [key ], dict ):
910
911
if key [:5 ] == 'xaxis' :
911
- obj = _factory ('XAxis' )
912
+ obj = get_class_instance_by_name ('XAxis' )
912
913
else :
913
- obj = _factory ('YAxis' )
914
+ obj = get_class_instance_by_name ('YAxis' )
914
915
for k , v in list (self .pop (key ).items ()):
915
916
obj [k ] = v
916
917
self [key ] = obj # call to super will call 'to_graph_objs'
@@ -1063,7 +1064,7 @@ def force_clean(self, caller=True): # TODO: can't make call to super...
1063
1064
for name in NAME_TO_KEY .keys ()}
1064
1065
1065
1066
1066
- def _factory (name , * args , ** kwargs ):
1067
+ def get_class_instance_by_name (name , * args , ** kwargs ):
1067
1068
"""All class creation goes through here.
1068
1069
1069
1070
Because call signatures for the different classes are different, we have
0 commit comments