summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Wieser <wieser.eric@gmail.com>2018-09-20 23:26:23 -0700
committerEric Wieser <wieser.eric@gmail.com>2018-09-20 23:38:04 -0700
commit6bfd1db8228a22c3a3aff11357e8812c3ebaeb6a (patch)
tree2bd3b8b7cb4b16431f6d08b07052df98725b14e2
parentbb72516d9227d8447d9b39e5ab56c17ccdc639ac (diff)
downloadnumpy-6bfd1db8228a22c3a3aff11357e8812c3ebaeb6a.tar.gz
MAINT: Eliminate the private `numerictypes._typestr`
This was used internally only by a private function that is also unused. The loop adding type aliases was shown by #12007 to have no effect.
-rw-r--r--numpy/core/numerictypes.py14
-rw-r--r--numpy/ma/mrecords.py19
2 files changed, 0 insertions, 33 deletions
diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py
index 60d2d88ec..bdaa88cb8 100644
--- a/numpy/core/numerictypes.py
+++ b/numpy/core/numerictypes.py
@@ -762,20 +762,6 @@ ScalarType = tuple(ScalarType)
for key in _sctype2char_dict.keys():
cast[key] = lambda x, k=key: array(x, copy=False).astype(k)
-# Create the typestring lookup dictionary
-_typestr = _typedict()
-for key in _sctype2char_dict.keys():
- if issubclass(key, allTypes['flexible']):
- _typestr[key] = _sctype2char_dict[key]
- else:
- _typestr[key] = empty((1,), key).dtype.str[1:]
-
-# Make sure all typestrings are in sctypeDict
-for key, val in _typestr.items():
- if val not in sctypeDict:
- sctypeDict[val] = key
- raise RuntimeError('{!r}: {!r} was not in sctype'.format(key, val))
-
# Add additional strings to the sctypeDict
if sys.version_info[0] >= 3:
diff --git a/numpy/ma/mrecords.py b/numpy/ma/mrecords.py
index 90a5141b3..daf2f8770 100644
--- a/numpy/ma/mrecords.py
+++ b/numpy/ma/mrecords.py
@@ -29,7 +29,6 @@ from numpy.core.records import (
)
_byteorderconv = np.core.records._byteorderconv
-_typestr = ntypes._typestr
import numpy.ma as ma
from numpy.ma import (
@@ -48,24 +47,6 @@ __all__ = [
reserved_fields = ['_data', '_mask', '_fieldmask', 'dtype']
-def _getformats(data):
- """
- Returns the formats of arrays in arraylist as a comma-separated string.
-
- """
- if hasattr(data, 'dtype'):
- return ",".join([desc[1] for desc in data.dtype.descr])
-
- formats = ''
- for obj in data:
- obj = np.asarray(obj)
- formats += _typestr[obj.dtype.type]
- if issubclass(obj.dtype.type, ntypes.flexible):
- formats += repr(obj.itemsize)
- formats += ','
- return formats[:-1]
-
-
def _checknames(descr, names=None):
"""
Checks that field names ``descr`` are not reserved keywords.