@@ -85,10 +85,13 @@ HashableT5 = TypeVar("HashableT5", bound=Hashable)
8585
8686# array-like
8787
88- ArrayLike : TypeAlias = ExtensionArray | np .ndarray
88+ ArrayLike : TypeAlias = ExtensionArray | np .ndarray [ tuple [ int ], np . dtype [ Any ]]
8989AnyArrayLike : TypeAlias = ArrayLike | Index | Series
9090AnyArrayLikeInt : TypeAlias = (
91- IntegerArray | Index [int ] | Series [int ] | npt .NDArray [np .integer ]
91+ IntegerArray
92+ | Index [int ]
93+ | Series [int ]
94+ | np .ndarray [tuple [int ], np .dtype [np .integer ]]
9295)
9396
9497# list-like
@@ -166,6 +169,7 @@ ToTimestampHow: TypeAlias = Literal["s", "e", "start", "end"]
166169NDFrameT = TypeVar ("NDFrameT" , bound = NDFrame )
167170
168171IndexT = TypeVar ("IndexT" , bound = Index )
172+ T_EXTENSION_ARRAY = TypeVar ("T_EXTENSION_ARRAY" , bound = ExtensionArray )
169173
170174# From _typing.py, not used here:
171175# FreqIndexT = TypeVar("FreqIndexT", "DatetimeIndex", "PeriodIndex", "TimedeltaIndex")
@@ -697,11 +701,11 @@ InterpolateOptions: TypeAlias = Literal[
697701# Using List[int] here rather than Sequence[int] to disallow tuples.
698702
699703ScalarIndexer : TypeAlias = int | np .integer
700- SequenceIndexer : TypeAlias = slice | list [int ] | np .ndarray
704+ SequenceIndexer : TypeAlias = slice | list [int ] | npt . NDArray [ np .integer | np . bool ]
701705PositionalIndexer : TypeAlias = ScalarIndexer | SequenceIndexer
702706PositionalIndexerTuple : TypeAlias = tuple [PositionalIndexer , PositionalIndexer ]
703707# PositionalIndexer2D = Union[PositionalIndexer, PositionalIndexerTuple] Not used in stubs
704- TakeIndexer : TypeAlias = Sequence [int ] | Sequence [ np .integer ] | npt .NDArray [np .integer ]
708+ TakeIndexer : TypeAlias = Sequence [int | np .integer ] | npt .NDArray [np .integer | np . bool ]
705709
706710# Shared by functions such as drop and astype
707711IgnoreRaise : TypeAlias = Literal ["ignore" , "raise" ]
@@ -832,18 +836,6 @@ SliceType: TypeAlias = Hashable | None
832836## All types below this point are only used in pandas-stubs
833837######
834838
835- num : TypeAlias = complex
836-
837- DtypeNp = TypeVar ("DtypeNp" , bound = np .dtype [np .generic ])
838- KeysArgType : TypeAlias = Any
839- ListLikeT = TypeVar ("ListLikeT" , bound = ListLike )
840- ListLikeExceptSeriesAndStr : TypeAlias = (
841- MutableSequence [Any ] | np .ndarray | tuple [Any , ...] | Index
842- )
843- ListLikeU : TypeAlias = Sequence | np .ndarray | Series | Index
844- ListLikeHashable : TypeAlias = (
845- MutableSequence [HashableT ] | np .ndarray | tuple [HashableT , ...] | range
846- )
847839StrLike : TypeAlias = str | np .str_
848840
849841ScalarT = TypeVar ("ScalarT" , bound = Scalar )
@@ -871,6 +863,17 @@ np_ndarray: TypeAlias = np.ndarray[ShapeT, np.dtype[GenericT]]
871863np_1darray : TypeAlias = np .ndarray [tuple [int ], np .dtype [GenericT ]]
872864np_2darray : TypeAlias = np .ndarray [tuple [int , int ], np .dtype [GenericT ]]
873865
866+ DtypeNp = TypeVar ("DtypeNp" , bound = np .dtype [np .generic ])
867+ KeysArgType : TypeAlias = Any
868+ ListLikeT = TypeVar ("ListLikeT" , bound = ListLike )
869+ ListLikeExceptSeriesAndStr : TypeAlias = (
870+ MutableSequence [Any ] | np_1darray [Any ] | tuple [Any , ...] | Index
871+ )
872+ ListLikeU : TypeAlias = Sequence | np_1darray [Any ] | Series | Index
873+ ListLikeHashable : TypeAlias = (
874+ MutableSequence [HashableT ] | np_1darray [Any ] | tuple [HashableT , ...] | range
875+ )
876+
874877class SupportsDType (Protocol [GenericT_co ]):
875878 @property
876879 def dtype (self ) -> np .dtype [GenericT_co ]: ...
0 commit comments