Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b6a2ec

Browse files
committed
Added documentation to functions in tools.py.
1 parent 630119b commit 1b6a2ec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

plotly/tools.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ def get_subplots(rows=1, columns=1, horizontal_spacing=0.1,
322322

323323

324324
def get_valid_graph_obj(obj, obj_type=None):
325+
"""Returns a new graph object that is guaranteed to pass validate().
326+
327+
CAREFUL: this will *silently* strip out invalid pieces of the object.
328+
329+
"""
325330
try:
326331
new_obj = graph_objs.NAME_TO_CLASS[obj.__class__.__name__]()
327332
except KeyError:
@@ -341,6 +346,13 @@ def get_valid_graph_obj(obj, obj_type=None):
341346

342347

343348
def validate(obj, obj_type):
349+
"""Validate a dictionary, list, or graph object as 'obj_type'.
350+
351+
This will not alter the 'obj' referenced in the call signature. It will
352+
raise an error if the 'obj' reference could not be instantiated as a
353+
valid 'obj_type' graph object.
354+
355+
"""
344356
try:
345357
test_obj = graph_objs.NAME_TO_CLASS[obj_type](obj)
346358
except KeyError:

0 commit comments

Comments
 (0)