Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bb1566a

Browse filesBrowse files
authored
Merge branch 'master' into update-plotly-js-version
2 parents c4c4142 + 16dd6a3 commit bb1566a
Copy full SHA for bb1566a

File tree

4 files changed

+44
-6
lines changed
Filter options

4 files changed

+44
-6
lines changed

‎CHANGELOG.md

Copy file name to clipboardExpand all lines: CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
66

77
### Updated
88
- Specify Python version 3.8-3.11 for development virtual environments and pin `pytest` at version 8.1.1 to match.
9+
- Update `IntegerValidator` to handle `extras` option to allow supporting additional keyword values. For example, 'bold' and 'normal' as well as integers as used in font weights [#4612].
910

1011
## [5.22.0] - 2024-05-01
1112

‎README.md

Copy file name to clipboardExpand all lines: README.md
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,13 @@
3131
</tr>
3232
</table>
3333

34+
<div align="center">
35+
<a href="https://dash.plotly.com/project-maintenance">
36+
<img src="https://dash.plotly.com/assets/images/maintained-by-plotly.png" width="400px" alt="Maintained by Plotly">
37+
</a>
38+
</div>
39+
40+
3441
## Quickstart
3542

3643
`pip install plotly==5.22.0`

‎packages/python/plotly/_plotly_utils/basevalidators.py

Copy file name to clipboardExpand all lines: packages/python/plotly/_plotly_utils/basevalidators.py
+30-3Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -824,13 +824,21 @@ class IntegerValidator(BaseValidator):
824824
"dflt",
825825
"min",
826826
"max",
827+
"extras",
827828
"arrayOk"
828829
]
829830
},
830831
"""
831832

832833
def __init__(
833-
self, plotly_name, parent_name, min=None, max=None, array_ok=False, **kwargs
834+
self,
835+
plotly_name,
836+
parent_name,
837+
min=None,
838+
max=None,
839+
extras=None,
840+
array_ok=False,
841+
**kwargs,
834842
):
835843
super(IntegerValidator, self).__init__(
836844
plotly_name=plotly_name, parent_name=parent_name, **kwargs
@@ -855,6 +863,7 @@ def __init__(
855863
else:
856864
self.has_min_max = False
857865

866+
self.extras = extras if extras is not None else []
858867
self.array_ok = array_ok
859868

860869
def description(self):
@@ -878,6 +887,16 @@ def description(self):
878887
)
879888
)
880889

890+
# Extras
891+
if self.extras:
892+
desc = (
893+
desc
894+
+ (
895+
"""
896+
OR exactly one of {extras} (e.g. '{eg_extra}')"""
897+
).format(extras=self.extras, eg_extra=self.extras[-1])
898+
)
899+
881900
if self.array_ok:
882901
desc = (
883902
desc
@@ -891,6 +910,8 @@ def validate_coerce(self, v):
891910
if v is None:
892911
# Pass None through
893912
pass
913+
elif v in self.extras:
914+
return v
894915
elif self.array_ok and is_homogeneous_array(v):
895916
np = get_module("numpy")
896917
v_array = copy_to_readonly_numpy_array(
@@ -917,14 +938,20 @@ def validate_coerce(self, v):
917938
v = v_array
918939
elif self.array_ok and is_simple_array(v):
919940
# Check integer type
920-
invalid_els = [e for e in v if not isinstance(e, int)]
941+
invalid_els = [
942+
e for e in v if not isinstance(e, int) and e not in self.extras
943+
]
921944

922945
if invalid_els:
923946
self.raise_invalid_elements(invalid_els[:10])
924947

925948
# Check min/max
926949
if self.has_min_max:
927-
invalid_els = [e for e in v if not (self.min_val <= e <= self.max_val)]
950+
invalid_els = [
951+
e
952+
for e in v
953+
if not (self.min_val <= e <= self.max_val) and e not in self.extras
954+
]
928955

929956
if invalid_els:
930957
self.raise_invalid_elements(invalid_els[:10])

‎packages/python/plotly/plotly/express/_doc.py

Copy file name to clipboardExpand all lines: packages/python/plotly/plotly/express/_doc.py
+6-3Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@
248248
],
249249
facet_row_spacing=[
250250
"float between 0 and 1",
251-
"Spacing between facet rows, in paper units. Default is 0.03 or 0.0.7 when facet_col_wrap is used.",
251+
"Spacing between facet rows, in paper units. Default is 0.03 or 0.07 when facet_col_wrap is used.",
252252
],
253253
facet_col_spacing=[
254254
"float between 0 and 1",
@@ -433,7 +433,7 @@
433433
"str",
434434
"One of `'auto'`, `'svg'` or `'webgl'`, default `'auto'`",
435435
"Controls the browser API used to draw marks.",
436-
"`'svg`' is appropriate for figures of less than 1000 data points, and will allow for fully-vectorized output.",
436+
"`'svg'` is appropriate for figures of less than 1000 data points, and will allow for fully-vectorized output.",
437437
"`'webgl'` is likely necessary for acceptable performance above 1000 points but rasterizes part of the output. ",
438438
"`'auto'` uses heuristics to choose the mode.",
439439
],
@@ -510,7 +510,10 @@
510510
"boolean (default `False`)",
511511
"If `True`, an extra line segment is drawn between the first and last point.",
512512
],
513-
line_shape=["str (default `'linear'`)", "One of `'linear'` or `'spline'`."],
513+
line_shape=[
514+
"str (default `'linear'`)",
515+
"One of `'linear'`, `'spline'`, `'hv'`, `'vh'`, `'hvh'`, or `'vhv'`",
516+
],
514517
fitbounds=["str (default `False`).", "One of `False`, `locations` or `geojson`."],
515518
basemap_visible=["bool", "Force the basemap visibility."],
516519
scope=[

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.