@@ -774,7 +774,7 @@ XMLParsers: TypeAlias = Literal["lxml", "etree"]
774774HTMLFlavors : TypeAlias = Literal ["lxml" , "html5lib" , "bs4" ]
775775
776776# Interval closed type
777- IntervalT = TypeVar ("IntervalT" , bound = Interval )
777+ IntervalT = TypeVar ("IntervalT" , bound = Interval , default = Interval )
778778IntervalLeftRight : TypeAlias = Literal ["left" , "right" ]
779779IntervalClosedType : TypeAlias = IntervalLeftRight | Literal ["both" , "neither" ]
780780
@@ -959,7 +959,10 @@ np_1darray_dt: TypeAlias = np_1darray[np.datetime64]
959959np_1darray_td : TypeAlias = np_1darray [np .timedelta64 ]
960960np_2darray : TypeAlias = np .ndarray [tuple [int , int ], np .dtype [GenericT ]]
961961
962- NDArrayT = TypeVar ("NDArrayT" , bound = np .ndarray )
962+ if sys .version_info >= (3 , 11 ):
963+ NDArrayT = TypeVar ("NDArrayT" , bound = np .ndarray )
964+ else :
965+ NDArrayT = TypeVar ("NDArrayT" , bound = np .ndarray [Any , Any ])
963966
964967DtypeNp = TypeVar ("DtypeNp" , bound = np .dtype [np .generic ])
965968KeysArgType : TypeAlias = Any
@@ -1070,7 +1073,7 @@ if TYPE_CHECKING: # noqa: PYI002
10701073 | Scalar
10711074 | Period
10721075 | Interval [int | float | Timestamp | Timedelta ]
1073- | tuple ,
1076+ | tuple [ Any , ...] ,
10741077 )
10751078 # Use a distinct SeriesByT when using groupby with Series of known dtype.
10761079 # Essentially, an intersection between Series S1 TypeVar, and ByT TypeVar
@@ -1088,21 +1091,23 @@ if TYPE_CHECKING: # noqa: PYI002
10881091 | Period
10891092 | Interval [int | float | Timestamp | Timedelta ],
10901093 )
1091- GroupByObjectNonScalar : TypeAlias = (
1092- tuple [_HashableTa , ...]
1093- | list [_HashableTa ]
1094- | Function
1095- | list [Function ]
1096- | list [Series ]
1097- | np_ndarray
1098- | list [np_ndarray ]
1099- | Mapping [Label , Any ]
1100- | list [Mapping [Label , Any ]]
1101- | list [Index ]
1102- | Grouper
1103- | list [Grouper ]
1104- )
1105- GroupByObject : TypeAlias = Scalar | Index | GroupByObjectNonScalar | Series
1094+ GroupByObjectNonScalar : TypeAlias = (
1095+ tuple [_HashableTa , ...]
1096+ | list [_HashableTa ]
1097+ | Function
1098+ | list [Function ]
1099+ | list [Series ]
1100+ | np_ndarray
1101+ | list [np_ndarray ]
1102+ | Mapping [Label , Any ]
1103+ | list [Mapping [Label , Any ]]
1104+ | list [Index ]
1105+ | Grouper
1106+ | list [Grouper ]
1107+ )
1108+ GroupByObject : TypeAlias = (
1109+ Scalar | Index | GroupByObjectNonScalar [_HashableTa , ...] | Series
1110+ )
11061111
11071112StataDateFormat : TypeAlias = Literal [
11081113 "tc" ,
@@ -1125,9 +1130,9 @@ StataDateFormat: TypeAlias = Literal[
11251130# `DataFrame.replace` also accepts mappings of these.
11261131ReplaceValue : TypeAlias = (
11271132 Scalar
1128- | Pattern
1133+ | Pattern [ Any ]
11291134 | NAType
1130- | Sequence [Scalar | Pattern ]
1135+ | Sequence [Scalar | Pattern [ Any ] ]
11311136 | Mapping [HashableT , ScalarT ]
11321137 | Series
11331138 | None
0 commit comments