Skip to content

Commit cd801c2

Browse files
committed
add python-only objs in INFO, NAME_TO_KEY, KEY_TO_NAME, mv content
1 parent 67cc021 commit cd801c2

File tree

1 file changed

+31
-16
lines changed

1 file changed

+31
-16
lines changed

plotly/graph_objs/graph_objs_tools.py

Lines changed: 31 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,20 @@ def _load_graph_ref():
3030
# Load graph reference
3131
INFO, OBJ_MAP, NAME_TO_KEY, KEY_TO_NAME = _load_graph_ref()
3232

33-
34-
def update_keys(keys):
35-
"""Change keys we used to support to their new equivalent."""
36-
updated_keys = list()
37-
for key in keys:
38-
if key in translations:
39-
updated_keys += [translations[key]]
40-
else:
41-
updated_keys += [key]
42-
return updated_keys
43-
44-
translations = dict(
45-
scl="colorscale",
46-
reversescl="reversescale"
47-
)
33+
# Add mentions to Python-specific graph obj
34+
# to NAME_TO_KEY, KEY_TO_NAME, INFO
35+
NAME_TO_KEY['PlotlyList'] = 'plotlylist'
36+
NAME_TO_KEY['PlotlyDict'] = 'plotlydict'
37+
NAME_TO_KEY['PlotlyTrace'] = 'plotlytrace'
38+
NAME_TO_KEY['Trace'] = 'trace'
39+
KEY_TO_NAME['plotlylist'] = 'PlotlyList'
40+
KEY_TO_NAME['plotlydict'] = 'PlotlyDict'
41+
KEY_TO_NAME['plotlytrace'] = 'PlotlyTrace'
42+
KEY_TO_NAME['trace'] = 'Trace'
43+
INFO['plotlylist'] = dict(keymeta=dict())
44+
INFO['plotlydict'] = dict(keymeta=dict())
45+
INFO['plotlytrace'] = dict(keymeta=dict())
46+
INFO['trace'] = dict(keymeta=dict())
4847

4948
# Define line and tab size for help text!
5049
LINE_SIZE = 76
@@ -75,7 +74,7 @@ def make_list_doc(name):
7574
elif len(parent_keys) > 1:
7675
doc += "\nParent keys:\n\n " + "\n ".join(parent_keys) + "\n"
7776
# Add method list to doc
78-
doc += "Quick method reference:\n\n"
77+
doc += "\nQuick method reference:\n\n"
7978
doc += "\t{0}.".format(name) + "\n\t{0}.".format(name).join(
8079
["update(changes)", "strip_style()", "get_data()",
8180
"to_graph_objs()", "validate()", "to_string()",
@@ -170,6 +169,22 @@ def make_dict_doc(name):
170169
return doc.expandtabs(TAB_SIZE)
171170

172171

172+
def update_keys(keys):
173+
"""Change keys we used to support to their new equivalent."""
174+
updated_keys = list()
175+
for key in keys:
176+
if key in translations:
177+
updated_keys += [translations[key]]
178+
else:
179+
updated_keys += [key]
180+
return updated_keys
181+
182+
translations = dict(
183+
scl="colorscale",
184+
reversescl="reversescale"
185+
)
186+
187+
173188
def curtail_val_repr(val, max_chars, add_delim=False):
174189
delim = ", "
175190
end = ".."

0 commit comments

Comments
 (0)