diff options
author | Sebastian Berg <sebastian@sipsolutions.net> | 2020-01-23 16:50:25 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-01-23 16:50:25 -0800 |
commit | 68224f43d09393c1981bb83ee3c13a5158d2817c (patch) | |
tree | 94153dd189f924c399c2621c325fd2fd2a5e6ba6 /numpy/ma/core.py | |
parent | 4c32890b3628434996824ae2056333b9a389f46c (diff) | |
parent | b4e3a4227e3a9cfe28717db458e67d79e916a418 (diff) | |
download | numpy-68224f43d09393c1981bb83ee3c13a5158d2817c.tar.gz |
Merge pull request #15407 from charris/replace-basestring
MAINT: Replace basestring with str.
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r-- | numpy/ma/core.py | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/numpy/ma/core.py b/numpy/ma/core.py index 41c35026d..6fe442c69 100644 --- a/numpy/ma/core.py +++ b/numpy/ma/core.py @@ -35,7 +35,7 @@ from numpy import ndarray, amax, amin, iscomplexobj, bool_, _NoValue from numpy import array as narray from numpy.lib.function_base import angle from numpy.compat import ( - getargspec, formatargspec, long, basestring, unicode, bytes + getargspec, formatargspec, long, unicode, bytes ) from numpy import expand_dims from numpy.core.numeric import normalize_axis_tuple @@ -456,7 +456,7 @@ def _check_fill_value(fill_value, ndtype): fill_value = np.array(_recursive_set_fill_value(fill_value, ndtype), dtype=ndtype) else: - if isinstance(fill_value, basestring) and (ndtype.char not in 'OSVU'): + if isinstance(fill_value, str) and (ndtype.char not in 'OSVU'): # Note this check doesn't work if fill_value is not a scalar err_msg = "Cannot set fill value of string with array of dtype %s" raise TypeError(err_msg % ndtype) @@ -781,9 +781,9 @@ def fix_invalid(a, mask=nomask, copy=True, fill_value=None): return a def is_string_or_list_of_strings(val): - return (isinstance(val, basestring) or + return (isinstance(val, str) or (isinstance(val, list) and val and - builtins.all(isinstance(s, basestring) for s in val))) + builtins.all(isinstance(s, str) for s in val))) ############################################################################### # Ufuncs # @@ -3300,7 +3300,7 @@ class MaskedArray(ndarray): raise MaskError('Cannot alter the masked element.') _data = self._data _mask = self._mask - if isinstance(indx, basestring): + if isinstance(indx, str): _data[indx] = value if _mask is nomask: self._mask = _mask = make_mask_none(self.shape, self.dtype) |