Skip to content

Commit d08e0c0

Browse files
use line-dash validators everywhere possible (#3722)
1 parent 0e29f9c commit d08e0c0

File tree

45 files changed

+148
-165
lines changed

Some content is hidden

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

45 files changed

+148
-165
lines changed

Diff for: packages/python/plotly/codegen/utils.py

+4-21
Original file line numberDiff line numberDiff line change
@@ -180,25 +180,6 @@ def format_description(desc):
180180
"frame.layout": "plotly.validators.LayoutValidator",
181181
}
182182

183-
# Add custom dash validators
184-
CUSTOM_VALIDATOR_DATATYPES.update(
185-
{
186-
prop: "_plotly_utils.basevalidators.DashValidator"
187-
for prop in [
188-
"scatter.line.dash",
189-
"histogram2dcontour.line.dash",
190-
"scattergeo.line.dash",
191-
"scatterpolar.line.dash",
192-
"ohlc.line.dash",
193-
"ohlc.decreasing.line.dash",
194-
"ohlc.increasing.line.dash",
195-
"contourcarpet.line.dash",
196-
"contour.line.dash",
197-
"scatterternary.line.dash",
198-
"scattercarpet.line.dash",
199-
]
200-
}
201-
)
202183

203184
# Mapping from property string (as found in plot-schema.json) to a custom
204185
# class name. If not included here, names are converted to TitleCase and
@@ -435,9 +416,11 @@ def name_base_validator(self) -> str:
435416
str
436417
"""
437418
if self.path_str in CUSTOM_VALIDATOR_DATATYPES:
438-
validator_base = f"{CUSTOM_VALIDATOR_DATATYPES[self.path_str]}"
419+
validator_base = CUSTOM_VALIDATOR_DATATYPES[self.path_str]
439420
elif self.plotly_name.endswith("src") and self.datatype == "string":
440-
validator_base = f"_plotly_utils.basevalidators." f"SrcValidator"
421+
validator_base = "_plotly_utils.basevalidators.SrcValidator"
422+
elif self.plotly_name.endswith("dash") and self.datatype == "string":
423+
validator_base = "_plotly_utils.basevalidators.DashValidator"
441424
elif self.plotly_name == "title" and self.datatype == "compound":
442425
validator_base = "_plotly_utils.basevalidators.TitleValidator"
443426
else:

Diff for: packages/python/plotly/plotly/graph_objs/carpet/_aaxis.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ def griddash(self):
551551
"longdashdot") or a dash length list in px (eg
552552
"5px,10px,2px,2px").
553553
554-
The 'griddash' property is a string and must be specified as:
555-
- One of the following strings:
556-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
557-
'longdashdot']
558-
- A number that will be converted to a string
554+
The 'griddash' property is an enumeration that may be specified as:
555+
- One of the following dash styles:
556+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
557+
- A string containing a dash length list in pixels or percentages
558+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
559559
560560
Returns
561561
-------
@@ -838,11 +838,11 @@ def minorgriddash(self):
838838
"longdashdot") or a dash length list in px (eg
839839
"5px,10px,2px,2px").
840840
841-
The 'minorgriddash' property is a string and must be specified as:
842-
- One of the following strings:
843-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
844-
'longdashdot']
845-
- A number that will be converted to a string
841+
The 'minorgriddash' property is an enumeration that may be specified as:
842+
- One of the following dash styles:
843+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
844+
- A string containing a dash length list in pixels or percentages
845+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
846846
847847
Returns
848848
-------

Diff for: packages/python/plotly/plotly/graph_objs/carpet/_baxis.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -551,11 +551,11 @@ def griddash(self):
551551
"longdashdot") or a dash length list in px (eg
552552
"5px,10px,2px,2px").
553553
554-
The 'griddash' property is a string and must be specified as:
555-
- One of the following strings:
556-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
557-
'longdashdot']
558-
- A number that will be converted to a string
554+
The 'griddash' property is an enumeration that may be specified as:
555+
- One of the following dash styles:
556+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
557+
- A string containing a dash length list in pixels or percentages
558+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
559559
560560
Returns
561561
-------
@@ -838,11 +838,11 @@ def minorgriddash(self):
838838
"longdashdot") or a dash length list in px (eg
839839
"5px,10px,2px,2px").
840840
841-
The 'minorgriddash' property is a string and must be specified as:
842-
- One of the following strings:
843-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
844-
'longdashdot']
845-
- A number that will be converted to a string
841+
The 'minorgriddash' property is an enumeration that may be specified as:
842+
- One of the following dash styles:
843+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
844+
- A string containing a dash length list in pixels or percentages
845+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
846846
847847
Returns
848848
-------

Diff for: packages/python/plotly/plotly/graph_objs/funnel/connector/_line.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ def dash(self):
7979
"longdashdot") or a dash length list in px (eg
8080
"5px,10px,2px,2px").
8181
82-
The 'dash' property is a string and must be specified as:
83-
- One of the following strings:
84-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
85-
'longdashdot']
86-
- A number that will be converted to a string
82+
The 'dash' property is an enumeration that may be specified as:
83+
- One of the following dash styles:
84+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
85+
- A string containing a dash length list in pixels or percentages
86+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
8787
8888
Returns
8989
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/_xaxis.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -671,11 +671,11 @@ def griddash(self):
671671
"longdashdot") or a dash length list in px (eg
672672
"5px,10px,2px,2px").
673673
674-
The 'griddash' property is a string and must be specified as:
675-
- One of the following strings:
676-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
677-
'longdashdot']
678-
- A number that will be converted to a string
674+
The 'griddash' property is an enumeration that may be specified as:
675+
- One of the following dash styles:
676+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
677+
- A string containing a dash length list in pixels or percentages
678+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
679679
680680
Returns
681681
-------
@@ -1735,11 +1735,11 @@ def spikedash(self):
17351735
"longdashdot") or a dash length list in px (eg
17361736
"5px,10px,2px,2px").
17371737
1738-
The 'spikedash' property is a string and must be specified as:
1739-
- One of the following strings:
1740-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
1741-
'longdashdot']
1742-
- A number that will be converted to a string
1738+
The 'spikedash' property is an enumeration that may be specified as:
1739+
- One of the following dash styles:
1740+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
1741+
- A string containing a dash length list in pixels or percentages
1742+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
17431743
17441744
Returns
17451745
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/_yaxis.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -669,11 +669,11 @@ def griddash(self):
669669
"longdashdot") or a dash length list in px (eg
670670
"5px,10px,2px,2px").
671671
672-
The 'griddash' property is a string and must be specified as:
673-
- One of the following strings:
674-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
675-
'longdashdot']
676-
- A number that will be converted to a string
672+
The 'griddash' property is an enumeration that may be specified as:
673+
- One of the following dash styles:
674+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
675+
- A string containing a dash length list in pixels or percentages
676+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
677677
678678
Returns
679679
-------
@@ -1606,11 +1606,11 @@ def spikedash(self):
16061606
"longdashdot") or a dash length list in px (eg
16071607
"5px,10px,2px,2px").
16081608
1609-
The 'spikedash' property is a string and must be specified as:
1610-
- One of the following strings:
1611-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
1612-
'longdashdot']
1613-
- A number that will be converted to a string
1609+
The 'spikedash' property is an enumeration that may be specified as:
1610+
- One of the following dash styles:
1611+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
1612+
- A string containing a dash length list in pixels or percentages
1613+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
16141614
16151615
Returns
16161616
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/geo/_lataxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def griddash(self):
107107
"longdashdot") or a dash length list in px (eg
108108
"5px,10px,2px,2px").
109109
110-
The 'griddash' property is a string and must be specified as:
111-
- One of the following strings:
112-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
113-
'longdashdot']
114-
- A number that will be converted to a string
110+
The 'griddash' property is an enumeration that may be specified as:
111+
- One of the following dash styles:
112+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
113+
- A string containing a dash length list in pixels or percentages
114+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
115115
116116
Returns
117117
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/geo/_lonaxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,11 @@ def griddash(self):
107107
"longdashdot") or a dash length list in px (eg
108108
"5px,10px,2px,2px").
109109
110-
The 'griddash' property is a string and must be specified as:
111-
- One of the following strings:
112-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
113-
'longdashdot']
114-
- A number that will be converted to a string
110+
The 'griddash' property is an enumeration that may be specified as:
111+
- One of the following dash styles:
112+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
113+
- A string containing a dash length list in pixels or percentages
114+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
115115
116116
Returns
117117
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/newshape/_line.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,11 @@ def dash(self):
8080
"longdashdot") or a dash length list in px (eg
8181
"5px,10px,2px,2px").
8282
83-
The 'dash' property is a string and must be specified as:
84-
- One of the following strings:
85-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
86-
'longdashdot']
87-
- A number that will be converted to a string
83+
The 'dash' property is an enumeration that may be specified as:
84+
- One of the following dash styles:
85+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
86+
- A string containing a dash length list in pixels or percentages
87+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
8888
8989
Returns
9090
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/polar/_angularaxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -381,11 +381,11 @@ def griddash(self):
381381
"longdashdot") or a dash length list in px (eg
382382
"5px,10px,2px,2px").
383383
384-
The 'griddash' property is a string and must be specified as:
385-
- One of the following strings:
386-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
387-
'longdashdot']
388-
- A number that will be converted to a string
384+
The 'griddash' property is an enumeration that may be specified as:
385+
- One of the following dash styles:
386+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
387+
- A string containing a dash length list in pixels or percentages
388+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
389389
390390
Returns
391391
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/polar/_radialaxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -440,11 +440,11 @@ def griddash(self):
440440
"longdashdot") or a dash length list in px (eg
441441
"5px,10px,2px,2px").
442442
443-
The 'griddash' property is a string and must be specified as:
444-
- One of the following strings:
445-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
446-
'longdashdot']
447-
- A number that will be converted to a string
443+
The 'griddash' property is an enumeration that may be specified as:
444+
- One of the following dash styles:
445+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
446+
- A string containing a dash length list in pixels or percentages
447+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
448448
449449
Returns
450450
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/shape/_line.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ def dash(self):
7979
"longdashdot") or a dash length list in px (eg
8080
"5px,10px,2px,2px").
8181
82-
The 'dash' property is a string and must be specified as:
83-
- One of the following strings:
84-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
85-
'longdashdot']
86-
- A number that will be converted to a string
82+
The 'dash' property is an enumeration that may be specified as:
83+
- One of the following dash styles:
84+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
85+
- A string containing a dash length list in pixels or percentages
86+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
8787
8888
Returns
8989
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/smith/_imaginaryaxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@ def griddash(self):
166166
"longdashdot") or a dash length list in px (eg
167167
"5px,10px,2px,2px").
168168
169-
The 'griddash' property is a string and must be specified as:
170-
- One of the following strings:
171-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
172-
'longdashdot']
173-
- A number that will be converted to a string
169+
The 'griddash' property is an enumeration that may be specified as:
170+
- One of the following dash styles:
171+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
172+
- A string containing a dash length list in pixels or percentages
173+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
174174
175175
Returns
176176
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/smith/_realaxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -168,11 +168,11 @@ def griddash(self):
168168
"longdashdot") or a dash length list in px (eg
169169
"5px,10px,2px,2px").
170170
171-
The 'griddash' property is a string and must be specified as:
172-
- One of the following strings:
173-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
174-
'longdashdot']
175-
- A number that will be converted to a string
171+
The 'griddash' property is an enumeration that may be specified as:
172+
- One of the following dash styles:
173+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
174+
- A string containing a dash length list in pixels or percentages
175+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
176176
177177
Returns
178178
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/ternary/_aaxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ def griddash(self):
246246
"longdashdot") or a dash length list in px (eg
247247
"5px,10px,2px,2px").
248248
249-
The 'griddash' property is a string and must be specified as:
250-
- One of the following strings:
251-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
252-
'longdashdot']
253-
- A number that will be converted to a string
249+
The 'griddash' property is an enumeration that may be specified as:
250+
- One of the following dash styles:
251+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
252+
- A string containing a dash length list in pixels or percentages
253+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
254254
255255
Returns
256256
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/ternary/_baxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ def griddash(self):
246246
"longdashdot") or a dash length list in px (eg
247247
"5px,10px,2px,2px").
248248
249-
The 'griddash' property is a string and must be specified as:
250-
- One of the following strings:
251-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
252-
'longdashdot']
253-
- A number that will be converted to a string
249+
The 'griddash' property is an enumeration that may be specified as:
250+
- One of the following dash styles:
251+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
252+
- A string containing a dash length list in pixels or percentages
253+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
254254
255255
Returns
256256
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/ternary/_caxis.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -246,11 +246,11 @@ def griddash(self):
246246
"longdashdot") or a dash length list in px (eg
247247
"5px,10px,2px,2px").
248248
249-
The 'griddash' property is a string and must be specified as:
250-
- One of the following strings:
251-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
252-
'longdashdot']
253-
- A number that will be converted to a string
249+
The 'griddash' property is an enumeration that may be specified as:
250+
- One of the following dash styles:
251+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
252+
- A string containing a dash length list in pixels or percentages
253+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
254254
255255
Returns
256256
-------

Diff for: packages/python/plotly/plotly/graph_objs/layout/xaxis/_minor.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ def griddash(self):
132132
"longdashdot") or a dash length list in px (eg
133133
"5px,10px,2px,2px").
134134
135-
The 'griddash' property is a string and must be specified as:
136-
- One of the following strings:
137-
['solid', 'dot', 'dash', 'longdash', 'dashdot',
138-
'longdashdot']
139-
- A number that will be converted to a string
135+
The 'griddash' property is an enumeration that may be specified as:
136+
- One of the following dash styles:
137+
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
138+
- A string containing a dash length list in pixels or percentages
139+
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
140140
141141
Returns
142142
-------

0 commit comments

Comments
 (0)