From 4fb9c61c4cdef86898b57e6f14f28794550fbd7e Mon Sep 17 00:00:00 2001 From: cmp0xff Date: Sat, 4 Oct 2025 12:56:36 +0200 Subject: [PATCH] refactor: #1168 *args: Any and **kwargs: Any --- pandas-stubs/_libs/json.pyi | 10 +++-- pandas-stubs/_libs/tslibs/parsing.pyi | 4 +- pandas-stubs/_testing/__init__.pyi | 5 ++- pandas-stubs/core/arrays/base.pyi | 6 +-- pandas-stubs/core/arrays/boolean.pyi | 8 ++-- pandas-stubs/core/arrays/categorical.pyi | 4 +- pandas-stubs/core/arrays/datetimelike.pyi | 11 ++--- pandas-stubs/core/arrays/integer.pyi | 4 +- pandas-stubs/core/arrays/interval.pyi | 3 +- pandas-stubs/core/arrays/numpy_.pyi | 4 +- pandas-stubs/core/arrays/sparse/array.pyi | 12 +++--- pandas-stubs/core/base.pyi | 2 +- pandas-stubs/core/computation/expr.pyi | 41 +++++++++--------- pandas-stubs/core/computation/ops.pyi | 14 +++--- pandas-stubs/core/computation/pytables.pyi | 12 +++--- pandas-stubs/core/generic.pyi | 2 +- pandas-stubs/core/groupby/generic.pyi | 50 +++++++++++----------- pandas-stubs/core/groupby/groupby.pyi | 14 +++--- pandas-stubs/core/indexers.pyi | 6 ++- pandas-stubs/core/indexes/base.pyi | 16 +++---- pandas-stubs/core/indexes/datetimelike.pyi | 26 +++++++++-- pandas-stubs/core/indexes/range.pyi | 11 ++--- pandas-stubs/core/resample.pyi | 25 +++++++---- pandas-stubs/core/series.pyi | 30 ++++++------- pandas-stubs/core/window/ewm.pyi | 12 ++++-- pandas-stubs/core/window/rolling.pyi | 2 +- pandas-stubs/io/formats/style.pyi | 2 +- pandas-stubs/io/pytables.pyi | 2 +- pandas-stubs/plotting/_core.pyi | 46 ++++++++++---------- pandas-stubs/plotting/_misc.pyi | 12 +++--- tests/extension/decimal/array.py | 5 ++- tests/series/test_series.py | 2 +- 32 files changed, 228 insertions(+), 175 deletions(-) diff --git a/pandas-stubs/_libs/json.pyi b/pandas-stubs/_libs/json.pyi index 59086a440..b9ffadf42 100644 --- a/pandas-stubs/_libs/json.pyi +++ b/pandas-stubs/_libs/json.pyi @@ -1,4 +1,6 @@ -def decode(*args, **kwargs): ... -def dumps(*args, **kwargs): ... -def encode(*args, **kwargs): ... -def loads(*args, **kwargs): ... +from typing import Any + +def decode(*args: Any, **kwargs: Any): ... +def dumps(*args: Any, **kwargs: Any): ... +def encode(*args: Any, **kwargs: Any): ... +def loads(*args: Any, **kwargs: Any): ... diff --git a/pandas-stubs/_libs/tslibs/parsing.pyi b/pandas-stubs/_libs/tslibs/parsing.pyi index 70ff4ff74..42657ead7 100644 --- a/pandas-stubs/_libs/tslibs/parsing.pyi +++ b/pandas-stubs/_libs/tslibs/parsing.pyi @@ -1,2 +1,4 @@ +from typing import Any + class DateParseError(ValueError): - def __init__(self, *args, **kwargs) -> None: ... + def __init__(self, *args: Any, **kwargs: Any) -> None: ... diff --git a/pandas-stubs/_testing/__init__.pyi b/pandas-stubs/_testing/__init__.pyi index 9ad256f4b..e07f6089a 100644 --- a/pandas-stubs/_testing/__init__.pyi +++ b/pandas-stubs/_testing/__init__.pyi @@ -5,6 +5,7 @@ from collections.abc import ( ) from contextlib import contextmanager from typing import ( + Any, Literal, overload, ) @@ -38,7 +39,7 @@ def assert_almost_equal( check_dtype: bool | Literal["equiv"] = "equiv", rtol: float = 1e-5, atol: float = 1e-8, - **kwargs, + **kwargs: Any, ) -> None: ... def assert_dict_equal(left: dict, right: dict, compare_keys: bool = True) -> None: ... def assert_index_equal( @@ -172,7 +173,7 @@ def assert_frame_equal( atol: float = 1e-8, obj: str = "DataFrame", ) -> None: ... -def assert_equal(left, right, **kwargs) -> None: ... +def assert_equal(left, right, **kwargs: Any) -> None: ... def assert_sp_array_equal(left: SparseArray, right: SparseArray) -> None: ... def assert_contains_all(iterable: Iterable[T], dic: Container[T]) -> None: ... def assert_copy(iter1: Iterable[T], iter2: Iterable[T], **eql_kwargs) -> None: ... diff --git a/pandas-stubs/core/arrays/base.pyi b/pandas-stubs/core/arrays/base.pyi index 1172b87ed..d09ee0f4a 100644 --- a/pandas-stubs/core/arrays/base.pyi +++ b/pandas-stubs/core/arrays/base.pyi @@ -46,7 +46,7 @@ class ExtensionArray: def astype(self, dtype, copy: bool = True): ... def isna(self) -> ArrayLike: ... def argsort( - self, *, ascending: bool = ..., kind: str = ..., **kwargs + self, *, ascending: bool = ..., kind: str = ..., **kwargs: Any ) -> np_1darray: ... def fillna(self, value=..., method=None, limit=None): ... def dropna(self): ... @@ -67,14 +67,14 @@ class ExtensionArray: def ravel(self, order="C") -> Self: ... def tolist(self) -> list: ... def _reduce( - self, name: str, *, skipna: bool = ..., keepdims: bool = ..., **kwargs + self, name: str, *, skipna: bool = ..., keepdims: bool = ..., **kwargs: Any ) -> object: ... def _accumulate( self, name: Literal["cummin", "cummax", "cumsum", "cumprod"], *, skipna: bool = True, - **kwargs, + **kwargs: Any, ) -> Self: ... class ExtensionOpsMixin: diff --git a/pandas-stubs/core/arrays/boolean.pyi b/pandas-stubs/core/arrays/boolean.pyi index 4eaf5b33d..e116d032d 100644 --- a/pandas-stubs/core/arrays/boolean.pyi +++ b/pandas-stubs/core/arrays/boolean.pyi @@ -1,3 +1,5 @@ +from typing import Any + import numpy as np from pandas.core.arrays.masked import BaseMaskedArray as BaseMaskedArray @@ -18,8 +20,8 @@ class BooleanArray(BaseMaskedArray): ) -> None: ... @property def dtype(self): ... - def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ... def __setitem__(self, key, value) -> None: ... def astype(self, dtype, copy: bool = True): ... - def any(self, *, skipna: bool = ..., **kwargs): ... - def all(self, *, skipna: bool = ..., **kwargs): ... + def any(self, *, skipna: bool = ..., **kwargs: Any): ... + def all(self, *, skipna: bool = ..., **kwargs: Any): ... diff --git a/pandas-stubs/core/arrays/categorical.pyi b/pandas-stubs/core/arrays/categorical.pyi index 5a791b89c..0992f1a56 100644 --- a/pandas-stubs/core/arrays/categorical.pyi +++ b/pandas-stubs/core/arrays/categorical.pyi @@ -90,7 +90,7 @@ class Categorical(ExtensionArray): def shape(self): ... def shift(self, periods=1, fill_value=...): ... def __array__(self, dtype=...) -> np_1darray: ... - def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ... @property def T(self): ... @property @@ -103,7 +103,7 @@ class Categorical(ExtensionArray): def dropna(self): ... def value_counts(self, dropna: bool = True): ... def check_for_ordered(self, op) -> None: ... - def argsort(self, *, ascending: bool = ..., kind: str = ..., **kwargs): ... + def argsort(self, *, ascending: bool = ..., kind: str = ..., **kwargs: Any): ... def sort_values( self, *, inplace: bool = ..., ascending: bool = ..., na_position: str = ... ): ... diff --git a/pandas-stubs/core/arrays/datetimelike.pyi b/pandas-stubs/core/arrays/datetimelike.pyi index ec404037e..59841aa0f 100644 --- a/pandas-stubs/core/arrays/datetimelike.pyi +++ b/pandas-stubs/core/arrays/datetimelike.pyi @@ -1,5 +1,6 @@ from collections.abc import Sequence from typing import ( + Any, TypeAlias, overload, ) @@ -58,8 +59,8 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def ndim(self) -> int: ... @property def shape(self): ... - def reshape(self, *args, **kwargs): ... - def ravel(self, *args, **kwargs): ... # pyrefly: ignore + def reshape(self, *args: Any, **kwargs: Any): ... + def ravel(self, *args: Any, **kwargs: Any): ... # pyrefly: ignore def __iter__(self): ... @property def asi8(self) -> np.ndarray: ... @@ -84,7 +85,7 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def unique(self): ... def copy(self): ... def shift(self, periods: int = 1, fill_value=..., axis: int = ...): ... - def repeat(self, repeats, *args, **kwargs): ... # pyrefly: ignore + def repeat(self, repeats, *args: Any, **kwargs: Any): ... # pyrefly: ignore def value_counts(self, dropna: bool = True): ... def map(self, mapper): ... def isna(self): ... @@ -108,6 +109,6 @@ class DatetimeLikeArrayMixin(ExtensionOpsMixin, ExtensionArray): def __rsub__(self, other): ... def __iadd__(self, other): ... def __isub__(self, other): ... - def min(self, *, axis=..., skipna: bool = ..., **kwargs): ... - def max(self, *, axis=..., skipna: bool = ..., **kwargs): ... + def min(self, *, axis=..., skipna: bool = ..., **kwargs: Any): ... + def max(self, *, axis=..., skipna: bool = ..., **kwargs: Any): ... def mean(self, *, skipna: bool = ...): ... diff --git a/pandas-stubs/core/arrays/integer.pyi b/pandas-stubs/core/arrays/integer.pyi index 3290daa30..a83268c83 100644 --- a/pandas-stubs/core/arrays/integer.pyi +++ b/pandas-stubs/core/arrays/integer.pyi @@ -1,3 +1,5 @@ +from typing import Any + from pandas.core.arrays.masked import BaseMaskedArray from pandas._libs.missing import NAType @@ -17,7 +19,7 @@ class IntegerArray(BaseMaskedArray): @property def dtype(self) -> _IntegerDtype: ... def __init__(self, values, mask, copy: bool = ...) -> None: ... - def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ... def __setitem__(self, key, value) -> None: ... def astype(self, dtype, copy: bool = True): ... diff --git a/pandas-stubs/core/arrays/interval.pyi b/pandas-stubs/core/arrays/interval.pyi index a40e229f0..ad97dd547 100644 --- a/pandas-stubs/core/arrays/interval.pyi +++ b/pandas-stubs/core/arrays/interval.pyi @@ -1,4 +1,5 @@ from typing import ( + Any, TypeAlias, overload, ) @@ -83,7 +84,7 @@ class IntervalArray(IntervalMixin, ExtensionArray): allow_fill: bool = ..., fill_value=..., axis=..., - **kwargs, + **kwargs: Any, ) -> Self: ... def value_counts(self, dropna: bool = True): ... @property diff --git a/pandas-stubs/core/arrays/numpy_.pyi b/pandas-stubs/core/arrays/numpy_.pyi index af65d3fac..eab689c0b 100644 --- a/pandas-stubs/core/arrays/numpy_.pyi +++ b/pandas-stubs/core/arrays/numpy_.pyi @@ -1,3 +1,5 @@ +from typing import Any + import numpy as np from numpy.lib.mixins import NDArrayOperatorsMixin from pandas.core.arrays.base import ( @@ -14,4 +16,4 @@ class PandasDtype(ExtensionDtype): def itemsize(self) -> int: ... class PandasArray(ExtensionArray, ExtensionOpsMixin, NDArrayOperatorsMixin): - def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ... diff --git a/pandas-stubs/core/arrays/sparse/array.pyi b/pandas-stubs/core/arrays/sparse/array.pyi index 36adde9b1..433a56dfd 100644 --- a/pandas-stubs/core/arrays/sparse/array.pyi +++ b/pandas-stubs/core/arrays/sparse/array.pyi @@ -71,12 +71,12 @@ class SparseArray(ExtensionArray, ExtensionOpsMixin): def map(self, mapper): ... def to_dense(self): ... def nonzero(self): ... - def all(self, axis=..., *args, **kwargs): ... - def any(self, axis: int = ..., *args, **kwargs): ... - def sum(self, axis: int = 0, *args, **kwargs): ... - def cumsum(self, axis: int = ..., *args, **kwargs): ... - def mean(self, axis: int = ..., *args, **kwargs): ... + def all(self, axis=..., *args: Any, **kwargs: Any): ... + def any(self, axis: int = ..., *args: Any, **kwargs: Any): ... + def sum(self, axis: int = 0, *args: Any, **kwargs: Any): ... + def cumsum(self, axis: int = ..., *args: Any, **kwargs: Any): ... + def mean(self, axis: int = ..., *args: Any, **kwargs: Any): ... @property def T(self): ... - def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ... + def __array_ufunc__(self, ufunc, method, *inputs, **kwargs: Any): ... def __abs__(self): ... diff --git a/pandas-stubs/core/base.pyi b/pandas-stubs/core/base.pyi index 4b6e2e05d..a81a07be1 100644 --- a/pandas-stubs/core/base.pyi +++ b/pandas-stubs/core/base.pyi @@ -55,7 +55,7 @@ class SelectionMixin(Generic[NDFrameT]): @cache_readonly def ndim(self) -> int: ... def __getitem__(self, key): ... - def aggregate(self, func, *args, **kwargs): ... + def aggregate(self, func, *args: Any, **kwargs: Any): ... class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]): __array_priority__: int = ... diff --git a/pandas-stubs/core/computation/expr.pyi b/pandas-stubs/core/computation/expr.pyi index 43b925407..8f2d59e3a 100644 --- a/pandas-stubs/core/computation/expr.pyi +++ b/pandas-stubs/core/computation/expr.pyi @@ -1,4 +1,5 @@ import ast +from typing import Any from pandas.core.computation.ops import Term as Term from pandas.core.computation.scope import Scope as Scope @@ -19,27 +20,27 @@ class BaseExprVisitor(ast.NodeVisitor): preparser = ... assigner = ... def __init__(self, env, engine, parser, preparser=...) -> None: ... - def visit(self, node, **kwargs): ... - def visit_Module(self, node, **kwargs): ... - def visit_Expr(self, node, **kwargs): ... - def visit_BinOp(self, node, **kwargs): ... - def visit_Div(self, node, **kwargs): ... - def visit_UnaryOp(self, node, **kwargs): ... - def visit_Name(self, node, **kwargs): ... - def visit_NameConstant(self, node, **kwargs): ... - def visit_Num(self, node, **kwargs): ... - def visit_Constant(self, node, **kwargs): ... - def visit_Str(self, node, **kwargs): ... - def visit_List(self, node, **kwargs): ... - def visit_Index(self, node, **kwargs): ... - def visit_Subscript(self, node, **kwargs): ... - def visit_Slice(self, node, **kwargs): ... - def visit_Assign(self, node, **kwargs): ... - def visit_Attribute(self, node, **kwargs): ... - def visit_Call(self, node, side=..., **kwargs): ... + def visit(self, node, **kwargs: Any): ... + def visit_Module(self, node, **kwargs: Any): ... + def visit_Expr(self, node, **kwargs: Any): ... + def visit_BinOp(self, node, **kwargs: Any): ... + def visit_Div(self, node, **kwargs: Any): ... + def visit_UnaryOp(self, node, **kwargs: Any): ... + def visit_Name(self, node, **kwargs: Any): ... + def visit_NameConstant(self, node, **kwargs: Any): ... + def visit_Num(self, node, **kwargs: Any): ... + def visit_Constant(self, node, **kwargs: Any): ... + def visit_Str(self, node, **kwargs: Any): ... + def visit_List(self, node, **kwargs: Any): ... + def visit_Index(self, node, **kwargs: Any): ... + def visit_Subscript(self, node, **kwargs: Any): ... + def visit_Slice(self, node, **kwargs: Any): ... + def visit_Assign(self, node, **kwargs: Any): ... + def visit_Attribute(self, node, **kwargs: Any): ... + def visit_Call(self, node, side=..., **kwargs: Any): ... def translate_In(self, op): ... - def visit_Compare(self, node, **kwargs): ... - def visit_BoolOp(self, node, **kwargs): ... + def visit_Compare(self, node, **kwargs: Any): ... + def visit_BoolOp(self, node, **kwargs: Any): ... class Expr: env: Scope diff --git a/pandas-stubs/core/computation/ops.pyi b/pandas-stubs/core/computation/ops.pyi index cd3622a69..69be2f864 100644 --- a/pandas-stubs/core/computation/ops.pyi +++ b/pandas-stubs/core/computation/ops.pyi @@ -1,3 +1,5 @@ +from typing import Any + import numpy as np class UndefinedVariableError(NameError): @@ -12,8 +14,8 @@ class Term: def __init__(self, name, env, side=..., encoding=...) -> None: ... @property def local_name(self) -> str: ... - def __call__(self, *args, **kwargs): ... - def evaluate(self, *args, **kwargs): ... + def __call__(self, *args: Any, **kwargs: Any): ... + def evaluate(self, *args: Any, **kwargs: Any): ... def update(self, value) -> None: ... @property def is_scalar(self) -> bool: ... @@ -41,7 +43,7 @@ class Op: op: str operands = ... encoding = ... - def __init__(self, op: str, operands, *args, **kwargs) -> None: ... + def __init__(self, op: str, operands, *args: Any, **kwargs: Any) -> None: ... def __iter__(self): ... @property def return_type(self): ... @@ -58,7 +60,7 @@ class BinOp(Op): lhs = ... rhs = ... func = ... - def __init__(self, op: str, lhs, rhs, **kwargs) -> None: ... + def __init__(self, op: str, lhs, rhs, **kwargs: Any) -> None: ... def __call__(self, env): ... def evaluate(self, env, engine: str, parser, term_type, eval_in_python): ... def convert_values(self): ... @@ -66,7 +68,7 @@ class BinOp(Op): def isnumeric(dtype) -> bool: ... class Div(BinOp): - def __init__(self, lhs, rhs, **kwargs) -> None: ... + def __init__(self, lhs, rhs, **kwargs: Any) -> None: ... class UnaryOp(Op): operand = ... @@ -85,4 +87,4 @@ class FuncNode: name = ... func = ... def __init__(self, name: str) -> None: ... - def __call__(self, *args): ... + def __call__(self, *args: Any): ... diff --git a/pandas-stubs/core/computation/pytables.pyi b/pandas-stubs/core/computation/pytables.pyi index b7b10a675..7e5fc59a0 100644 --- a/pandas-stubs/core/computation/pytables.pyi +++ b/pandas-stubs/core/computation/pytables.pyi @@ -77,12 +77,12 @@ class UnaryOp(ops.UnaryOp): class PyTablesExprVisitor(BaseExprVisitor): const_type = ... term_type = ... - def __init__(self, env, engine, parser, **kwargs) -> None: ... - def visit_UnaryOp(self, node, **kwargs): ... - def visit_Index(self, node, **kwargs): ... - def visit_Assign(self, node, **kwargs): ... - def visit_Subscript(self, node, **kwargs): ... - def visit_Attribute(self, node, **kwargs): ... + def __init__(self, env, engine, parser, **kwargs: Any) -> None: ... + def visit_UnaryOp(self, node, **kwargs: Any): ... + def visit_Index(self, node, **kwargs: Any): ... + def visit_Assign(self, node, **kwargs: Any): ... + def visit_Subscript(self, node, **kwargs: Any): ... + def visit_Attribute(self, node, **kwargs: Any): ... def translate_In(self, op): ... class PyTablesExpr(expr.Expr): diff --git a/pandas-stubs/core/generic.pyi b/pandas-stubs/core/generic.pyi index 5ce8ac40d..03053a9d3 100644 --- a/pandas-stubs/core/generic.pyi +++ b/pandas-stubs/core/generic.pyi @@ -438,7 +438,7 @@ class NDFrame(indexing.IndexingMixin): **kwargs: Any, ) -> T: ... @final - def __finalize__(self, other, method=..., **kwargs) -> Self: ... + def __finalize__(self, other, method=..., **kwargs: Any) -> Self: ... @final def __setattr__(self, name: _str, value) -> None: ... @final diff --git a/pandas-stubs/core/groupby/generic.pyi b/pandas-stubs/core/groupby/generic.pyi index 2a07f47b8..2fba6ce66 100644 --- a/pandas-stubs/core/groupby/generic.pyi +++ b/pandas-stubs/core/groupby/generic.pyi @@ -61,39 +61,39 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): self, func: Callable[Concatenate[Series[S2], P], S3], /, - *args, + *args: Any, engine: WindowingEngine = ..., engine_kwargs: WindowingEngineKwargs = ..., - **kwargs, + **kwargs: Any, ) -> Series[S3]: ... @overload def aggregate( self, func: Callable[[Series], S3], - *args, + *args: Any, engine: WindowingEngine = ..., engine_kwargs: WindowingEngineKwargs = ..., - **kwargs, + **kwargs: Any, ) -> Series[S3]: ... @overload def aggregate( self, func: list[AggFuncTypeBase], /, - *args, + *args: Any, engine: WindowingEngine = ..., engine_kwargs: WindowingEngineKwargs = ..., - **kwargs, + **kwargs: Any, ) -> DataFrame: ... @overload def aggregate( self, func: AggFuncTypeBase | None = ..., /, - *args, + *args: Any, engine: WindowingEngine = ..., engine_kwargs: WindowingEngineKwargs = ..., - **kwargs, + **kwargs: Any, ) -> Series: ... agg = aggregate @overload @@ -115,10 +115,10 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): ) -> Series: ... @overload def transform( - self, func: TransformReductionListType, *args, **kwargs + self, func: TransformReductionListType, *args: Any, **kwargs: Any ) -> Series: ... def filter( - self, func: Callable | str, dropna: bool = ..., *args, **kwargs + self, func: Callable | str, dropna: bool = ..., *args: Any, **kwargs: Any ) -> Series: ... def nunique(self, dropna: bool = ...) -> Series[int]: ... # describe delegates to super() method but here it has keyword-only parameters @@ -150,13 +150,13 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): def take( self, indices: TakeIndexer, - **kwargs, + **kwargs: Any, ) -> Series[S2]: ... def skew( self, skipna: bool = True, numeric_only: bool = False, - **kwargs, + **kwargs: Any, ) -> Series: ... @property def plot(self) -> GroupByPlot[Self]: ... @@ -197,7 +197,7 @@ class SeriesGroupBy(GroupBy[Series[S2]], Generic[S2, ByT]): bins: int | Sequence[int] = 10, backend: str | None = None, legend: bool = False, - **kwargs, + **kwargs: Any, ) -> Series: ... # Series[Axes] but this is not allowed @property def dtype(self) -> Series: ... @@ -257,17 +257,17 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): def aggregate( self, func: AggFuncTypeFrame | None = ..., - *args, + *args: Any, engine: WindowingEngine = ..., engine_kwargs: WindowingEngineKwargs = ..., - **kwargs, + **kwargs: Any, ) -> DataFrame: ... @overload def aggregate( self, func: AggFuncTypeFrame | None = None, /, - **kwargs, + **kwargs: Any, ) -> DataFrame: ... agg = aggregate @overload @@ -288,10 +288,10 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): ) -> DataFrame: ... @overload def transform( - self, func: TransformReductionListType, *args, **kwargs + self, func: TransformReductionListType, *args: Any, **kwargs: Any ) -> DataFrame: ... def filter( - self, func: Callable, dropna: bool = ..., *args, **kwargs + self, func: Callable, dropna: bool = ..., *args: Any, **kwargs: Any ) -> DataFrame: ... @overload def __getitem__(self, key: Scalar) -> SeriesGroupBy[Any, ByT]: ... # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] @@ -324,7 +324,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): sharex: bool = ..., sharey: bool = ..., backend: str | None = ..., - **kwargs, + **kwargs: Any, ) -> Series: ... # Series[PlotAxes] but this is not allowed @overload def boxplot( @@ -340,7 +340,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): sharex: bool = ..., sharey: bool = ..., backend: str | None = ..., - **kwargs, + **kwargs: Any, ) -> PlotAxes: ... @overload def boxplot( @@ -356,7 +356,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): sharex: bool = ..., sharey: bool = ..., backend: str | None = ..., - **kwargs, + **kwargs: Any, ) -> PlotAxes | Series: ... # Series[PlotAxes] @overload def value_counts( @@ -394,7 +394,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): ascending: bool = ..., dropna: bool = ..., ) -> DataFrame: ... - def take(self, indices: TakeIndexer, **kwargs) -> DataFrame: ... + def take(self, indices: TakeIndexer, **kwargs: Any) -> DataFrame: ... @overload def skew( self, @@ -402,7 +402,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): numeric_only: bool = ..., *, level: Level, - **kwargs, + **kwargs: Any, ) -> DataFrame: ... @overload def skew( @@ -411,7 +411,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): numeric_only: bool = ..., *, level: None = ..., - **kwargs, + **kwargs: Any, ) -> Series: ... @property def plot(self) -> GroupByPlot[Self]: ... @@ -444,7 +444,7 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]): bins: int | Sequence[int] = 10, backend: str | None = None, legend: bool = False, - **kwargs, + **kwargs: Any, ) -> Series: ... # Series[Axes] but this is not allowed @property def dtypes(self) -> Series: ... diff --git a/pandas-stubs/core/groupby/groupby.pyi b/pandas-stubs/core/groupby/groupby.pyi index 4e26e0ecd..dc49248de 100644 --- a/pandas-stubs/core/groupby/groupby.pyi +++ b/pandas-stubs/core/groupby/groupby.pyi @@ -79,7 +79,7 @@ _ResamplerGroupBy: TypeAlias = ( class GroupBy(BaseGroupBy[NDFrameT]): def __getattr__(self, attr: str) -> Any: ... - def apply(self, func: Callable | str, *args, **kwargs) -> NDFrameT: ... + def apply(self, func: Callable | str, *args: Any, **kwargs: Any) -> NDFrameT: ... @final @overload def any(self: GroupBy[Series], skipna: bool = ...) -> Series[bool]: ... @@ -207,7 +207,7 @@ class GroupBy(BaseGroupBy[NDFrameT]): origin: TimeGrouperOrigin | TimestampConvertibleTypes = ..., offset: TimedeltaConvertibleTypes | None = ..., group_keys: bool = ..., - **kwargs, + **kwargs: Any, ) -> _ResamplerGroupBy[NDFrameT]: ... @final def rolling( @@ -278,25 +278,25 @@ class GroupBy(BaseGroupBy[NDFrameT]): ) -> NDFrameT: ... @final def cumprod( - self, axis: Axis | _NoDefaultDoNotUse = ..., *args, **kwargs + self, axis: Axis | _NoDefaultDoNotUse = ..., *args: Any, **kwargs: Any ) -> NDFrameT: ... @final def cumsum( - self, axis: Axis | _NoDefaultDoNotUse = ..., *args, **kwargs + self, axis: Axis | _NoDefaultDoNotUse = ..., *args: Any, **kwargs: Any ) -> NDFrameT: ... @final def cummin( self, axis: AxisInt | _NoDefaultDoNotUse = ..., numeric_only: bool = ..., - **kwargs, + **kwargs: Any, ) -> NDFrameT: ... @final def cummax( self, axis: AxisInt | _NoDefaultDoNotUse = ..., numeric_only: bool = ..., - **kwargs, + **kwargs: Any, ) -> NDFrameT: ... @final def shift( @@ -343,7 +343,7 @@ _GroupByT = TypeVar("_GroupByT", bound=GroupBy) class GroupByPlot(PlotAccessor, Generic[_GroupByT]): def __init__(self, groupby: _GroupByT) -> None: ... # The following methods are inherited from the fake parent class PlotAccessor - # def __call__(self, *args, **kwargs): ... + # def __call__(self, *args: Any, **kwargs: Any): ... # def __getattr__(self, name: str): ... class BaseGroupBy(SelectionMixin[NDFrameT], GroupByIndexingMixin): diff --git a/pandas-stubs/core/indexers.pyi b/pandas-stubs/core/indexers.pyi index 4a0d3c7e1..c6bcc6d84 100644 --- a/pandas-stubs/core/indexers.pyi +++ b/pandas-stubs/core/indexers.pyi @@ -1,3 +1,5 @@ +from typing import Any + import numpy as np def check_array_indexer(arrayArrayLike, indexer): ... @@ -7,7 +9,7 @@ class BaseIndexer: self, index_array: np.ndarray | None = ..., window_size: int = ..., - **kwargs, + **kwargs: Any, ) -> None: ... def get_window_bounds( self, @@ -24,7 +26,7 @@ class VariableOffsetWindowIndexer(BaseIndexer): window_size: int = ..., index=..., offset=..., - **kwargs, + **kwargs: Any, ) -> None: ... def get_window_bounds( self, diff --git a/pandas-stubs/core/indexes/base.pyi b/pandas-stubs/core/indexes/base.pyi index a66b96513..7b23d6edc 100644 --- a/pandas-stubs/core/indexes/base.pyi +++ b/pandas-stubs/core/indexes/base.pyi @@ -323,12 +323,12 @@ class Index(IndexOpsMixin[S1]): axis: int = 0, allow_fill: bool = True, fill_value: Scalar | None = None, - **kwargs, + **kwargs: Any, ): ... def repeat(self, repeats, axis=...): ... def copy(self, name: Hashable = ..., deep: bool = False) -> Self: ... @final - def __copy__(self, **kwargs): ... + def __copy__(self, **kwargs: Any): ... @final def __deepcopy__(self, memo=...): ... def format( @@ -460,11 +460,11 @@ class Index(IndexOpsMixin[S1]): key: Callable[[Index], Index] | None = None, ): ... @final - def sort(self, *args, **kwargs) -> None: ... - def argsort(self, *args, **kwargs): ... + def sort(self, *args: Any, **kwargs: Any) -> None: ... + def argsort(self, *args: Any, **kwargs: Any): ... def get_indexer_non_unique(self, target): ... @final - def get_indexer_for(self, target, **kwargs): ... + def get_indexer_for(self, target, **kwargs: Any): ... @final def groupby(self, values) -> dict[Hashable, np.ndarray]: ... def map(self, mapper, na_action=...) -> Index: ... @@ -772,7 +772,7 @@ class _IndexSubclassBase(Index[S1], Generic[S1, GenericT_co]): dtype: None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[GenericT_co]: ... @overload def to_numpy( @@ -780,7 +780,7 @@ class _IndexSubclassBase(Index[S1], Generic[S1, GenericT_co]): dtype: np.dtype[GenericT] | SupportsDType[GenericT] | type[GenericT], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[GenericT]: ... @overload def to_numpy( @@ -788,5 +788,5 @@ class _IndexSubclassBase(Index[S1], Generic[S1, GenericT_co]): dtype: DTypeLike, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray: ... diff --git a/pandas-stubs/core/indexes/datetimelike.pyi b/pandas-stubs/core/indexes/datetimelike.pyi index bf5556595..a6c4b6489 100644 --- a/pandas-stubs/core/indexes/datetimelike.pyi +++ b/pandas-stubs/core/indexes/datetimelike.pyi @@ -1,3 +1,5 @@ +from typing import Any + import numpy as np from pandas.core.indexes.extension import ExtensionIndex from pandas.core.indexes.timedeltas import TimedeltaIndex @@ -19,16 +21,32 @@ class DatetimeIndexOpsMixin(ExtensionIndex[S1, GenericT_co]): @property def is_all_dates(self) -> bool: ... def min( - self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs + self, + axis: AxisIndex | None = None, + skipna: bool = True, + *args: Any, + **kwargs: Any, ) -> S1: ... def argmin( - self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs + self, + axis: AxisIndex | None = None, + skipna: bool = True, + *args: Any, + **kwargs: Any, ) -> np.int64: ... def max( - self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs + self, + axis: AxisIndex | None = None, + skipna: bool = True, + *args: Any, + **kwargs: Any, ) -> S1: ... def argmax( - self, axis: AxisIndex | None = None, skipna: bool = True, *args, **kwargs + self, + axis: AxisIndex | None = None, + skipna: bool = True, + *args: Any, + **kwargs: Any, ) -> np.int64: ... def __rsub__( # type: ignore[misc,override] # pyright: ignore[reportIncompatibleMethodOverride] self, other: DatetimeIndexOpsMixin diff --git a/pandas-stubs/core/indexes/range.pyi b/pandas-stubs/core/indexes/range.pyi index 1494b668c..e2fe1c8c0 100644 --- a/pandas-stubs/core/indexes/range.pyi +++ b/pandas-stubs/core/indexes/range.pyi @@ -3,6 +3,7 @@ from collections.abc import ( Sequence, ) from typing import ( + Any, final, overload, ) @@ -56,9 +57,9 @@ class RangeIndex(_IndexSubclassBase[int, np.int64]): @final def get_indexer(self, target, method=..., limit=..., tolerance=...): ... def tolist(self): ... - def min(self, axis=..., skipna: bool = ..., *args, **kwargs): ... - def max(self, axis=..., skipna: bool = ..., *args, **kwargs): ... - def argsort(self, *args, **kwargs): ... + def min(self, axis=..., skipna: bool = ..., *args: Any, **kwargs: Any): ... + def max(self, axis=..., skipna: bool = ..., *args: Any, **kwargs: Any): ... + def argsort(self, *args: Any, **kwargs: Any): ... def factorize( self, sort: bool = False, use_na_sentinel: bool = True ) -> tuple[np_1darray[np.intp], RangeIndex]: ... @@ -77,8 +78,8 @@ class RangeIndex(_IndexSubclassBase[int, np.int64]): @property def size(self) -> int: ... def __floordiv__(self, other): ... - def all(self, *args, **kwargs) -> bool: ... - def any(self, *args, **kwargs) -> bool: ... + def all(self, *args: Any, **kwargs: Any) -> bool: ... + def any(self, *args: Any, **kwargs: Any) -> bool: ... @final def union( # pyrefly: ignore self, other: list[HashableT] | Index, sort: bool | None = None diff --git a/pandas-stubs/core/resample.pyi b/pandas-stubs/core/resample.pyi index 26ff08341..850db0032 100644 --- a/pandas-stubs/core/resample.pyi +++ b/pandas-stubs/core/resample.pyi @@ -4,6 +4,7 @@ from collections.abc import ( Mapping, ) from typing import ( + Any, Literal, TypeAlias, final, @@ -61,25 +62,31 @@ class Resampler(BaseGroupBy[NDFrameT]): def aggregate( self: Resampler[DataFrame], func: _FrameGroupByFuncArgs | None = ..., - *args, - **kwargs, + *args: Any, + **kwargs: Any, ) -> DataFrame: ... @overload def aggregate( self: Resampler[Series], func: _SeriesGroupByFuncArgs | None = ..., - *args, - **kwargs, + *args: Any, + **kwargs: Any, ) -> Series | DataFrame: ... agg = aggregate apply = aggregate @overload def transform( - self: Resampler[Series], arg: Callable[[Series], Series[S1]], *args, **kwargs + self: Resampler[Series], + arg: Callable[[Series], Series[S1]], + *args: Any, + **kwargs: Any, ) -> Series[S1]: ... @overload def transform( - self: Resampler[DataFrame], arg: Callable[[Series], Series[S1]], *args, **kwargs + self: Resampler[DataFrame], + arg: Callable[[Series], Series[S1]], + *args: Any, + **kwargs: Any, ) -> DataFrame: ... @final def ffill(self, limit: int | None = ...) -> NDFrameT: ... @@ -97,7 +104,7 @@ class Resampler(BaseGroupBy[NDFrameT]): inplace: Literal[True], limit_direction: Literal["forward", "backward", "both"] = ..., limit_area: Literal["inside", "outside"] | None = ..., - **kwargs, + **kwargs: Any, ) -> None: ... @overload def interpolate( @@ -109,7 +116,7 @@ class Resampler(BaseGroupBy[NDFrameT]): inplace: Literal[False] = ..., limit_direction: Literal["forward", "backward", "both"] = ..., limit_area: Literal["inside", "outside"] | None = ..., - **kwargs, + **kwargs: Any, ) -> NDFrameT: ... @final def asfreq(self, fill_value: Scalar | None = ...) -> NDFrameT: ... @@ -161,7 +168,7 @@ class Resampler(BaseGroupBy[NDFrameT]): def quantile( self, q: float | list[float] | npt.NDArray[np.double] | Series[float] = 0.5, - **kwargs, + **kwargs: Any, ) -> NDFrameT: ... # We lie about inheriting from Resampler because at runtime inherits all Resampler diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 7140595db..be7ca541c 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -4640,7 +4640,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: DTypeLike | None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray: ... @overload def to_numpy( # pyrefly: ignore[bad-override] @@ -4648,7 +4648,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: type[np.datetime64] | None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.datetime64]: ... @overload def to_numpy( @@ -4656,7 +4656,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: np.dtype[GenericT] | SupportsDType[GenericT] | type[GenericT], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[GenericT]: ... @overload def to_numpy( # pyrefly: ignore[bad-override] @@ -4664,7 +4664,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: type[np.timedelta64] | None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.timedelta64]: ... @overload def to_numpy( @@ -4672,7 +4672,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: np.dtype[GenericT] | SupportsDType[GenericT] | type[GenericT], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[GenericT]: ... @overload def to_numpy( @@ -4680,7 +4680,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.object_]: ... @overload def to_numpy( @@ -4688,7 +4688,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: type[np.int64], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.int64]: ... @overload def to_numpy( @@ -4696,7 +4696,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.object_]: ... @overload def to_numpy( @@ -4704,7 +4704,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: type[np.bytes_], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.bytes_]: ... @overload def to_numpy( @@ -4712,7 +4712,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: type[np.object_] | None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[np.object_]: ... @overload def to_numpy( @@ -4720,7 +4720,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: type[_T_INTERVAL_NP], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[_T_INTERVAL_NP]: ... @overload def to_numpy( # pyright: ignore[reportIncompatibleMethodOverride] @@ -4728,7 +4728,7 @@ class Series(IndexOpsMixin[S1], NDFrame): dtype: DTypeLike | None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray: ... def tolist(self) -> list[S1]: ... def var( @@ -4797,7 +4797,7 @@ class _SeriesSubclassBase(Series[S1], Generic[S1, GenericT_co]): dtype: None = None, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[GenericT_co]: ... @overload def to_numpy( @@ -4805,7 +4805,7 @@ class _SeriesSubclassBase(Series[S1], Generic[S1, GenericT_co]): dtype: np.dtype[GenericT] | SupportsDType[GenericT] | type[GenericT], copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray[GenericT]: ... @overload def to_numpy( # pyright: ignore[reportIncompatibleMethodOverride] @@ -4813,5 +4813,5 @@ class _SeriesSubclassBase(Series[S1], Generic[S1, GenericT_co]): dtype: DTypeLike, copy: bool = False, na_value: Scalar = ..., - **kwargs, + **kwargs: Any, ) -> np_1darray: ... diff --git a/pandas-stubs/core/window/ewm.pyi b/pandas-stubs/core/window/ewm.pyi index d3f322b56..eb3c6ed33 100644 --- a/pandas-stubs/core/window/ewm.pyi +++ b/pandas-stubs/core/window/ewm.pyi @@ -1,3 +1,5 @@ +from typing import Any + from pandas import ( DataFrame, Series, @@ -48,8 +50,8 @@ class ExponentialMovingWindowGroupby( class OnlineExponentialMovingWindow(ExponentialMovingWindow[NDFrameT]): def reset(self) -> None: ... - def aggregate(self, func, *args, **kwargs): ... - def std(self, bias: bool = False, *args, **kwargs): ... # pyrefly: ignore + def aggregate(self, func, *args: Any, **kwargs: Any): ... + def std(self, bias: bool = False, *args: Any, **kwargs: Any): ... # pyrefly: ignore def corr( self, other: DataFrame | Series | None = None, @@ -65,5 +67,9 @@ class OnlineExponentialMovingWindow(ExponentialMovingWindow[NDFrameT]): ): ... def var(self, bias: bool = False, numeric_only: bool = False): ... def mean( # pyrefly: ignore - self, *args, update: NDFrameT | None = ..., update_times: None = ..., **kwargs + self, + *args: Any, + update: NDFrameT | None = ..., + update_times: None = ..., + **kwargs: Any, ) -> NDFrameT: ... diff --git a/pandas-stubs/core/window/rolling.pyi b/pandas-stubs/core/window/rolling.pyi index 0fe824737..8f9af36a3 100644 --- a/pandas-stubs/core/window/rolling.pyi +++ b/pandas-stubs/core/window/rolling.pyi @@ -97,7 +97,7 @@ class RollingAndExpandingMixin(BaseWindow[NDFrameT]): def max( self, numeric_only: bool = ..., - *args, + *args: Any, engine: WindowingEngine = ..., engine_kwargs: WindowingEngineKwargs = ..., ) -> NDFrameT: ... diff --git a/pandas-stubs/io/formats/style.pyi b/pandas-stubs/io/formats/style.pyi index 6da2bc13a..7609cb4a3 100644 --- a/pandas-stubs/io/formats/style.pyi +++ b/pandas-stubs/io/formats/style.pyi @@ -254,7 +254,7 @@ class Styler(StylerRenderer): func: Callable[[Scalar], str | None], axis: Axis = ..., level: Level | list[Level] | None = ..., - **kwargs, + **kwargs: Any, ) -> Styler: ... def set_table_attributes(self, attributes: str) -> Styler: ... def export(self) -> StyleExportDict: ... diff --git a/pandas-stubs/io/pytables.pyi b/pandas-stubs/io/pytables.pyi index 28f0f8575..006620f78 100644 --- a/pandas-stubs/io/pytables.pyi +++ b/pandas-stubs/io/pytables.pyi @@ -106,7 +106,7 @@ class HDFStore: complevel: int | None = ..., complib: HDFCompLib | None = ..., fletcher32: bool = ..., - **kwargs, + **kwargs: Any, ) -> None: ... def __fspath__(self) -> str: ... def __getitem__(self, key: str) -> DataFrame | Series: ... diff --git a/pandas-stubs/plotting/_core.pyi b/pandas-stubs/plotting/_core.pyi index f36c48c1c..87201cee1 100644 --- a/pandas-stubs/plotting/_core.pyi +++ b/pandas-stubs/plotting/_core.pyi @@ -51,7 +51,7 @@ def boxplot( figsize: tuple[float, float] | None = ..., layout: tuple[int, int] | None = ..., return_type: Literal["axes"] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def boxplot( @@ -66,7 +66,7 @@ def boxplot( layout: tuple[int, int] | None = ..., *, return_type: Literal["dict"], - **kwargs, + **kwargs: Any, ) -> dict[str, list[Line2D]]: ... @overload def boxplot( @@ -81,7 +81,7 @@ def boxplot( layout: tuple[int, int] | None = ..., *, return_type: Literal["both"], - **kwargs, + **kwargs: Any, ) -> _BoxPlotT: ... class PlotAccessor: @@ -246,7 +246,7 @@ class PlotAccessor: color: _PlotAccessorColor = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def line( @@ -256,7 +256,7 @@ class PlotAccessor: color: _PlotAccessorColor = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def bar( @@ -266,7 +266,7 @@ class PlotAccessor: color: _PlotAccessorColor = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def bar( @@ -276,7 +276,7 @@ class PlotAccessor: color: _PlotAccessorColor = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def barh( @@ -285,7 +285,7 @@ class PlotAccessor: y: Hashable = ..., color: _PlotAccessorColor = ..., subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def barh( @@ -295,7 +295,7 @@ class PlotAccessor: color: _PlotAccessorColor = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def box( @@ -303,7 +303,7 @@ class PlotAccessor: by: Hashable | list[HashableT] = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def box( @@ -311,7 +311,7 @@ class PlotAccessor: by: Hashable | list[HashableT] = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> Series: ... @overload def hist( @@ -320,7 +320,7 @@ class PlotAccessor: bins: int = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def hist( @@ -329,7 +329,7 @@ class PlotAccessor: bins: int = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def kde( @@ -343,7 +343,7 @@ class PlotAccessor: ind: npt.NDArray[np.double] | int | None = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def kde( @@ -357,7 +357,7 @@ class PlotAccessor: ind: npt.NDArray[np.double] | int | None = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def area( @@ -367,7 +367,7 @@ class PlotAccessor: stacked: bool = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def area( @@ -377,15 +377,15 @@ class PlotAccessor: stacked: bool = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def pie( - self, y: Hashable, *, subplots: Literal[False] | None = ..., **kwargs + self, y: Hashable, *, subplots: Literal[False] | None = ..., **kwargs: Any ) -> Axes: ... @overload def pie( - self, y: Hashable, *, subplots: Literal[True], **kwargs + self, y: Hashable, *, subplots: Literal[True], **kwargs: Any ) -> npt.NDArray[np.object_]: ... @overload def scatter( @@ -396,7 +396,7 @@ class PlotAccessor: c: Hashable | list[str] = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def scatter( @@ -407,7 +407,7 @@ class PlotAccessor: c: Hashable | list[str] = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... @overload def hexbin( @@ -419,7 +419,7 @@ class PlotAccessor: gridsize: int | tuple[int, int] | None = ..., *, subplots: Literal[False] | None = ..., - **kwargs, + **kwargs: Any, ) -> Axes: ... @overload def hexbin( @@ -431,7 +431,7 @@ class PlotAccessor: gridsize: int | tuple[int, int] | None = ..., *, subplots: Literal[True], - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... density = kde diff --git a/pandas-stubs/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi index 3a8965502..b1fdeb92a 100644 --- a/pandas-stubs/plotting/_misc.pyi +++ b/pandas-stubs/plotting/_misc.pyi @@ -26,7 +26,7 @@ _Color: TypeAlias = str | Sequence[float] def table( ax: Axes, data: DataFrame | Series, - **kwargs, + **kwargs: Any, ) -> Table: ... def register() -> None: ... def deregister() -> None: ... @@ -41,7 +41,7 @@ def scatter_matrix( density_kwds: dict[str, Any] | None = None, hist_kwds: dict[str, Any] | None = None, range_padding: float = 0.05, - **kwargs, + **kwargs: Any, ) -> npt.NDArray[np.object_]: ... def radviz( frame: DataFrame, @@ -58,7 +58,7 @@ def andrews_curves( samples: int = 200, color: _Color | Sequence[_Color] | None = None, colormap: str | Colormap | None = None, - **kwargs, + **kwargs: Any, ) -> Axes: ... def bootstrap_plot( series: Series, @@ -79,9 +79,11 @@ def parallel_coordinates( axvlines: bool = True, axvlines_kwds: dict[str, Any] | None = None, sort_labels: bool = False, - **kwargs, + **kwargs: Any, ) -> Axes: ... def lag_plot(series: Series, lag: int = 1, ax: Axes | None = None, **kwds) -> Axes: ... -def autocorrelation_plot(series: Series, ax: Axes | None = None, **kwargs) -> Axes: ... +def autocorrelation_plot( + series: Series, ax: Axes | None = None, **kwargs: Any +) -> Axes: ... plot_params: dict[str, Any] diff --git a/tests/extension/decimal/array.py b/tests/extension/decimal/array.py index 92f59c081..2f6faa0be 100644 --- a/tests/extension/decimal/array.py +++ b/tests/extension/decimal/array.py @@ -4,6 +4,7 @@ import decimal import numbers import sys +from typing import Any import numpy as np from pandas.api.extensions import ( @@ -126,7 +127,7 @@ def to_numpy( result = np.asarray([round(x, decimals) for x in result]) return result - def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs): + def __array_ufunc__(self, ufunc: np.ufunc, method: str, *inputs, **kwargs: Any): # if not all( isinstance(t, self._HANDLED_TYPES + (DecimalArray,)) for t in inputs @@ -237,7 +238,7 @@ def _formatter(self, boxed=False): def _concat_same_type(cls, to_concat): return cls(np.concatenate([x._data for x in to_concat])) - def _reduce(self, name: str, *, skipna: bool = True, **kwargs): + def _reduce(self, name: str, *, skipna: bool = True, **kwargs: Any): if skipna: # If we don't have any NAs, we can ignore skipna if self.isna().any(): diff --git a/tests/series/test_series.py b/tests/series/test_series.py index 0c1ae9efc..0f54a8a76 100644 --- a/tests/series/test_series.py +++ b/tests/series/test_series.py @@ -2128,7 +2128,7 @@ def test_pandera_generic() -> None: T = TypeVar("T") class MySeries(pd.Series, Generic[T]): - def __new__(cls, *args, **kwargs) -> Self: + def __new__(cls, *args: Any, **kwargs: Any) -> Self: return object.__new__(cls) def func() -> MySeries[float]: