Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commiteacd058

Browse files
MNT: more isinstance()
1 parent67bde92 commiteacd058

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

‎numpy/_core/tests/test_nditer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1486,7 +1486,7 @@ def test_iter_copy_casts_structured2():
14861486
# Array of two structured scalars:
14871487
forresinres1,res2:
14881488
# Cast to tuple by getitem, which may be weird and changeable?:
1489-
asserttype(res["a"][0])==tuple
1489+
assertisinstance(res["a"][0],tuple)
14901490
assertres["a"][0]== (1,1)
14911491

14921492
forresinres1,res2:

‎numpy/random/_generator.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4718,7 +4718,7 @@ cdef class Generator:
47184718
ifoutisNone:
47194719
out=x.copy(order='K')
47204720
else:
4721-
iftype(out)isnotnp.ndarray:
4721+
ifnotisinstance(out,np.ndarray):
47224722
raiseTypeError('out must be a numpy array')
47234723
PyArray_FailUnlessWriteable(<np.PyArrayObject*>out,"out")
47244724
ifout.shape!=x.shape:

‎numpy/random/mtrand.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4614,7 +4614,7 @@ cdef class RandomState:
46144614
ifisinstance(x,np.ndarray)andnotx.flags.writeable:
46154615
raiseValueError('array is read-only')
46164616

4617-
iftype(x)isnp.ndarrayandx.ndim==1andx.size:
4617+
ifisinstance(x,np.ndarray)andx.ndim==1andx.size:
46184618
# Fast, statically typed path: shuffle the underlying buffer.
46194619
# Only for non-empty, 1d objects of class ndarray (subclasses such
46204620
# as MaskedArrays may not support this approach).

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp