summaryrefslogtreecommitdiff
path: root/numpy/core/records.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/core/records.py')
-rw-r--r--numpy/core/records.py18
1 files changed, 13 insertions, 5 deletions
diff --git a/numpy/core/records.py b/numpy/core/records.py
index fd5f1ab39..c014bc97c 100644
--- a/numpy/core/records.py
+++ b/numpy/core/records.py
@@ -41,7 +41,7 @@ from . import numeric as sb
from . import numerictypes as nt
from numpy.compat import os_fspath
from numpy.core.overrides import set_module
-from .arrayprint import get_printoptions
+from .arrayprint import _get_legacy_print_mode
# All of the functions allow formats to be a dtype
__all__ = [
@@ -68,7 +68,7 @@ _byteorderconv = {'b':'>',
'i':'|'}
# formats regular expression
-# allows multidimension spec with a tuple syntax in front
+# allows multidimensional spec with a tuple syntax in front
# of the letter code '(2,3)f4' and ' ( 2 , 3 ) f4 '
# are equally allowed
@@ -230,12 +230,12 @@ class record(nt.void):
__module__ = 'numpy'
def __repr__(self):
- if get_printoptions()['legacy'] == '1.13':
+ if _get_legacy_print_mode() <= 113:
return self.__str__()
return super().__repr__()
def __str__(self):
- if get_printoptions()['legacy'] == '1.13':
+ if _get_legacy_print_mode() <= 113:
return str(self.item())
return super().__str__()
@@ -551,7 +551,7 @@ class recarray(ndarray):
lst = "[], shape=%s" % (repr(self.shape),)
lf = '\n'+' '*len(prefix)
- if get_printoptions()['legacy'] == '1.13':
+ if _get_legacy_print_mode() <= 113:
lf = ' ' + lf # trailing space
return fmt % (lst, lf, repr_dtype)
@@ -585,6 +585,7 @@ def _deprecate_shape_0_as_None(shape):
return shape
+@set_module("numpy.rec")
def fromarrays(arrayList, dtype=None, shape=None, formats=None,
names=None, titles=None, aligned=False, byteorder=None):
"""Create a record array from a (flat) list of arrays
@@ -678,6 +679,8 @@ def fromarrays(arrayList, dtype=None, shape=None, formats=None,
return _array
+
+@set_module("numpy.rec")
def fromrecords(recList, dtype=None, shape=None, formats=None, names=None,
titles=None, aligned=False, byteorder=None):
"""Create a recarray from a list of records in text form.
@@ -762,6 +765,7 @@ def fromrecords(recList, dtype=None, shape=None, formats=None, names=None,
return res
+@set_module("numpy.rec")
def fromstring(datastring, dtype=None, shape=None, offset=0, formats=None,
names=None, titles=None, aligned=False, byteorder=None):
r"""Create a record array from binary data
@@ -844,6 +848,8 @@ def get_remaining_size(fd):
finally:
fd.seek(pos, 0)
+
+@set_module("numpy.rec")
def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
names=None, titles=None, aligned=False, byteorder=None):
"""Create an array from binary file data
@@ -943,6 +949,8 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
return _array
+
+@set_module("numpy.rec")
def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
names=None, titles=None, aligned=False, byteorder=None, copy=True):
"""