@@ -15,6 +15,7 @@ from re import Pattern
15
15
import sys
16
16
from typing import (
17
17
Any ,
18
+ Generic ,
18
19
Literal ,
19
20
Protocol ,
20
21
SupportsIndex ,
@@ -37,6 +38,7 @@ from typing_extensions import (
37
38
ParamSpec ,
38
39
TypeAlias ,
39
40
TypeVar ,
41
+ override ,
40
42
)
41
43
42
44
from pandas ._libs .interval import Interval
@@ -818,6 +820,8 @@ np_ndarray_float: TypeAlias = npt.NDArray[np.floating]
818
820
np_ndarray_complex : TypeAlias = npt .NDArray [np .complexfloating ]
819
821
np_ndarray_bool : TypeAlias = npt .NDArray [np .bool_ ]
820
822
np_ndarray_str : TypeAlias = npt .NDArray [np .str_ ]
823
+ np_ndarray_dt : TypeAlias = npt .NDArray [np .datetime64 ]
824
+ np_ndarray_td : TypeAlias = npt .NDArray [np .timedelta64 ]
821
825
822
826
# Define shape and generic type variables with defaults similar to numpy
823
827
GenericT = TypeVar ("GenericT" , bound = np .generic , default = Any )
@@ -1055,4 +1059,14 @@ DictConvertible: TypeAlias = FulldatetimeDict | DataFrame
1055
1059
# where it is the only acceptable type.
1056
1060
Incomplete : TypeAlias = Any
1057
1061
1062
+ # differentiating between bool and int/float/complex
1063
+ # https://github.com/pandas-dev/pandas-stubs/pull/1312#pullrequestreview-3126128971
1064
+ class Just (Protocol , Generic [T ]):
1065
+ @property # type: ignore[override]
1066
+ @override
1067
+ def __class__ (self , / ) -> type [T ]: ...
1068
+ @__class__ .setter
1069
+ @override
1070
+ def __class__ (self , t : type [T ], / ) -> None : ...
1071
+
1058
1072
__all__ = ["npt" , "type_t" ]
0 commit comments