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 07f82fd

Browse filesBrowse files
committed
Make is_natively_supported private.
There's no public release where that function is available, and there isn't a need to make it public for now.
1 parent e2b581a commit 07f82fd
Copy full SHA for 07f82fd

File tree

Expand file treeCollapse file tree

2 files changed

+16
-17
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+16
-17
lines changed

‎lib/matplotlib/axis.py

Copy file name to clipboardExpand all lines: lib/matplotlib/axis.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1566,7 +1566,7 @@ def have_units(self):
15661566

15671567
def convert_units(self, x):
15681568
# If x is natively supported by Matplotlib, doesn't need converting
1569-
if munits.ConversionInterface.is_natively_supported(x):
1569+
if munits._is_natively_supported(x):
15701570
return x
15711571

15721572
if self.converter is None:

‎lib/matplotlib/units.py

Copy file name to clipboardExpand all lines: lib/matplotlib/units.py
+15-16Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ def default_units(x, axis):
4242
4343
"""
4444

45+
from decimal import Decimal
4546
from numbers import Number
4647

4748
import numpy as np
4849
from numpy import ma
49-
from decimal import Decimal
5050

5151
from matplotlib import cbook
5252

@@ -55,6 +55,20 @@ class ConversionError(TypeError):
5555
pass
5656

5757

58+
def _is_natively_supported(x):
59+
"""
60+
Return whether *x* is of a type that Matplotlib natively supports or an
61+
array of objects of such types.
62+
"""
63+
# Matplotlib natively supports all number types except Decimal.
64+
if np.iterable(x):
65+
# Assume lists are homogeneous as other functions in unit system.
66+
for thisx in x:
67+
return isinstance(thisx, Number) and not isinstance(thisx, Decimal)
68+
else:
69+
return isinstance(x, Number) and not isinstance(x, Decimal)
70+
71+
5872
class AxisInfo:
5973
"""
6074
Information to support default axis labeling, tick labeling, and limits.
@@ -134,21 +148,6 @@ def is_numlike(x):
134148
else:
135149
return isinstance(x, Number)
136150

137-
@staticmethod
138-
def is_natively_supported(x):
139-
"""
140-
Return whether *x* is of a type that Matplotlib natively supports or
141-
*x* is array of objects of such types.
142-
"""
143-
# Matplotlib natively supports all number types except Decimal
144-
if np.iterable(x):
145-
# Assume lists are homogeneous as other functions in unit system
146-
for thisx in x:
147-
return (isinstance(thisx, Number) and
148-
not isinstance(thisx, Decimal))
149-
else:
150-
return isinstance(x, Number) and not isinstance(x, Decimal)
151-
152151

153152
class DecimalConverter(ConversionInterface):
154153
"""

0 commit comments

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