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

Appearance settings

Commit eacd058

Browse filesBrowse files
MNT: more isinstance()
1 parent 67bde92 commit eacd058
Copy full SHA for eacd058

File tree

Expand file treeCollapse file tree

3 files changed

+3
-3
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+3
-3
lines changed

‎numpy/_core/tests/test_nditer.py

Copy file name to clipboardExpand all lines: numpy/_core/tests/test_nditer.py
+1-1Lines 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
for res in res1, res2:
14881488
# Cast to tuple by getitem, which may be weird and changeable?:
1489-
assert type(res["a"][0]) == tuple
1489+
assert isinstance(res["a"][0], tuple)
14901490
assert res["a"][0] == (1, 1)
14911491

14921492
for res in res1, res2:

‎numpy/random/_generator.pyx

Copy file name to clipboardExpand all lines: numpy/random/_generator.pyx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4718,7 +4718,7 @@ cdef class Generator:
47184718
if out is None:
47194719
out = x.copy(order='K')
47204720
else:
4721-
if type(out) is not np.ndarray:
4721+
if not isinstance(out, np.ndarray):
47224722
raise TypeError('out must be a numpy array')
47234723
PyArray_FailUnlessWriteable(<np.PyArrayObject *>out, "out")
47244724
if out.shape != x.shape:

‎numpy/random/mtrand.pyx

Copy file name to clipboardExpand all lines: numpy/random/mtrand.pyx
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4614,7 +4614,7 @@ cdef class RandomState:
46144614
if isinstance(x, np.ndarray) and not x.flags.writeable:
46154615
raise ValueError('array is read-only')
46164616

4617-
if type(x) is np.ndarray and x.ndim == 1 and x.size:
4617+
if isinstance(x, np.ndarray) and x.ndim == 1 and x.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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.