summaryrefslogtreecommitdiff
path: root/numpy/ma/core.py
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2020-01-23 14:44:36 -0700
committerCharles Harris <charlesr.harris@gmail.com>2020-01-23 14:56:57 -0700
commitb4e3a4227e3a9cfe28717db458e67d79e916a418 (patch)
treef8e78724985f104bb6302d5a36d4e9a0799f0ca1 /numpy/ma/core.py
parent11654979194d7d17b78cee08f4a26877acd5071b (diff)
downloadnumpy-b4e3a4227e3a9cfe28717db458e67d79e916a418.tar.gz
MAINT: Replace basestring with str.
This replaces basestring with str except in - tools/npy_tempita/ - numpy/compat/py3k.py
Diffstat (limited to 'numpy/ma/core.py')
-rw-r--r--numpy/ma/core.py10
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)