8000 Merge pull request #25384 from mtsokol/missing-refguide-modules · numpy/numpy@3ffad97 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3ffad97

Browse files
authored
Merge pull request #25384 from mtsokol/missing-refguide-modules
MAINT: Add missing modules to refguide test
2 parents 1376621 + 2118506 commit 3ffad97

File tree

4 files changed

+19
-16
lines changed

4 files changed

+19
-16
lines changed

numpy/_core/defchararray.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ def multiply(a, i):
380380
Examples
381381
--------
382382
>>> a = np.array(["a", "b", "c"])
383-
>>> np.char.multiply(x, 3)
383+
>>> np.char.multiply(a, 3)
384384
array(['aaa', 'bbb', 'ccc'], dtype='<U3')
385385
>>> i = np.array([1, 2, 3])
386386
>>> np.char.multiply(a, i)
@@ -621,7 +621,7 @@ def decode(a, encoding=None, errors=None):
621621
... b'\x81\x82\xc2\xc1\xc2\x82\x81'])
622622
>>> c
623623
array([b'\x81\xc1\x81\xc1\x81\xc1', b'@@\x81\xc1@@',
624-
... b'\x81\x82\xc2\xc1\xc2\x82\x81'], dtype='|S7')
624+
b'\x81\x82\xc2\xc1\xc2\x82\x81'], dtype='|S7')
625625
>>> np.char.decode(c, encoding='cp037')
626626
array(['aAaAaA', ' aA ', 'abBABba'], dtype='<U7')
627627
@@ -1184,15 +1184,15 @@ def lstrip(a, chars=None):
11841184
>>> c = np.array(['aAaAaA', ' aA ', 'abBABba'])
11851185
>>> c
11861186
array(['aAaAaA', ' aA ', 'abBABba'], dtype='<U7')
1187-
The 'a' variable is unstripped from c[1] because of leading whitespace.
1187+
# The 'a' variable is unstripped from c[1] because of leading whitespace.
11881188
>>> np.char.lstrip(c, 'a')
11891189
array(['AaAaA', ' aA ', 'bBABba'], dtype='<U7')
11901190
>>> np.char.lstrip(c, 'A') # leaves c unchanged
11911191
array(['aAaAaA', ' aA ', 'abBABba'], dtype='<U7')
11921192
>>> (np.char.lstrip(c, ' ') == np.char.lstrip(c, '')).all()
1193-
False
1193+
np.False_
11941194
>>> (np.char.lstrip(c, ' ') == np.char.lstrip(c)).all()
1195-
True
1195+
np.True_
11961196
11971197
"""
11981198
if chars is None:
@@ -1541,10 +1541,10 @@ def split(a, sep=None, maxsplit=None):
15411541
--------
15421542
>>> x = np.array("Numpy is nice!")
15431543
>>> np.char.split(x, " ")
1544-
array([list(['Numpy', 'is', 'nice!'])], dtype=object)
1544+
array(list(['Numpy', 'is', 'nice!']), dtype=object)
15451545
15461546
>>> np.char.split(x, " ", 1)
1547-
array([list(['Numpy', 'is nice!'])], dtype=object)
1547+
array(list(['Numpy', 'is nice!']), dtype=object)
15481548
15491549
See Also
15501550
--------
@@ -1659,7 +1659,7 @@ def strip(a, chars=None):
16591659
array(['aAaAaA', ' aA ', 'abBABba'], dtype='<U7')
16601660
>>> np.char.strip(c)
16611661
array(['aAaAaA', 'aA', 'abBABba'], dtype='<U7')
1662-
'a' unstripped from c[1] because of leading whitespace.
1662+
# 'a' unstripped from c[1] because of leading whitespace.
16631663
>>> np.char.strip(c, 'a')
16641664
array(['AaAaA', ' aA ', 'bBABb'], dtype='<U7')
16651665
# 'A' unstripped from c[1] because of trailing whitespace.

numpy/_core/records.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ def fromstring(datastring, dtype=None, shape=None, offset=0, formats=None,
834834
835835
>>> s = '\x01\x02\x03abc'
836836
>>> np._core.records.fromstring(s, dtype='u1,u1,u1,S3')
837-
Traceback (most recent call last)
837+
Traceback (most recent call last):
838838
...
839839
TypeError: a bytes-like object is required, not 'str'
840840
"""
@@ -908,7 +908,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None,
908908
>>> r=np._core.records.fromfile(fd, formats='f8,i4,a5', shape=10,
909909
... byteorder='<')
910910
>>> print(r[5])
911-
(0.5, 10, 'abcde')
911+
(0.5, 10, b'abcde')
912912
>>> r.shape
913913
(10,)
914914
"""
@@ -1024,6 +1024,7 @@ def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
10241024
Examples
10251025
--------
10261026
>>> a = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]])
1027+
>>> a
10271028
array([[1, 2, 3],
10281029
[4, 5, 6],
10291030
[7, 8, 9]])
@@ -1032,19 +1033,19 @@ def array(obj, dtype=None, shape=None, offset=0, strides=None, formats=None,
10321033
rec.array([[1, 2, 3],
10331034
[4, 5, 6],
10341035
[7, 8, 9]],
1035-
dtype=int32)
1036+
dtype=int64)
10361037
10371038
>>> b = [(1, 1), (2, 4), (3, 9)]
10381039
>>> c = np.rec.array(b, formats = ['i2', 'f2'], names = ('x', 'y'))
10391040
>>> c
1040-
rec.array([(1, 1.0), (2, 4.0), (3, 9.0)],
1041+
rec.array([(1, 1.), (2, 4.), (3, 9.)],
10411042
dtype=[('x', '<i2'), ('y', '<f2')])
10421043
10431044
>>> c.x
1044-
rec.array([1, 2, 3], dtype=int16)
1045+
array([1, 2, 3], dtype=int16)
10451046
10461047
>>> c.y
1047-
rec.array([ 1.0, 4.0, 9.0], dtype=float16)
1048+
array([1., 4., 9.], dtype=float16)
10481049
10491050
>>> r = np.rec.array(['abc','def'], names=['col1','col2'])
10501051
>>> print(r.col1)

numpy/tests/test_public_api.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,8 +319,6 @@ def test_all_modules_are_expected():
319319
# Stuff that clearly shouldn't be in the API and is detected by the next test
320320
# below
321321
SKIP_LIST_2 = [
322-
'numpy.math',
323-
'numpy.lib.emath',
324322
'numpy.lib.math',
325323
'numpy.matlib.char',
326324
'numpy.matlib.rec',

tools/refguide_check.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@
7272
"lib.introspect",
7373
"lib.array_utils",
7474
"fft",
75+
"char",
76+
"rec",
7577
"ma",
78+
"ma.extras",
79+
"ma.mrecords",
7680
"polynomial",
7781
"polynomial.chebyshev",
7882
"polynomial.hermite",

0 commit comments

Comments
 (0)
0