Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use line-dash validators everywhere possible #3722

Merged
merged 1 commit into from
May 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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