diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/einsumfunc.py | 7 | ||||
-rw-r--r-- | numpy/core/memmap.py | 4 | ||||
-rw-r--r-- | numpy/core/numeric.py | 3 | ||||
-rw-r--r-- | numpy/core/numerictypes.py | 2 |
4 files changed, 7 insertions, 9 deletions
diff --git a/numpy/core/einsumfunc.py b/numpy/core/einsumfunc.py index ec3eb19d2..342fbbbe1 100644 --- a/numpy/core/einsumfunc.py +++ b/numpy/core/einsumfunc.py @@ -4,7 +4,6 @@ Implementation of optimized einsum. """ import itertools -from numpy.compat import basestring from numpy.core.multiarray import c_einsum from numpy.core.numeric import asanyarray, tensordot from numpy.core.overrides import array_function_dispatch @@ -550,7 +549,7 @@ def _parse_einsum_input(operands): if len(operands) == 0: raise ValueError("No input operands") - if isinstance(operands[0], basestring): + if isinstance(operands[0], str): subscripts = operands[0].replace(" ", "") operands = [asanyarray(v) for v in operands[1:]] @@ -820,7 +819,7 @@ def einsum_path(*operands, optimize='greedy', einsum_call=False): memory_limit = None # No optimization or a named path algorithm - if (path_type is False) or isinstance(path_type, basestring): + if (path_type is False) or isinstance(path_type, str): pass # Given an explicit path @@ -828,7 +827,7 @@ def einsum_path(*operands, optimize='greedy', einsum_call=False): pass # Path tuple with memory limit - elif ((len(path_type) == 2) and isinstance(path_type[0], basestring) and + elif ((len(path_type) == 2) and isinstance(path_type[0], str) and isinstance(path_type[1], (int, float))): memory_limit = int(path_type[1]) path_type = path_type[0] diff --git a/numpy/core/memmap.py b/numpy/core/memmap.py index ad0d7ad79..61b8ba3ac 100644 --- a/numpy/core/memmap.py +++ b/numpy/core/memmap.py @@ -1,7 +1,7 @@ import numpy as np from .numeric import uint8, ndarray, dtype from numpy.compat import ( - long, basestring, os_fspath, contextlib_nullcontext, is_pathlib_path + long, os_fspath, contextlib_nullcontext, is_pathlib_path ) from numpy.core.overrides import set_module @@ -271,7 +271,7 @@ class memmap(ndarray): # special case - if we were constructed with a pathlib.path, # then filename is a path object, not a string self.filename = filename.resolve() - elif hasattr(fid, "name") and isinstance(fid.name, basestring): + elif hasattr(fid, "name") and isinstance(fid.name, str): # py3 returns int for TemporaryFile().name self.filename = os.path.abspath(fid.name) # same as memmap copies (e.g. memmap + 1) diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index f1d7d48f1..5e8151e68 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -6,7 +6,6 @@ import warnings import numbers import numpy as np -from numpy.compat import basestring from . import multiarray from .multiarray import ( _fastCopyAndTranspose as fastCopyAndTranspose, ALLOW_THREADS, @@ -625,7 +624,7 @@ _mode_from_name_dict = {'v': 0, def _mode_from_name(mode): - if isinstance(mode, basestring): + if isinstance(mode, str): return _mode_from_name_dict[mode.lower()[0]] return mode diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index c06552c4e..bd946d760 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -391,7 +391,7 @@ def issubdtype(arg1, arg2): if not isinstance(arg2_orig, dtype): # weird deprecated behaviour, that tried to infer np.floating from # float, and similar less obvious things, such as np.generic from - # basestring + # str. mro = arg2.mro() arg2 = mro[1] if len(mro) > 1 else mro[0] |