Skip to content

Commit d23a90f

Browse files
committed
Codegen docstring updates for template properties
1 parent 5f743ff commit d23a90f

File tree

149 files changed

+4469
-4265
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

149 files changed

+4469
-4265
lines changed

packages/python/plotly/_plotly_utils/basevalidators.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2346,6 +2346,16 @@ def compute_graph_obj_module_str(data_class_str, parent_name):
23462346

23472347
parent_parts = parent_name.split(".")
23482348
module_str = ".".join(["plotly.graph_objs"] + parent_parts[1:])
2349+
elif parent_name == "layout.template" and data_class_str == "Layout":
2350+
# Remap template's layout to regular layout
2351+
module_str = "plotly.graph_objs"
2352+
elif "layout.template.data" in parent_name:
2353+
# Remap template's traces to regular traces
2354+
parent_name = parent_name.replace("layout.template.data.", "")
2355+
if parent_name:
2356+
module_str = "plotly.graph_objs." + parent_name
2357+
else:
2358+
module_str = "plotly.graph_objs"
23492359
elif parent_name:
23502360
module_str = "plotly.graph_objs." + parent_name
23512361
else:

packages/python/plotly/codegen/datatypes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ def _subplot_re_match(self, prop):
169169
f"plotly.graph_objs{node.dotpath_str}."
170170
+ f"{subtype_node.name_datatype_class}"
171171
)
172+
173+
# remap template traces to regular traces
174+
prop_type = prop_type.replace("layout.template.data", "")
172175
elif subtype_node.is_mapped:
173176
prop_type = ""
174177
else:

packages/python/plotly/codegen/utils.py

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -916,15 +916,40 @@ def get_constructor_params_docstring(self, indent=12):
916916
raw_description = subtype_node.description
917917
if raw_description:
918918
subtype_description = raw_description
919-
elif subtype_node.is_compound:
920-
class_name = (
921-
f"plotly.graph_objs"
922-
f"{subtype_node.parent_dotpath_str}."
923-
f"{subtype_node.name_datatype_class}"
919+
elif subtype_node.is_array_element:
920+
if (
921+
self.name_datatype_class == "Data"
922+
and self.parent
923+
and self.parent.name_datatype_class == "Template"
924+
):
925+
class_name = (
926+
f"plotly.graph_objects." f"{subtype_node.name_datatype_class}"
927+
)
928+
else:
929+
class_name = (
930+
f"plotly.graph_objects"
931+
f"{subtype_node.parent_dotpath_str}."
932+
f"{subtype_node.name_datatype_class}"
933+
)
934+
subtype_description = (
935+
f"A tuple of {class_name} instances or "
936+
"dicts with compatible properties"
924937
)
938+
elif subtype_node.is_compound:
939+
if (
940+
subtype_node.name_datatype_class == "Layout"
941+
and self.name_datatype_class == "Template"
942+
):
943+
class_name = "plotly.graph_objects.Layout"
944+
else:
945+
class_name = (
946+
f"plotly.graph_objects"
947+
f"{subtype_node.parent_dotpath_str}."
948+
f"{subtype_node.name_datatype_class}"
949+
)
925950

926951
subtype_description = (
927-
f"{class_name} instance or " "dict with compatible properties"
952+
f"{class_name} instance or dict with compatible properties"
928953
)
929954
else:
930955
subtype_description = ""

packages/python/plotly/plotly/graph_objs/__init__.py

Lines changed: 1174 additions & 1143 deletions
Large diffs are not rendered by default.

packages/python/plotly/plotly/graph_objs/_figure.py

Lines changed: 413 additions & 411 deletions
Large diffs are not rendered by default.

packages/python/plotly/plotly/graph_objs/_figurewidget.py

Lines changed: 413 additions & 411 deletions
Large diffs are not rendered by default.

packages/python/plotly/plotly/graph_objs/bar/__init__.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ def _parent_path_str(self):
7373
def _prop_descriptions(self):
7474
return """\
7575
marker
76-
plotly.graph_objs.bar.unselected.Marker instance or
76+
plotly.graph_objects.bar.unselected.Marker instance or
7777
dict with compatible properties
7878
textfont
79-
plotly.graph_objs.bar.unselected.Textfont instance or
80-
dict with compatible properties
79+
plotly.graph_objects.bar.unselected.Textfont instance
80+
or dict with compatible properties
8181
"""
8282

8383
def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
@@ -90,11 +90,11 @@ def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
9090
dict of properties compatible with this constructor or
9191
an instance of plotly.graph_objs.bar.Unselected
9292
marker
93-
plotly.graph_objs.bar.unselected.Marker instance or
93+
plotly.graph_objects.bar.unselected.Marker instance or
9494
dict with compatible properties
9595
textfont
96-
plotly.graph_objs.bar.unselected.Textfont instance or
97-
dict with compatible properties
96+
plotly.graph_objects.bar.unselected.Textfont instance
97+
or dict with compatible properties
9898
9999
Returns
100100
-------
@@ -681,10 +681,10 @@ def _parent_path_str(self):
681681
def _prop_descriptions(self):
682682
return """\
683683
marker
684-
plotly.graph_objs.bar.selected.Marker instance or dict
685-
with compatible properties
684+
plotly.graph_objects.bar.selected.Marker instance or
685+
dict with compatible properties
686686
textfont
687-
plotly.graph_objs.bar.selected.Textfont instance or
687+
plotly.graph_objects.bar.selected.Textfont instance or
688688
dict with compatible properties
689689
"""
690690

@@ -698,10 +698,10 @@ def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
698698
dict of properties compatible with this constructor or
699699
an instance of plotly.graph_objs.bar.Selected
700700
marker
701-
plotly.graph_objs.bar.selected.Marker instance or dict
702-
with compatible properties
701+
plotly.graph_objects.bar.selected.Marker instance or
702+
dict with compatible properties
703703
textfont
704-
plotly.graph_objs.bar.selected.Textfont instance or
704+
plotly.graph_objects.bar.selected.Textfont instance or
705705
dict with compatible properties
706706
707707
Returns
@@ -1433,9 +1433,9 @@ def colorbar(self):
14331433
tickformat "%H~%M~%S.%2f" would display
14341434
"09~15~23.46"
14351435
tickformatstops
1436-
plotly.graph_objs.bar.marker.colorbar.Tickforma
1437-
tstop instance or dict with compatible
1438-
properties
1436+
A tuple of plotly.graph_objects.bar.marker.colo
1437+
rbar.Tickformatstop instances or dicts with
1438+
compatible properties
14391439
tickformatstopdefaults
14401440
When used in a template (as layout.template.dat
14411441
a.bar.marker.colorbar.tickformatstopdefaults),
@@ -1481,7 +1481,7 @@ def colorbar(self):
14811481
tickwidth
14821482
Sets the tick width (in px).
14831483
title
1484-
plotly.graph_objs.bar.marker.colorbar.Title
1484+
plotly.graph_objects.bar.marker.colorbar.Title
14851485
instance or dict with compatible properties
14861486
titlefont
14871487
Deprecated: Please use
@@ -1842,8 +1842,8 @@ def _prop_descriptions(self):
18421842
`layout.coloraxis2`, etc. Note that multiple color
18431843
scales can be linked to the same color axis.
18441844
colorbar
1845-
plotly.graph_objs.bar.marker.ColorBar instance or dict
1846-
with compatible properties
1845+
plotly.graph_objects.bar.marker.ColorBar instance or
1846+
dict with compatible properties
18471847
colorscale
18481848
Sets the colorscale. Has an effect only if in
18491849
`marker.color`is set to a numerical array. The
@@ -1861,8 +1861,8 @@ def _prop_descriptions(self):
18611861
colorsrc
18621862
Sets the source reference on plot.ly for color .
18631863
line
1864-
plotly.graph_objs.bar.marker.Line instance or dict with
1865-
compatible properties
1864+
plotly.graph_objects.bar.marker.Line instance or dict
1865+
with compatible properties
18661866
opacity
18671867
Sets the opacity of the bars.
18681868
opacitysrc
@@ -1954,8 +1954,8 @@ def __init__(
19541954
`layout.coloraxis2`, etc. Note that multiple color
19551955
scales can be linked to the same color axis.
19561956
colorbar
1957-
plotly.graph_objs.bar.marker.ColorBar instance or dict
1958-
with compatible properties
1957+
plotly.graph_objects.bar.marker.ColorBar instance or
1958+
dict with compatible properties
19591959
colorscale
19601960
Sets the colorscale. Has an effect only if in
19611961
`marker.color`is set to a numerical array. The
@@ -1973,8 +1973,8 @@ def __init__(
19731973
colorsrc
19741974
Sets the source reference on plot.ly for color .
19751975
line
1976-
plotly.graph_objs.bar.marker.Line instance or dict with
1977-
compatible properties
1976+
plotly.graph_objects.bar.marker.Line instance or dict
1977+
with compatible properties
19781978
opacity
19791979
Sets the opacity of the bars.
19801980
opacitysrc

packages/python/plotly/plotly/graph_objs/bar/marker/__init__.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1965,8 +1965,9 @@ def _prop_descriptions(self):
19651965
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
19661966
display "09~15~23.46"
19671967
tickformatstops
1968-
plotly.graph_objs.bar.marker.colorbar.Tickformatstop
1969-
instance or dict with compatible properties
1968+
A tuple of
1969+
plotly.graph_objects.bar.marker.colorbar.Tickformatstop
1970+
instances or dicts with compatible properties
19701971
tickformatstopdefaults
19711972
When used in a template (as layout.template.data.bar.ma
19721973
rker.colorbar.tickformatstopdefaults), sets the default
@@ -2006,8 +2007,8 @@ def _prop_descriptions(self):
20062007
tickwidth
20072008
Sets the tick width (in px).
20082009
title
2009-
plotly.graph_objs.bar.marker.colorbar.Title instance or
2010-
dict with compatible properties
2010+
plotly.graph_objects.bar.marker.colorbar.Title instance
2011+
or dict with compatible properties
20112012
titlefont
20122013
Deprecated: Please use bar.marker.colorbar.title.font
20132014
instead. Sets this color bar's title font. Note that
@@ -2213,8 +2214,9 @@ def __init__(
22132214
09:15:23.456* with tickformat "%H~%M~%S.%2f" would
22142215
display "09~15~23.46"
22152216
tickformatstops
2216-
plotly.graph_objs.bar.marker.colorbar.Tickformatstop
2217-
instance or dict with compatible properties
2217+
A tuple of
2218+
plotly.graph_objects.bar.marker.colorbar.Tickformatstop
2219+
instances or dicts with compatible properties
22182220
tickformatstopdefaults
22192221
When used in a template (as layout.template.data.bar.ma
22202222
rker.colorbar.tickformatstopdefaults), sets the default
@@ -2254,8 +2256,8 @@ def __init__(
22542256
tickwidth
22552257
Sets the tick width (in px).
22562258
title
2257-
plotly.graph_objs.bar.marker.colorbar.Title instance or
2258-
dict with compatible properties
2259+
plotly.graph_objects.bar.marker.colorbar.Title instance
2260+
or dict with compatible properties
22592261
titlefont
22602262
Deprecated: Please use bar.marker.colorbar.title.font
22612263
instead. Sets this color bar's title font. Note that

packages/python/plotly/plotly/graph_objs/barpolar/__init__.py

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ def _parent_path_str(self):
7373
def _prop_descriptions(self):
7474
return """\
7575
marker
76-
plotly.graph_objs.barpolar.unselected.Marker instance
77-
or dict with compatible properties
76+
plotly.graph_objects.barpolar.unselected.Marker
77+
instance or dict with compatible properties
7878
textfont
79-
plotly.graph_objs.barpolar.unselected.Textfont instance
80-
or dict with compatible properties
79+
plotly.graph_objects.barpolar.unselected.Textfont
80+
instance or dict with compatible properties
8181
"""
8282

8383
def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
@@ -90,11 +90,11 @@ def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
9090
dict of properties compatible with this constructor or
9191
an instance of plotly.graph_objs.barpolar.Unselected
9292
marker
93-
plotly.graph_objs.barpolar.unselected.Marker instance
94-
or dict with compatible properties
93+
plotly.graph_objects.barpolar.unselected.Marker
94+
instance or dict with compatible properties
9595
textfont
96-
plotly.graph_objs.barpolar.unselected.Textfont instance
97-
or dict with compatible properties
96+
plotly.graph_objects.barpolar.unselected.Textfont
97+
instance or dict with compatible properties
9898
9999
Returns
100100
-------
@@ -360,11 +360,11 @@ def _parent_path_str(self):
360360
def _prop_descriptions(self):
361361
return """\
362362
marker
363-
plotly.graph_objs.barpolar.selected.Marker instance or
364-
dict with compatible properties
365-
textfont
366-
plotly.graph_objs.barpolar.selected.Textfont instance
363+
plotly.graph_objects.barpolar.selected.Marker instance
367364
or dict with compatible properties
365+
textfont
366+
plotly.graph_objects.barpolar.selected.Textfont
367+
instance or dict with compatible properties
368368
"""
369369

370370
def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
@@ -377,11 +377,11 @@ def __init__(self, arg=None, marker=None, textfont=None, **kwargs):
377377
dict of properties compatible with this constructor or
378378
an instance of plotly.graph_objs.barpolar.Selected
379379
marker
380-
plotly.graph_objs.barpolar.selected.Marker instance or
381-
dict with compatible properties
382-
textfont
383-
plotly.graph_objs.barpolar.selected.Textfont instance
380+
plotly.graph_objects.barpolar.selected.Marker instance
384381
or dict with compatible properties
382+
textfont
383+
plotly.graph_objects.barpolar.selected.Textfont
384+
instance or dict with compatible properties
385385
386386
Returns
387387
-------
@@ -791,9 +791,9 @@ def colorbar(self):
791791
tickformat "%H~%M~%S.%2f" would display
792792
"09~15~23.46"
793793
tickformatstops
794-
plotly.graph_objs.barpolar.marker.colorbar.Tick
795-
formatstop instance or dict with compatible
796-
properties
794+
A tuple of plotly.graph_objects.barpolar.marker
795+
.colorbar.Tickformatstop instances or dicts
796+
with compatible properties
797797
tickformatstopdefaults
798798
When used in a template (as layout.template.dat
799799
a.barpolar.marker.colorbar.tickformatstopdefaul
@@ -840,8 +840,9 @@ def colorbar(self):
840840
tickwidth
841841
Sets the tick width (in px).
842842
title
843-
plotly.graph_objs.barpolar.marker.colorbar.Titl
844-
e instance or dict with compatible properties
843+
plotly.graph_objects.barpolar.marker.colorbar.T
844+
itle instance or dict with compatible
845+
properties
845846
titlefont
846847
Deprecated: Please use
847848
barpolar.marker.colorbar.title.font instead.
@@ -1201,8 +1202,8 @@ def _prop_descriptions(self):
12011202
`layout.coloraxis2`, etc. Note that multiple color
12021203
scales can be linked to the same color axis.
12031204
colorbar
1204-
plotly.graph_objs.barpolar.marker.ColorBar instance or
1205-
dict with compatible properties
1205+
plotly.graph_objects.barpolar.marker.ColorBar instance
1206+
or dict with compatible properties
12061207
colorscale
12071208
Sets the colorscale. Has an effect only if in
12081209
`marker.color`is set to a numerical array. The
@@ -1220,8 +1221,8 @@ def _prop_descriptions(self):
12201221
colorsrc
12211222
Sets the source reference on plot.ly for color .
12221223
line
1223-
plotly.graph_objs.barpolar.marker.Line instance or dict
1224-
with compatible properties
1224+
plotly.graph_objects.barpolar.marker.Line instance or
1225+
dict with compatible properties
12251226
opacity
12261227
Sets the opacity of the bars.
12271228
opacitysrc
@@ -1313,8 +1314,8 @@ def __init__(
13131314
`layout.coloraxis2`, etc. Note that multiple color
13141315
scales can be linked to the same color axis.
13151316
colorbar
1316-
plotly.graph_objs.barpolar.marker.ColorBar instance or
1317-
dict with compatible properties
1317+
plotly.graph_objects.barpolar.marker.ColorBar instance
1318+
or dict with compatible properties
13181319
colorscale
13191320
Sets the colorscale. Has an effect only if in
13201321
`marker.color`is set to a numerical array. The
@@ -1332,8 +1333,8 @@ def __init__(
13321333
colorsrc
13331334
Sets the source reference on plot.ly for color .
13341335
line
1335-
plotly.graph_objs.barpolar.marker.Line instance or dict
1336-
with compatible properties
1336+
plotly.graph_objects.barpolar.marker.Line instance or
1337+
dict with compatible properties
13371338
opacity
13381339
Sets the opacity of the bars.
13391340
opacitysrc

0 commit comments

Comments
 (0)