Skip to content

Commit

Permalink
use line-dash validators everywhere possible (#3722)
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolaskruchten authored May 10, 2022
1 parent 0e29f9c commit d08e0c0
Show file tree
Hide file tree
Showing 45 changed files with 148 additions and 165 deletions.
25 changes: 4 additions & 21 deletions packages/python/plotly/codegen/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,25 +180,6 @@ def format_description(desc):
"frame.layout": "plotly.validators.LayoutValidator",
}

# Add custom dash validators
CUSTOM_VALIDATOR_DATATYPES.update(
{
prop: "_plotly_utils.basevalidators.DashValidator"
for prop in [
"scatter.line.dash",
"histogram2dcontour.line.dash",
"scattergeo.line.dash",
"scatterpolar.line.dash",
"ohlc.line.dash",
"ohlc.decreasing.line.dash",
"ohlc.increasing.line.dash",
"contourcarpet.line.dash",
"contour.line.dash",
"scatterternary.line.dash",
"scattercarpet.line.dash",
]
}
)

# Mapping from property string (as found in plot-schema.json) to a custom
# class name. If not included here, names are converted to TitleCase and
Expand Down Expand Up @@ -435,9 +416,11 @@ def name_base_validator(self) -> str:
str
"""
if self.path_str in CUSTOM_VALIDATOR_DATATYPES:
validator_base = f"{CUSTOM_VALIDATOR_DATATYPES[self.path_str]}"
validator_base = CUSTOM_VALIDATOR_DATATYPES[self.path_str]
elif self.plotly_name.endswith("src") and self.datatype == "string":
validator_base = f"_plotly_utils.basevalidators." f"SrcValidator"
validator_base = "_plotly_utils.basevalidators.SrcValidator"
elif self.plotly_name.endswith("dash") and self.datatype == "string":
validator_base = "_plotly_utils.basevalidators.DashValidator"
elif self.plotly_name == "title" and self.datatype == "compound":
validator_base = "_plotly_utils.basevalidators.TitleValidator"
else:
Expand Down
20 changes: 10 additions & 10 deletions packages/python/plotly/plotly/graph_objs/carpet/_aaxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down Expand Up @@ -838,11 +838,11 @@ def minorgriddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'minorgriddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'minorgriddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
20 changes: 10 additions & 10 deletions packages/python/plotly/plotly/graph_objs/carpet/_baxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,11 +551,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down Expand Up @@ -838,11 +838,11 @@ def minorgriddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'minorgriddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'minorgriddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def dash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'dash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
20 changes: 10 additions & 10 deletions packages/python/plotly/plotly/graph_objs/layout/_xaxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down Expand Up @@ -1735,11 +1735,11 @@ def spikedash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'spikedash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'spikedash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
20 changes: 10 additions & 10 deletions packages/python/plotly/plotly/graph_objs/layout/_yaxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down Expand Up @@ -1606,11 +1606,11 @@ def spikedash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'spikedash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'spikedash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
10 changes: 5 additions & 5 deletions packages/python/plotly/plotly/graph_objs/layout/geo/_lataxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
10 changes: 5 additions & 5 deletions packages/python/plotly/plotly/graph_objs/layout/geo/_lonaxis.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,11 @@ def dash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'dash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
10 changes: 5 additions & 5 deletions packages/python/plotly/plotly/graph_objs/layout/shape/_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def dash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'dash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'dash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,11 +166,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,11 +168,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
10 changes: 5 additions & 5 deletions packages/python/plotly/plotly/graph_objs/layout/xaxis/_minor.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ def griddash(self):
"longdashdot") or a dash length list in px (eg
"5px,10px,2px,2px").
The 'griddash' property is a string and must be specified as:
- One of the following strings:
['solid', 'dot', 'dash', 'longdash', 'dashdot',
'longdashdot']
- A number that will be converted to a string
The 'griddash' property is an enumeration that may be specified as:
- One of the following dash styles:
['solid', 'dot', 'dash', 'longdash', 'dashdot', 'longdashdot']
- A string containing a dash length list in pixels or percentages
(e.g. '5px 10px 2px 2px', '5, 10, 2, 2', '10% 20% 40%', etc.)
Returns
-------
Expand Down
Loading

0 comments on commit d08e0c0

Please sign in to comment.