diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a2c6119be..e5c30bc42 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: - flake8-pyi==22.8.2 types: [pyi] args: [ - --ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y026 Y027 Y034 Y037, + --ignore=E301 E302 E305 E402 E501 E701 E704 F401 F811 W503 Y019 Y026 Y027 Y034 Y037 Y041, # TypeVars in private files are already private --per-file-ignores=_*.pyi:Y001 ] diff --git a/pandas-stubs/_typing.pyi b/pandas-stubs/_typing.pyi index b044efc55..0220a8161 100644 --- a/pandas-stubs/_typing.pyi +++ b/pandas-stubs/_typing.pyi @@ -53,7 +53,7 @@ PandasScalar = Union[bytes, datetime.date, datetime.datetime, datetime.timedelta DatetimeLike = Union[datetime.date, datetime.datetime, np.datetime64, Timestamp] # dtypes -NpDtype = Union[str, np.dtype[np.generic], type[object]] +NpDtype = Union[str, np.dtype[np.generic], type[Union[str, complex, bool, object]]] Dtype = Union[ExtensionDtype, NpDtype] AstypeArg = Union[ExtensionDtype, npt.DTypeLike] # DtypeArg specifies all allowable dtypes in a functions its dtype argument @@ -135,8 +135,14 @@ Scalar = Union[ str, bytes, datetime.date, + datetime.datetime, datetime.timedelta, + bool, + int, + float, complex, + Timestamp, + Timedelta, ] ScalarT = TypeVar("ScalarT", bound=Scalar) # Refine the definitions below in 3.9 to use the specialized type. diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index f87914f35..d51792674 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -141,15 +141,15 @@ class _DataFrameGroupByNonScalar(DataFrameGroupBy): class DataFrameGroupBy(GroupBy): def any(self, skipna: bool = ...) -> DataFrame: ... def all(self, skipna: bool = ...) -> DataFrame: ... + # error: Overload 3 for "apply" will never be used because its parameters overlap overload 1 @overload - def apply( + def apply( # type: ignore[misc] self, func: Callable[[DataFrame], Scalar | list | dict], *args, **kwargs ) -> Series: ... @overload def apply( self, func: Callable[[DataFrame], Series | DataFrame], *args, **kwargs ) -> DataFrame: ... - # error: Overload 3 for "apply" will never be used because its parameters overlap overload 1 @overload def apply( # pyright: ignore[reportOverlappingOverload] self, func: Callable[[Iterable], float], *args, **kwargs