summaryrefslogtreecommitdiff
path: root/numpy/core/defchararray.py
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2020-03-26 17:50:20 +0000
committerGitHub <noreply@github.com>2020-03-26 12:50:20 -0500
commit1c58504eec43f9ba18ac835131fed496fb59772d (patch)
tree4ffc786c9cdac81887680aa999ae6dcbd4bd407d /numpy/core/defchararray.py
parent5ff70eb0fd61a39207d5166479507e1b099cb707 (diff)
downloadnumpy-1c58504eec43f9ba18ac835131fed496fb59772d.tar.gz
MAINT: simplify code that assumes str/unicode and int/long are different types (#15816)
Cleanup from the dropping of python 2
Diffstat (limited to 'numpy/core/defchararray.py')
-rw-r--r--numpy/core/defchararray.py18
1 files changed, 9 insertions, 9 deletions
diff --git a/numpy/core/defchararray.py b/numpy/core/defchararray.py
index 1292b738c..cd01c0e77 100644
--- a/numpy/core/defchararray.py
+++ b/numpy/core/defchararray.py
@@ -24,7 +24,7 @@ from .numeric import array as narray
from numpy.core.multiarray import _vec_string
from numpy.core.overrides import set_module
from numpy.core import overrides
-from numpy.compat import asbytes, long
+from numpy.compat import asbytes
import numpy
__all__ = [
@@ -340,7 +340,7 @@ def multiply(a, i):
i_arr = numpy.asarray(i)
if not issubclass(i_arr.dtype.type, integer):
raise ValueError("Can only multiply by integers")
- out_size = _get_num_chars(a_arr) * max(long(i_arr.max()), 0)
+ out_size = _get_num_chars(a_arr) * max(int(i_arr.max()), 0)
return _vec_string(
a_arr, (a_arr.dtype.type, out_size), '__mul__', (i_arr,))
@@ -450,7 +450,7 @@ def center(a, width, fillchar=' '):
"""
a_arr = numpy.asarray(a)
width_arr = numpy.asarray(width)
- size = long(numpy.max(width_arr.flat))
+ size = int(numpy.max(width_arr.flat))
if numpy.issubdtype(a_arr.dtype, numpy.string_):
fillchar = asbytes(fillchar)
return _vec_string(
@@ -995,7 +995,7 @@ def ljust(a, width, fillchar=' '):
"""
a_arr = numpy.asarray(a)
width_arr = numpy.asarray(width)
- size = long(numpy.max(width_arr.flat))
+ size = int(numpy.max(width_arr.flat))
if numpy.issubdtype(a_arr.dtype, numpy.string_):
fillchar = asbytes(fillchar)
return _vec_string(
@@ -1265,7 +1265,7 @@ def rjust(a, width, fillchar=' '):
"""
a_arr = numpy.asarray(a)
width_arr = numpy.asarray(width)
- size = long(numpy.max(width_arr.flat))
+ size = int(numpy.max(width_arr.flat))
if numpy.issubdtype(a_arr.dtype, numpy.string_):
fillchar = asbytes(fillchar)
return _vec_string(
@@ -1733,7 +1733,7 @@ def zfill(a, width):
"""
a_arr = numpy.asarray(a)
width_arr = numpy.asarray(width)
- size = long(numpy.max(width_arr.flat))
+ size = int(numpy.max(width_arr.flat))
return _vec_string(
a_arr, (a_arr.dtype.type, size), 'zfill', (width_arr,))
@@ -1952,10 +1952,10 @@ class chararray(ndarray):
else:
dtype = string_
- # force itemsize to be a Python long, since using NumPy integer
+ # force itemsize to be a Python int, since using NumPy integer
# types results in itemsize.itemsize being used as the size of
# strings in the new array.
- itemsize = long(itemsize)
+ itemsize = int(itemsize)
if isinstance(buffer, str):
# unicode objects do not have the buffer interface
@@ -2720,7 +2720,7 @@ def array(obj, itemsize=None, copy=True, unicode=None, order=None):
(itemsize != obj.itemsize) or
(not unicode and isinstance(obj, unicode_)) or
(unicode and isinstance(obj, string_))):
- obj = obj.astype((dtype, long(itemsize)))
+ obj = obj.astype((dtype, int(itemsize)))
return obj
if isinstance(obj, ndarray) and issubclass(obj.dtype.type, object):