@@ -88,13 +88,21 @@ def _get_class_name(self):
88
88
"""For convenience. See `graph_reference.object_name_to_class_name`."""
89
89
return graph_reference .object_name_to_class_name (self ._name )
90
90
91
- def help (self ):
92
- """Print a help string for this object."""
91
+ def help (self , return_help = False ):
92
+ """
93
+ Print a help string for this object.
94
+
95
+ :param (bool) return_help: Return help string instead of prining?
96
+ :return: (None|str) Optionally can return help string.
97
+
98
+ """
93
99
object_name = self ._name
94
100
path = self ._get_path ()
95
101
parent_object_names = self ._get_parent_object_names ()
96
102
help_string = graph_objs_tools .get_help (object_name , path ,
97
103
parent_object_names )
104
+ if return_help :
105
+ return help_string
98
106
print (help_string )
99
107
100
108
def to_graph_objs (self , ** kwargs ):
@@ -540,18 +548,27 @@ def _value_to_graph_object(self, key, value, _raise=True):
540
548
return GraphObjectFactory .create (key , value , _raise = _raise ,
541
549
_parent = self , _parent_key = key )
542
550
543
- def help (self , attribute = None ):
544
- """Print help string for this object or an attribute of this object."""
551
+ def help (self , attribute = None , return_help = False ):
552
+ """
553
+ Print help string for this object or an attribute of this object.
554
+
555
+ :param (str) attribute: A valid attribute string for this object.
556
+ :param (bool) return_help: Return help_string instead of printing it?
557
+ :return: (None|str)
558
+
559
+ """
545
560
if not attribute :
546
- super (PlotlyDict , self ).help ()
547
- else :
548
- object_name = self ._name
549
- path = self ._get_path ()
550
- parent_object_names = self ._get_parent_object_names ()
551
- help_string = graph_objs_tools .get_help (object_name , path ,
552
- parent_object_names ,
553
- attribute )
554
- print (help_string )
561
+ return super (PlotlyDict , self ).help (return_help = return_help )
562
+
563
+ object_name = self ._name
564
+ path = self ._get_path ()
565
+ parent_object_names = self ._get_parent_object_names ()
566
+ help_string = graph_objs_tools .get_help (object_name , path ,
567
+ parent_object_names , attribute )
568
+
569
+ if return_help :
570
+ return help_string
571
+ print (help_string )
555
572
556
573
def update (self , dict1 = None , ** dict2 ):
557
574
"""
0 commit comments