8000 Consolidate attributes / items list in `help()`. · latuji/plotly.py@e3bf8d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit e3bf8d4

committed
Consolidate attributes / items list in help().
1 parent 3a14140 commit e3bf8d4

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

plotly/graph_objs/graph_objs_tools.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ def _list_help(object_name, path=(), parent_object_names=()):
3939
items = graph_reference.ARRAYS[object_name]['items']
4040
items_classes = [graph_reference.string_to_class_name(item)
4141
for item in items]
42-
items_string = '\n\t* {}\n'.format('\n\t* '.join(items_classes))
42+
lines = textwrap.wrap(repr(items_classes), width=LINE_SIZE - TAB_SIZE)
43+
items_string = '\n\t'.join(lines)
4344
help_string = 'Valid Item Classes:\n{}\n'.format(items_string)
4445
return help_string
4546

@@ -63,9 +64,10 @@ def _dict_object_help(object_name, path, parent_object_names):
6364
help_dict = {'path': path,
6465
'parent_class_names': parent_class_names}
6566

66-
attributes_str = '\n\t* {}\n'.format('\n\t* '.join(attributes))
67+
lines = textwrap.wrap(repr(list(attributes)), width=LINE_SIZE - TAB_SIZE)
68+
attributes_str = '\n\t'.join(lines)
6769
help_string = (
68-
"Run `.help('attribute')` on any of the following attributes:\n"
70+
"Run `.help('attribute')` on any of the following attributes:\n\n\t"
6971
"{attributes_str}"
7072
)
7173
return help_string.format(attributes_str=attributes_str, **help_dict)

0 commit comments

Comments
 (0)
0