@@ -22,7 +22,6 @@ from numpy._typing import (
22
22
NDArray ,
23
23
_SupportsArray ,
24
24
_NestedSequence ,
25
- _FiniteNestedSequence ,
26
25
_ArrayLike ,
27
26
_ArrayLikeBool_co ,
28
27
_ArrayLikeUInt_co ,
@@ -33,28 +32,27 @@ from numpy._typing import (
33
32
_ArrayLikeComplex128_co ,
34
33
_ArrayLikeComplex_co ,
35
34
_ArrayLikeNumber_co ,
35
+ _ArrayLikeObject_co ,
36
+ _ArrayLikeBytes_co ,
37
+ _ArrayLikeStr_co ,
38
+ _ArrayLikeString_co ,
36
39
_ArrayLikeTD64_co ,
37
40
_ArrayLikeDT64_co ,
38
- _ArrayLikeObject_co ,
39
-
40
41
# DTypes
41
42
DTypeLike ,
42
43
_DTypeLike ,
43
44
_DTypeLikeVoid ,
44
45
_VoidDTypeLike ,
45
-
46
46
# Shapes
47
47
_Shape ,
48
48
_ShapeLike ,
49
-
50
49
# Scalars
51
50
_CharLike_co ,
52
51
_IntLike_co ,
53
52
_FloatLike_co ,
54
53
_TD64Like_co ,
55
54
_NumberLike_co ,
56
55
_ScalarLike_co ,
57
-
58
56
# `number` precision
59
57
NBitBase ,
60
58
# NOTE: Do not remove the extended precision bit-types even if seemingly unused;
@@ -77,7 +75,6 @@ from numpy._typing import (
77
75
_NBitSingle ,
78
76
_NBitDouble ,
79
77
_NBitLongDouble ,
80
-
81
78
# Character codes
82
79
_BoolCodes ,
83
80
_UInt8Codes ,
@@ -119,7 +116,6 @@ from numpy._typing import (
119
116
_VoidCodes ,
120
117
_ObjectCodes ,
121
118
_StringCodes ,
122
-
123
119
_UnsignedIntegerCodes ,
124
120
_SignedIntegerCodes ,
125
121
_IntegerCodes ,
@@ -130,7 +126,6 @@ from numpy._typing import (
130
126
_CharacterCodes ,
131
127
_FlexibleCodes ,
132
128
_GenericCodes ,
133
-
134
129
# Ufuncs
135
130
_UFunc_Nin1_Nout1 ,
136
131
_UFunc_Nin2_Nout1 ,
@@ -2552,55 +2547,77 @@ class ndarray(_ArrayOrScalarCommon, Generic[_ShapeT_co, _DType_co]):
2552
2547
@overload # ?-d
2553
2548
def __iter__ (self , / ) -> Iterator [Any ]: ...
2554
2549
2555
- # The last overload is for catching recursive objects whose
2556
- # nesting is too deep.
2557
- # The first overload is for catching `bytes` (as they are a subtype of
2558
- # `Sequence[int]`) and `str`. As `str` is a recursive sequence of
2559
- # strings, it will pass through the final overload otherwise
2560
-
2550
+ #
2561
2551
@overload
2562
2552
def __lt__ (self : _ArrayNumber_co , other : _ArrayLikeNumber_co , / ) -> NDArray [np .bool ]: ...
2563
2553
@overload
2564
2554
def __lt__ (self : _ArrayTD64_co , other : _ArrayLikeTD64_co , / ) -> NDArray [np .bool ]: ...
2565
2555
@overload
2566
2556
def __lt__ (self : NDArray [datetime64 ], other : _ArrayLikeDT64_co , / ) -> NDArray [np .bool ]: ...
2567
2557
@overload
2568
- def __lt__ (self : NDArray [object_ ], other : Any , / ) -> NDArray [np .bool ]: ...
2558
+ def __lt__ (self : NDArray [bytes_ ], other : _ArrayLikeBytes_co , / ) -> NDArray [np .bool ]: ...
2569
2559
@overload
2570
- def __lt__ (self : NDArray [Any ], other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2560
+ def __lt__ (
2561
+ self : ndarray [Any , dtype [str_ ] | dtypes .StringDType ], other : _ArrayLikeStr_co | _ArrayLikeString_co , /
2562
+ ) -> NDArray [np .bool ]: ...
2563
+ @overload
2564
+ def __lt__ (self : NDArray [object_ ], other : object , / ) -> NDArray [np .bool ]: ...
2565
+ @overload
2566
+ def __lt__ (self , other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2571
2567
2568
+ #
2572
2569
@overload
2573
2570
def __le__ (self : _ArrayNumber_co , other : _ArrayLikeNumber_co , / ) -> NDArray [np .bool ]: ...
2574
2571
@overload
2575
2572
def __le__ (self : _ArrayTD64_co , other : _ArrayLikeTD64_co , / ) -> NDArray [np .bool ]: ...
2576
2573
@overload
2577
2574
def __le__ (self : NDArray [datetime64 ], other : _ArrayLikeDT64_co , / ) -> NDArray [np .bool ]: ...
2578
2575
@overload
2579
- def __le__ (self : NDArray [object_ ], other : Any , / ) -> NDArray [np .bool ]: ...
2576
+ def __le__ (self : NDArray [bytes_ ], other : _ArrayLikeBytes_co , / ) -> NDArray [np .bool ]: ...
2580
2577
@overload
2581
- def __le__ (self : NDArray [Any ], other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2578
+ def __le__ (
2579
+ self : ndarray [Any , dtype [str_ ] | dtypes .StringDType ], other : _ArrayLikeStr_co | _ArrayLikeString_co , /
2580
+ ) -> NDArray [np .bool ]: ...
2581
+ @overload
2582
+ def __le__ (self : NDArray [object_ ], other : object , / ) -> NDArray [np .bool ]: ...
2583
+ @overload
2584
+ def __le__ (self , other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2582
2585
2586
+ #
2583
2587
@overload
2584
2588
def __gt__ (self : _ArrayNumber_co , other : _ArrayLikeNumber_co , / ) -> NDArray [np .bool ]: ...
2585
2589
@overload
2586
2590
def __gt__ (self : _ArrayTD64_co , other : _ArrayLikeTD64_co , / ) -> NDArray [np .bool ]: ...
2587
2591
@overload
2588
2592
def __gt__ (self : NDArray [datetime64 ], other : _ArrayLikeDT64_co , / ) -> NDArray [np .bool ]: ...
2589
2593
@overload
2590
- def __gt__ (self : NDArray [object_ ], other : Any , / ) -> NDArray [np .bool ]: ...
2594
+ def __gt__ (self : NDArray [bytes_ ], other : _ArrayLikeBytes_co , / ) -> NDArray [np .bool ]: ...
2591
2595
@overload
2592
- def __gt__ (self : NDArray [Any ], other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2596
+ def __gt__ (
2597
+ self : ndarray [Any , dtype [str_ ] | dtypes .StringDType ], other : _ArrayLikeStr_co | _ArrayLikeString_co , /
2598
+ ) -> NDArray [np .bool ]: ...
2599
+ @overload
2600
+ def __gt__ (self : NDArray [object_ ], other : object , / ) -> NDArray [np .bool ]: ...
2601
+ @overload
2602
+ def __gt__ (self , other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2593
2603
2604
+ #
2594
2605
@overload
2595
2606
def __ge__ (self : _ArrayNumber_co , other : _ArrayLikeNumber_co , / ) -> NDArray [np .bool ]: ...
2596
2607
@overload
2597
2608
def __ge__ (self : _ArrayTD64_co , other : _ArrayLikeTD64_co , / ) -> NDArray [np .bool ]: ...
2598
2609
@overload
2599
2610
def __ge__ (self : NDArray [datetime64 ], other : _ArrayLikeDT64_co , / ) -> NDArray [np .bool ]: ...
2600
2611
@overload
2601
- def __ge__ (self : NDArray [object_ ], other : Any , / ) -> NDArray [np .bool ]: ...
2612
+ def __ge__ (self : NDArray [bytes_ ], other : _ArrayLikeBytes_co , / ) -> NDArray [np .bool ]: ...
2613
+ @overload
2614
+ def __ge__ (
2615
+ self : ndarray [Any , dtype [str_ ] | dtypes .StringDType ], other : _ArrayLikeStr_co | _ArrayLikeString_co , /
2616
+ ) -> NDArray [np .bool ]: ...
2617
+ @overload
2618
+ def __ge__ (self : NDArray [object_ ], other : object , / ) -> NDArray [np .bool ]: ...
2602
2619
@overload
2603
- def __ge__ (self : NDArray [ Any ] , other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2620
+ def __ge__ (self , other : _ArrayLikeObject_co , / ) -> NDArray [np .bool ]: ...
2604
2621
2605
2622
# Unary ops
2606
2623
0 commit comments