diff --git a/pandas-stubs/_libs/interval.pyi b/pandas-stubs/_libs/interval.pyi index 0f3526363..40123d603 100644 --- a/pandas-stubs/_libs/interval.pyi +++ b/pandas-stubs/_libs/interval.pyi @@ -87,9 +87,9 @@ class Interval(IntervalMixin, Generic[_OrderableT]): self: Interval[_OrderableTimesT], y: Timedelta ) -> Interval[_OrderableTimesT]: ... @overload - def __add__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __add__(self: Interval[int], y: float) -> Interval[float]: ... + def __add__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __add__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload @@ -97,9 +97,9 @@ class Interval(IntervalMixin, Generic[_OrderableT]): self: Interval[_OrderableTimesT], y: Timedelta ) -> Interval[_OrderableTimesT]: ... @overload - def __radd__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __radd__(self: Interval[int], y: float) -> Interval[float]: ... + def __radd__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __radd__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload @@ -107,9 +107,9 @@ class Interval(IntervalMixin, Generic[_OrderableT]): self: Interval[_OrderableTimesT], y: Timedelta ) -> Interval[_OrderableTimesT]: ... @overload - def __sub__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __sub__(self: Interval[int], y: float) -> Interval[float]: ... + def __sub__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __sub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload @@ -117,33 +117,33 @@ class Interval(IntervalMixin, Generic[_OrderableT]): self: Interval[_OrderableTimesT], y: Timedelta ) -> Interval[_OrderableTimesT]: ... @overload - def __rsub__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __rsub__(self: Interval[int], y: float) -> Interval[float]: ... + def __rsub__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __rsub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload - def __mul__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __mul__(self: Interval[int], y: float) -> Interval[float]: ... + def __mul__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __mul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload - def __rmul__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __rmul__(self: Interval[int], y: float) -> Interval[float]: ... + def __rmul__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __rmul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload - def __truediv__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __truediv__(self: Interval[int], y: float) -> Interval[float]: ... + def __truediv__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __truediv__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ... @overload - def __floordiv__(self: Interval[int], y: int) -> Interval[int]: ... - @overload - def __floordiv__(self: Interval[int], y: float) -> Interval[float]: ... + def __floordiv__( + self: Interval[int], y: _OrderableScalarT + ) -> Interval[_OrderableScalarT]: ... @overload def __floordiv__( self: Interval[float], y: Union[int, float] diff --git a/pandas-stubs/core/algorithms.pyi b/pandas-stubs/core/algorithms.pyi index 726346edc..a2186af65 100644 --- a/pandas-stubs/core/algorithms.pyi +++ b/pandas-stubs/core/algorithms.pyi @@ -20,7 +20,7 @@ def factorize( values: Any, sort: bool = ..., na_sentinel: int = ..., - size_hint: Union[int, None] = None, + size_hint: Union[int, None] = ..., ) -> Tuple[np.ndarray, Union[np.ndarray, Index]]: ... def value_counts( values, diff --git a/pandas-stubs/core/frame.pyi b/pandas-stubs/core/frame.pyi index 3f2c7c9e8..1bac89afa 100644 --- a/pandas-stubs/core/frame.pyi +++ b/pandas-stubs/core/frame.pyi @@ -950,7 +950,7 @@ class DataFrame(NDFrame, OpsMixin): **kwargs, ) -> DataFrame: ... def applymap( - self, func: Callable, na_action: Optional[Literal["ignore"]] = None, **kwargs + self, func: Callable, na_action: Optional[Literal["ignore"]] = ..., **kwargs ) -> DataFrame: ... def append( self, @@ -993,7 +993,7 @@ class DataFrame(NDFrame, OpsMixin): method: Union[_str, Literal["pearson", "kendall", "spearman"]] = ..., min_periods: int = ..., ) -> DataFrame: ... - def cov(self, min_periods: Optional[int] = ..., ddof: int = 1) -> DataFrame: ... + def cov(self, min_periods: Optional[int] = ..., ddof: int = ...) -> DataFrame: ... def corrwith( self, other: Union[DataFrame, Series], @@ -1009,7 +1009,7 @@ class DataFrame(NDFrame, OpsMixin): def count( self, axis: AxisType = ..., level: None = ..., numeric_only: _bool = ... ) -> Series: ... - def nunique(self, axis: AxisType = ..., dropna=True) -> Series: ... + def nunique(self, axis: AxisType = ..., dropna: bool = ...) -> Series: ... def idxmax(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ... def idxmin(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ... @overload @@ -1731,7 +1731,7 @@ class DataFrame(NDFrame, OpsMixin): origin: Union[ Timestamp, Literal["epoch", "start", "start_day", "end", "end_day"] ] = ..., - offset: Optional[Union[Timedelta, _str]] = None, + offset: Optional[Union[Timedelta, _str]] = ..., ) -> Resampler: ... def rfloordiv( self, diff --git a/pandas-stubs/core/series.pyi b/pandas-stubs/core/series.pyi index 2565b0845..b4ee1ccde 100644 --- a/pandas-stubs/core/series.pyi +++ b/pandas-stubs/core/series.pyi @@ -769,7 +769,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): self, left: Union[Scalar, Sequence], right: Union[Scalar, Sequence], - inclusive: Literal["both", "neither", "left", "right"] = "both", + inclusive: Literal["both", "neither", "left", "right"] = ..., ) -> Series[_bool]: ... def isna(self) -> Series[_bool]: ... def isnull(self) -> Series[_bool]: ... @@ -997,7 +997,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]): origin: Union[ Timestamp, Literal["epoch", "start", "start_day", "end", "end_day"] ] = ..., - offset: Optional[Union[Timedelta, _str]] = None, + offset: Optional[Union[Timedelta, _str]] = ..., ) -> Resampler: ... def first(self, offset) -> Series[S1]: ... def last(self, offset) -> Series[S1]: ... diff --git a/pandas-stubs/io/json/_normalize.pyi b/pandas-stubs/io/json/_normalize.pyi index 881abb647..99f7e6fa3 100644 --- a/pandas-stubs/io/json/_normalize.pyi +++ b/pandas-stubs/io/json/_normalize.pyi @@ -20,11 +20,11 @@ def nested_to_record( ) -> Any: ... def json_normalize( data: Union[Dict, List[Dict]], - record_path: Optional[Union[str, List]] = None, - meta: Optional[Union[str, List[Union[str, List[str]]]]] = None, - meta_prefix: Optional[str] = None, - record_prefix: Optional[str] = None, - errors: str = "raise", - sep: str = ".", - max_level: Optional[int] = None, + record_path: Optional[Union[str, List]] = ..., + meta: Optional[Union[str, List[Union[str, List[str]]]]] = ..., + meta_prefix: Optional[str] = ..., + record_prefix: Optional[str] = ..., + errors: str = ..., + sep: str = ..., + max_level: Optional[int] = ..., ) -> DataFrame: ... diff --git a/pandas-stubs/plotting/_misc.pyi b/pandas-stubs/plotting/_misc.pyi index 353f10ee4..3bbaa584d 100644 --- a/pandas-stubs/plotting/_misc.pyi +++ b/pandas-stubs/plotting/_misc.pyi @@ -17,8 +17,8 @@ from pandas.core.series import Series def table( ax, data, - rowLabels=None, - colLabels=None, + rowLabels=..., + colLabels=..., ): ... def register() -> None: ... def deregister() -> None: ... diff --git a/pyproject.toml b/pyproject.toml index 6b1984874..9f9e55b24 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -193,3 +193,7 @@ typeCheckingMode = "basic" stubPath = "." include = ["tests", "pandas-stubs"] useLibraryCodeForTypes = true +# enable subset of "strict" +reportDuplicateImport = true +reportInvalidStubStatement = true +reportOverlappingOverload = true