Skip to content

Commit 9c4a46e

Browse files
authored
Merge pull request numpy#19918 from BvB93/module
MAINT: Override the modules of `np.char` and `np.rec` functions
2 parents 8f0f33b + 50fdbbb commit 9c4a46e

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

numpy/core/defchararray.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2609,6 +2609,7 @@ def isdecimal(self):
26092609
return isdecimal(self)
26102610

26112611

2612+
@set_module("numpy.char")
26122613
def array(obj, itemsize=None, copy=True, unicode=None, order=None):
26132614
"""
26142615
Create a `chararray`.
@@ -2742,6 +2743,7 @@ class adds the following functionality:
27422743
return val.view(chararray)
27432744

27442745

2746+
@set_module("numpy.char")
27452747
def asarray(obj, itemsize=None, unicode=None, order=None):
27462748
"""
27472749
Convert the input to a `chararray`, copying the data only if

numpy/core/records.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,7 @@ def _deprecate_shape_0_as_None(shape):
585585
return shape
586586

587587

588+
@set_module("numpy.rec")
588589
def fromarrays(arrayList, dtype=None, shape=None, formats=None,
589590
names=None, titles=None, aligned=False, byteorder=None):
590591
"""Create a record array from a (flat) list of arrays
@@ -678,6 +679,8 @@ def fromarrays(arrayList, dtype=None, shape=None, formats=None,
678679

679680
return _array
680681

682+
683+
@set_module("numpy.rec")
681684
def fromrecords(recList, dtype=None, shape=None, formats=None, names=None,
682685
titles=None, aligned=False, byteorder=None):
683686
"""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,
762765
return res
763766

764767

768+
@set_module("numpy.rec")
765769
def fromstring(datastring, dtype=None, shape=None, offset=0, formats=None,
766770
names=None, titles=None, aligned=False, byteorder=None):
767771
r"""Create a record array from binary data
@@ -844,6 +848,8 @@ def get_remaining_size(fd):
844848
finally:
845849
fd.seek(pos, 0)
846850

851+
852+
@set_module("numpy.rec")
847853
def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
848854
names=None, titles=None, aligned=False, byteorder=None):
849855
"""Create an array from binary file data
@@ -943,6 +949,8 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
943949

944950
return _array
945951

952+
953+
@set_module("numpy.rec")
946954
def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
947955
names=None, titles=None, aligned=False, byteorder=None, copy=True):
948956
"""

0 commit comments

Comments
 (0)