Skip to content

Commit a2cf7b4

Browse files
committed
Move seldom used _is_array func to lambda
1 parent 8ed573c commit a2cf7b4

2 files changed

Lines changed: 3 additions & 17 deletions

File tree

proplot/axes/plot.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4181,10 +4181,8 @@ def _iter_arg_cols(self, *args, label=None, labels=None, values=None, **kwargs):
41814181
# Handle cycle args and label lists
41824182
# NOTE: Arrays here should have had metadata stripped by _parse_1d_args
41834183
# but could still be pint quantities that get processed by axis converter.
4184-
n = max(
4185-
1 if not inputs._is_array(a) or a.ndim < 2 else a.shape[-1]
4186-
for a in args
4187-
)
4184+
is_array = lambda data: hasattr(data, 'ndim') and hasattr(data, 'shape') # noqa: E731, E501
4185+
n = max(1 if not is_array(a) or a.ndim < 2 else a.shape[-1] for a in args)
41884186
labels = _not_none(label=label, values=values, labels=labels)
41894187
if not np.iterable(labels) or isinstance(labels, str):
41904188
labels = n * [labels]
@@ -4202,9 +4200,7 @@ def _iter_arg_cols(self, *args, label=None, labels=None, values=None, **kwargs):
42024200
for i in range(n):
42034201
kw = kwargs.copy()
42044202
kw['label'] = labels[i] or None
4205-
a = tuple(
4206-
a if not inputs._is_array(a) or a.ndim < 2 else a[..., i] for a in args
4207-
)
4203+
a = tuple(a if not is_array(a) or a.ndim < 2 else a[..., i] for a in args)
42084204
yield (i, n, *a, kw)
42094205

42104206
# Related parsing functions for warnings

proplot/internals/inputs.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -54,16 +54,6 @@ def _load_objects():
5454

5555

5656
# Type utilities
57-
def _is_array(data):
58-
"""
59-
Test whether input is numpy array or pint quantity.
60-
"""
61-
# NOTE: This is used in _iter_columns to identify 2D matrices that
62-
# should be iterated over and omit e.g. scalar marker size or marker color.
63-
_load_objects()
64-
return isinstance(data, ndarray) or ndarray is not Quantity and isinstance(data, Quantity) # noqa: E501
65-
66-
6757
def _is_numeric(data):
6858
"""
6959
Test whether input is numeric array rather than datetime or strings.

0 commit comments

Comments
 (0)