Skip to content

Commit ab78fe4

Browse files
committed
🥅 lib._type_check_impl workarounds for Any shape overload bugs
1 parent 0512a61 commit ab78fe4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

‎src/numpy-stubs/lib/_type_check_impl.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,15 +92,15 @@ def imag(val: _nt.ToGeneric_nd) -> _nt.Array: ...
9292

9393
#
9494
@overload
95-
def iscomplex(x: _nt.ToGeneric_0d) -> np.bool: ...
96-
@overload
9795
def iscomplex(x: _nt.ToGeneric_1nd) -> _nt.Array[np.bool]: ...
96+
@overload
97+
def iscomplex(x: np.generic | _nt._PyScalar) -> np.bool: ...
9898

9999
#
100100
@overload
101-
def isreal(x: _nt.ToGeneric_0d) -> np.bool: ...
102-
@overload
103101
def isreal(x: _nt.ToGeneric_1nd) -> _nt.Array[np.bool]: ...
102+
@overload
103+
def isreal(x: np.generic | _nt._PyScalar) -> np.bool: ...
104104

105105
#
106106
def iscomplexobj(x: _HasDType[Any] | _nt.ToGeneric_nd) -> bool: ...
@@ -131,13 +131,13 @@ def nan_to_num(
131131
# If one passes a complex array to `real_if_close`, then one is reasonably
132132
# expected to verify the output dtype (so we can return an unsafe union here)
133133

134-
@overload
135-
def real_if_close(a: _nt.ToCLongDouble_nd, tol: float = 100) -> _nt.Array[_nt.inexact64l]: ...
136134
@overload
137135
def real_if_close(a: _nt.ToComplex128_nd, tol: float = 100) -> _nt.Array[_nt.inexact64]: ...
138136
@overload
139137
def real_if_close(a: _nt.ToComplex64_nd, tol: float = 100) -> _nt.Array[_nt.inexact32]: ...
140138
@overload
139+
def real_if_close(a: _nt.ToCLongDouble_nd, tol: float = 100) -> _nt.Array[_nt.inexact64l]: ...
140+
@overload
141141
def real_if_close(a: _nt._ToArray_nd[_RealT], tol: float = 100) -> _nt.Array[_RealT]: ...
142142
@overload
143143
def real_if_close(a: _nt.ToGeneric_nd, tol: float = 100) -> _nt.Array: ...

0 commit comments

Comments
 (0)