diff options
author | Eric Wieser <wieser.eric@gmail.com> | 2017-08-01 20:29:36 +0000 |
---|---|---|
committer | Charles Harris <charlesr.harris@gmail.com> | 2017-08-05 10:36:48 -0600 |
commit | 2b781f8967488dc007f8f0a1e6a7f49208788d12 (patch) | |
tree | 88ad7478e033ce5980a365a479e22b78ba1cecaa /numpy/lib/npyio.py | |
parent | 5ab02b15de72fa00d785f49c62466fe048264cc4 (diff) | |
download | numpy-2b781f8967488dc007f8f0a1e6a7f49208788d12.tar.gz |
MAINT/DOC: Use builtin when np.{x} is builtins.{x}.
This is the case for x in {int, bool, str, float, complex, object}.
Using the np.{x} version is deceptive as it suggests that there is a
difference. This change doesn't affect any external behaviour. The
`long` type is missing in python 3, so np.long is still useful
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 187a6722a..17b585ee5 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -737,7 +737,7 @@ def _getconv(dtype): return np.longdouble elif issubclass(typ, np.floating): return floatconv - elif issubclass(typ, np.complex): + elif issubclass(typ, complex): return lambda x: complex(asstr(x)) elif issubclass(typ, np.bytes_): return asbytes @@ -1902,16 +1902,16 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, # If the dtype is uniform, don't define names, else use '' base = set([c.type for c in converters if c._checked]) if len(base) == 1: - (ddtype, mdtype) = (list(base)[0], np.bool) + (ddtype, mdtype) = (list(base)[0], bool) else: ddtype = [(defaultfmt % i, dt) for (i, dt) in enumerate(column_types)] if usemask: - mdtype = [(defaultfmt % i, np.bool) + mdtype = [(defaultfmt % i, bool) for (i, dt) in enumerate(column_types)] else: ddtype = list(zip(names, column_types)) - mdtype = list(zip(names, [np.bool] * len(column_types))) + mdtype = list(zip(names, [bool] * len(column_types))) output = np.array(data, dtype=ddtype) if usemask: outputmask = np.array(masks, dtype=mdtype) @@ -1937,7 +1937,7 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, # Now, process the rowmasks the same way if usemask: rowmasks = np.array( - masks, dtype=np.dtype([('', np.bool) for t in dtype_flat])) + masks, dtype=np.dtype([('', bool) for t in dtype_flat])) # Construct the new dtype mdtype = make_mask_descr(dtype) outputmask = rowmasks.view(mdtype) @@ -1968,9 +1968,9 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, output = np.array(data, dtype) if usemask: if dtype.names: - mdtype = [(_, np.bool) for _ in dtype.names] + mdtype = [(_, bool) for _ in dtype.names] else: - mdtype = np.bool + mdtype = bool outputmask = np.array(masks, dtype=mdtype) # Try to take care of the missing data we missed names = output.dtype.names |