Skip to content

Commit 3e45dd2

Browse files
NoyHananQuLogic
andcommitted
Removed unneccacery import from rcsetup.py and made validate_legend_loc
private Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
1 parent 5fc20d2 commit 3e45dd2

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

lib/matplotlib/rcsetup.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
"""
1515

1616
import ast
17-
import numbers
1817
from functools import lru_cache, reduce
1918
from numbers import Real
2019
import operator
@@ -730,7 +729,7 @@ def visit_Attribute(self, node):
730729
ignorecase=True)
731730

732731

733-
def validate_legend_loc(loc):
732+
def _validate_legend_loc(loc):
734733
"""
735734
Confirm that loc is a type which rc.Params["legend.loc"] supports.
736735
@@ -759,8 +758,7 @@ def validate_legend_loc(loc):
759758
if 0 <= loc <= 10:
760759
return loc
761760
if isinstance(loc, tuple):
762-
if len(loc) == 2 \
763-
and all(isinstance(e, numbers.Real) for e in loc):
761+
if len(loc) == 2 and all(isinstance(e, Real) for e in loc):
764762
return loc
765763
raise ValueError(f"{loc} is not a valid legend location.")
766764

@@ -1089,7 +1087,7 @@ def _convert_validator_spec(key, conv):
10891087

10901088
# legend properties
10911089
"legend.fancybox": validate_bool,
1092-
"legend.loc": validate_legend_loc,
1090+
"legend.loc": _validate_legend_loc,
10931091

10941092
# the number of points in the legend line
10951093
"legend.numpoints": validate_int,

lib/matplotlib/rcsetup.pyi

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,5 +156,3 @@ def validate_hist_bins(
156156
) -> Literal["auto", "sturges", "fd", "doane", "scott", "rice", "sqrt"] | int | list[
157157
float
158158
]: ...
159-
160-
def validate_legend_loc(loc: Any) -> str | int | tuple[float, float]: ...

0 commit comments

Comments
 (0)