@@ -16,9 +16,17 @@ import numpy as np
1616from numpy import _CastingKind , _OrderKACF # noqa: ICN003
1717from numpy ._typing import _DTypeLikeBool , _NestedSequence
1818
19- from ._array_like import ArrayLike , NDArray , _ArrayLike , _ArrayLikeBool_co , _ArrayLikeInt_co
19+ from ._array_like import (
20+ ArrayLike ,
21+ NDArray ,
22+ _ArrayLike ,
23+ _ArrayLikeBool_co ,
24+ _ArrayLikeInt_co ,
25+ _ArrayLikeNumber_co ,
26+ _ArrayLikeObject_co ,
27+ )
2028from ._dtype_like import DTypeLike , _DTypeLike
21- from ._scalars import _ScalarLike_co
29+ from ._scalars import _NumberLike_co , _ScalarLike_co
2230from ._shape import _ShapeLike
2331
2432###
@@ -201,7 +209,7 @@ class _Call11Bool(Protocol):
201209 dtype : _DTypeLikeBool | None = None ,
202210 ** kwds : Unpack [_Kwargs2 ],
203211 ) -> _ArrayT : ...
204- @overload # (array) -> Array[bool] | bool
212+ @overload # (array) -> Array[bool]
205213 def __call__ (
206214 self ,
207215 x : _AnyArray ,
@@ -255,6 +263,79 @@ class _Call11Isnat(Protocol):
255263 ** kwds : Unpack [_Kwargs2 ],
256264 ) -> NDArray [np .bool ]: ...
257265
266+ @type_check_only
267+ class _Call11Logical (Protocol ):
268+ @overload
269+ def __call__ ( # (scalar, dtype: np.object_) -> bool
270+ self ,
271+ x : _ScalarLike_co ,
272+ / ,
273+ out : None = None ,
274+ * ,
275+ dtype : _DTypeLike [np .object_ ],
276+ ** kwargs : Unpack [_Kwargs2 ],
277+ ) -> bool : ...
278+ @overload
279+ def __call__ ( # (scalar) -> np.bool
280+ self ,
281+ x : _NumberLike_co ,
282+ / ,
283+ out : None = None ,
284+ * ,
285+ dtype : _DTypeLikeBool | None = None ,
286+ ** kwargs : Unpack [_Kwargs2 ],
287+ ) -> np .bool : ...
288+ @overload
289+ def __call__ ( # (array-like, dtype: np.object_) -> np.object_
290+ self ,
291+ x : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
292+ / ,
293+ out : None = None ,
294+ * ,
295+ dtype : _DTypeLike [np .object_ ],
296+ ** kwargs : Unpack [_Kwargs2 ],
297+ ) -> NDArray [np .object_ ] | bool : ...
298+ @overload
299+ def __call__ ( # (array-like, out: T) -> T
300+ self ,
301+ x : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
302+ / ,
303+ out : _Out1 [_ArrayT ],
304+ * ,
305+ dtype : DTypeLike | None = None ,
306+ ** kwargs : Unpack [_Kwargs2 ],
307+ ) -> _ArrayT : ...
308+ @overload # (array) -> Array[bool]
309+ def __call__ (
310+ self ,
311+ x : NDArray [np .bool | np .number ] | _NestedSequence [np .bool | np .number ],
312+ / ,
313+ out : _Out1 [NDArray [np .bool ]] | None = None ,
314+ * ,
315+ dtype : _DTypeLikeBool | None = None ,
316+ ** kwds : Unpack [_Kwargs2 ],
317+ ) -> NDArray [np .bool ]: ...
318+ @overload
319+ def __call__ ( # (array-like) -> Array[bool] | bool
320+ self ,
321+ x : _ArrayLikeNumber_co ,
322+ / ,
323+ out : None = None ,
324+ * ,
325+ dtype : _DTypeLikeBool | None = None ,
326+ ** kwargs : Unpack [_Kwargs2 ],
327+ ) -> NDArray [np .bool ] | np .bool : ...
328+ @overload
329+ def __call__ ( # (?) -> ?
330+ self ,
331+ x : _CanArrayUFunc ,
332+ / ,
333+ out : _Out1 [_AnyArray ] | None = None ,
334+ * ,
335+ dtype : DTypeLike | None = None ,
336+ ** kwargs : Unpack [_Kwargs2 ],
337+ ) -> Any : ...
338+
258339@type_check_only
259340class _Call12 (Protocol ):
260341 @overload
@@ -418,6 +499,119 @@ class _Call21Bool(Protocol):
418499 ** kwds : Unpack [_Kwargs3 ],
419500 ) -> np .bool | NDArray [np .bool ]: ...
420501
502+ @type_check_only
503+ class _Call21Logical (Protocol ):
504+ @overload # (scalar, scalar, dtype: np.object_) -> np.object_
505+ def __call__ (
506+ self ,
507+ x1 : _ScalarLike_co ,
508+ x2 : _ScalarLike_co ,
509+ / ,
510+ out : None = None ,
511+ * ,
512+ dtype : _DTypeLike [np .object_ ],
513+ ** kwds : Unpack [_Kwargs3 ],
514+ ) -> bool : ...
515+ @overload # (scalar, scalar) -> bool
516+ def __call__ (
517+ self ,
518+ x1 : _NumberLike_co ,
519+ x2 : _NumberLike_co ,
520+ / ,
521+ out : None = None ,
522+ * ,
523+ dtype : _DTypeLikeBool | None = None ,
524+ ** kwds : Unpack [_Kwargs3 ],
525+ ) -> np .bool : ...
526+ @overload # (array-like, array, dtype: object_) -> Array[object_]
527+ def __call__ (
528+ self ,
529+ x1 : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
530+ x2 : _AnyArray ,
531+ / ,
532+ out : None = None ,
533+ * ,
534+ dtype : _DTypeLike [np .object_ ],
535+ ** kwds : Unpack [_Kwargs3 ],
536+ ) -> NDArray [np .object_ ]: ...
537+ @overload # (array, array-like, dtype: object_) -> Array[object_]
538+ def __call__ (
539+ self ,
540+ x1 : _AnyArray ,
541+ x2 : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
542+ / ,
543+ out : None = None ,
544+ * ,
545+ dtype : _DTypeLike [np .object_ ],
546+ ** kwds : Unpack [_Kwargs3 ],
547+ ) -> NDArray [np .object_ ]: ...
548+ @overload # (array-like, array, dtype: dtype[T]) -> Array[T]
549+ def __call__ (
550+ self ,
551+ x1 : _ArrayLikeNumber_co ,
552+ x2 : NDArray [np .bool | np .number ] | _NestedSequence [np .bool | np .number ],
553+ / ,
554+ out : None = None ,
555+ * ,
556+ dtype : _DTypeLikeBool | None = None ,
557+ ** kwds : Unpack [_Kwargs3 ],
558+ ) -> NDArray [np .bool ]: ...
559+ @overload # (array, array-like, dtype: dtype[T]) -> Array[T]
560+ def __call__ (
561+ self ,
562+ x1 : NDArray [np .bool | np .number ] | _NestedSequence [np .bool | np .number ],
563+ x2 : _ArrayLikeNumber_co ,
564+ / ,
565+ out : None = None ,
566+ * ,
567+ dtype : _DTypeLikeBool | None = None ,
568+ ** kwds : Unpack [_Kwargs3 ],
569+ ) -> NDArray [np .bool ]: ...
570+ @overload # (array-like, array-like, out: T) -> T
571+ def __call__ (
572+ self ,
573+ x1 : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
574+ x2 : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
575+ / ,
576+ out : _Out1 [_ArrayT ],
577+ * ,
578+ dtype : None = None ,
579+ ** kwds : Unpack [_Kwargs3 ],
580+ ) -> _ArrayT : ...
581+ @overload # (array-like, array) -> Array[?]
582+ def __call__ (
583+ self ,
584+ x1 : _ArrayLikeNumber_co ,
585+ x2 : NDArray [np .bool | np .number ] | _NestedSequence [np .bool | np .number | complex ],
586+ / ,
587+ out : _Out1 [NDArray [np .bool ]] | None = None ,
588+ * ,
589+ dtype : _DTypeLikeBool | None = None ,
590+ ** kwds : Unpack [_Kwargs3 ],
591+ ) -> NDArray [np .bool ]: ...
592+ @overload # (array, array-like) -> Array[?]
593+ def __call__ (
594+ self ,
595+ x1 : NDArray [np .bool | np .number ] | _NestedSequence [np .bool | np .number | complex ],
596+ x2 : _ArrayLikeNumber_co ,
597+ / ,
598+ out : _Out1 [NDArray [np .bool ]] | None = None ,
599+ * ,
600+ dtype : _DTypeLikeBool | None = None ,
601+ ** kwds : Unpack [_Kwargs3 ],
602+ ) -> NDArray [np .bool ]: ...
603+ @overload # (array-like, array-like) -> Array[?] | ?
604+ def __call__ (
605+ self ,
606+ x1 : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
607+ x2 : _ArrayLikeNumber_co | _ArrayLikeObject_co ,
608+ / ,
609+ out : _Out1 [_AnyArray ] | None = None ,
610+ * ,
611+ dtype : DTypeLike | None = None ,
612+ ** kwds : Unpack [_Kwargs3 ],
613+ ) -> Any : ...
614+
421615@type_check_only
422616class _Call21 (Protocol ):
423617 @overload # (scalar, scalar, dtype: type[T]) -> T
0 commit comments