27
27
import warnings
28
28
import six
29
29
from plotly .graph_objs import graph_objs_tools
30
- from plotly .graph_objs .graph_objs_tools import INFO , KEY_TO_NAME , NAME_TO_KEY
30
+ from plotly .graph_objs .graph_objs_tools import (
31
+ INFO , OBJ_MAP , NAME_TO_KEY , KEY_TO_NAME
32
+ )
31
33
import copy
32
34
from plotly import exceptions
33
35
import sys
@@ -192,12 +194,17 @@ def validate(self, caller=True):
192
194
raise
193
195
else :
194
196
raise exceptions .PlotlyGraphObjectError ( # TODO!!!
195
- message = "uh-oh, this error shouldn't have happenend." ,
196
- plain_message = "uh-oh, this error shouldn't have happenend." ,
197
+ message = (
198
+ "uh-oh, this error shouldn't have happenend."
199
+ ),
200
+ plain_message = (
201
+ "uh-oh, this error shouldn't have happenend."
202
+ ),
197
203
path = [index ],
198
204
)
199
205
200
- def to_string (self , level = 0 , indent = 4 , eol = '\n ' , pretty = True , max_chars = 80 ):
206
+ def to_string (self , level = 0 , indent = 4 , eol = '\n ' ,
207
+ pretty = True , max_chars = 80 ):
201
208
"""Returns a formatted string showing graph_obj constructors.
202
209
203
210
Example:
@@ -229,7 +236,8 @@ def to_string(self, level=0, indent=4, eol='\n', pretty=True, max_chars=80):
229
236
string += ",{eol}{indent}" .format (
230
237
eol = eol ,
231
238
indent = ' ' * indent * (level + 1 ))
232
- string += "{eol}{indent}])" .format (eol = eol , indent = ' ' * indent * level )
239
+ string += (
240
+ "{eol}{indent}])" ).format (eol = eol , indent = ' ' * indent * level )
233
241
return string
234
242
235
243
def get_ordered (self , caller = True ):
@@ -394,7 +402,8 @@ def get_data(self):
394
402
d [key ] = val .get_data ()
395
403
else :
396
404
try :
397
- if INFO [obj_key ][key ]['type' ] == 'data' : # TODO: Update the JSON
405
+ # TODO: Update the JSON
406
+ if INFO [obj_key ][key ]['type' ] == 'data' :
398
407
d [key ] = val
399
408
except KeyError :
400
409
pass
@@ -521,7 +530,8 @@ def validate(self, caller=True): # TODO: validate values too?
521
530
val_types = val_types
522
531
)
523
532
else :
524
- matching_objects = [obj for obj in INFO if key in INFO [obj ]]
533
+ matching_objects = [obj for obj in
534
+ INFO if key in INFO [obj ]]
525
535
notes = ''
526
536
if len (matching_objects ):
527
537
notes += "That key is valid only in these objects:\n \n "
@@ -540,7 +550,8 @@ def validate(self, caller=True): # TODO: validate values too?
540
550
key = key ,
541
551
notes = notes )
542
552
543
- def to_string (self , level = 0 , indent = 4 , eol = '\n ' , pretty = True , max_chars = 80 ):
553
+ def to_string (self , level = 0 , indent = 4 , eol = '\n ' ,
554
+ pretty = True , max_chars = 80 ):
544
555
"""Returns a formatted string showing graph_obj constructors.
545
556
546
557
Example:
@@ -677,7 +688,7 @@ class Data(PlotlyList):
677
688
678
689
Data([Scatter(), Heatmap(), Box()])
679
690
680
- Valid entry types: (dict or any subclass of Trace, i.e., Scatter, Box, etc.)
691
+ Valid entry types: (dict or any Trace subclass, e.g. Scatter, Box, etc.)
681
692
682
693
"""
683
694
def to_graph_objs (self , caller = True ): # TODO TODO TODO! check logic!
@@ -709,8 +720,10 @@ def to_graph_objs(self, caller=True): # TODO TODO TODO! check logic!
709
720
raise exceptions .PlotlyListEntryError (
710
721
obj = self ,
711
722
index = index ,
712
- notes = "The entry could not be converted into a PlotlyTrace "
713
- "object (e.g., Scatter, Heatmap, Bar, etc)." ,
723
+ notes = (
724
+ "The entry could not be converted into a PlotlyTrace "
725
+ "object (e.g., Scatter, Heatmap, Bar, etc)."
726
+ ),
714
727
)
715
728
super (Data , self ).to_graph_objs (caller = caller )
716
729
@@ -759,8 +772,10 @@ def to_graph_objs(self, caller=True):
759
772
raise exceptions .PlotlyListEntryError (
760
773
obj = self ,
761
774
index = index ,
762
- notes = "The entry could not be converted into an Annotation "
763
- "object because it was not a dictionary." ,
775
+ notes = (
776
+ "The entry could not be converted into an Annotation "
777
+ "object because it was not a dictionary."
778
+ ),
764
779
)
765
780
super (Annotations , self ).to_graph_objs (caller = caller )
766
781
@@ -786,7 +801,8 @@ def __init__(self, *args, **kwargs):
786
801
"dictionary-like plot types.\n It is not meant to be "
787
802
"a user interface." )
788
803
789
- def to_string (self , level = 0 , indent = 4 , eol = '\n ' , pretty = True , max_chars = 80 ):
804
+ def to_string (self , level = 0 , indent = 4 , eol = '\n ' ,
805
+ pretty = True , max_chars = 80 ):
790
806
"""Returns a formatted string showing graph_obj constructors.
791
807
792
808
Example:
@@ -896,7 +912,8 @@ def to_graph_objs(self, caller=True):
896
912
self [key ] = obj # call to super will call 'to_graph_objs'
897
913
super (Layout , self ).to_graph_objs (caller = caller )
898
914
899
- def to_string (self , level = 0 , indent = 4 , eol = '\n ' , pretty = True , max_chars = 80 ):
915
+ def to_string (self , level = 0 , indent = 4 , eol = '\n ' ,
916
+ pretty = True , max_chars = 80 ):
900
917
"""Returns a formatted string showing graph_obj constructors.
901
918
902
919
Example:
@@ -1052,7 +1069,7 @@ def _factory(name, *args, **kwargs):
1052
1069
# bases are the base classes that the new class inherits from
1053
1070
# dict holds attributes for the new class, e.g., __doc__
1054
1071
# why? because __doc__ isn't writeable after-the-fact!
1055
- for obj in graph_objs_tools . OBJ_MAP :
1072
+ for obj in OBJ_MAP :
1056
1073
if obj not in globals ():
1057
1074
base_name = graph_objs_tools .OBJ_MAP [obj ]['base_name' ]
1058
1075
if base_name == 'PlotlyList' :
0 commit comments