From 244c5cb708cc85cc80357d68969653c1fc079ebc Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 10:20:00 +0100 Subject: [PATCH 1/8] fmt off for overloads --- pandas/core/array_algos/take.py | 22 +-- pandas/core/arrays/datetimelike.py | 17 +-- pandas/core/arrays/datetimes.py | 14 +- pandas/core/dtypes/cast.py | 24 ++-- pandas/core/frame.py | 223 +++++------------------------ pandas/core/generic.py | 132 +++-------------- pandas/core/reshape/concat.py | 32 +---- pandas/core/series.py | 152 ++++---------------- pandas/core/tools/datetimes.py | 51 +------ pandas/io/sas/sasreader.py | 24 +--- pandas/io/sql.py | 84 ++--------- 11 files changed, 123 insertions(+), 652 deletions(-) diff --git a/pandas/core/array_algos/take.py b/pandas/core/array_algos/take.py index b97a777400134..87bc05c240fed 100644 --- a/pandas/core/array_algos/take.py +++ b/pandas/core/array_algos/take.py @@ -26,26 +26,12 @@ from pandas.core.arrays.base import ExtensionArray +# fmt: off @overload -def take_nd( - arr: np.ndarray, - indexer, - axis: int = ..., - fill_value=..., - allow_fill: bool = ..., -) -> np.ndarray: - ... - - +def take_nd( arr: np.ndarray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...,) -> np.ndarray: ... # noqa @overload -def take_nd( - arr: ExtensionArray, - indexer, - axis: int = ..., - fill_value=..., - allow_fill: bool = ..., -) -> ArrayLike: - ... +def take_nd( arr: ExtensionArray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...,) -> ArrayLike: ... # noqa +# fmt: on def take_nd( diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index 4a5dca348a8c0..c3399ea657e16 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -427,21 +427,16 @@ def astype(self, dtype, copy: bool = True): else: return np.asarray(self, dtype=dtype) + # fmt: off @overload - def view(self: DatetimeLikeArrayT) -> DatetimeLikeArrayT: - ... - + def view(self: DatetimeLikeArrayT) -> DatetimeLikeArrayT: ... # noqa @overload - def view(self, dtype: Literal["M8[ns]"]) -> DatetimeArray: - ... - + def view(self, dtype: Literal["M8[ns]"]) -> DatetimeArray: ... # noqa @overload - def view(self, dtype: Literal["m8[ns]"]) -> TimedeltaArray: - ... - + def view(self, dtype: Literal["m8[ns]"]) -> TimedeltaArray: ... # noqa @overload - def view(self, dtype: Dtype | None = ...) -> ArrayLike: - ... + def view(self, dtype: Dtype | None = ...) -> ArrayLike: ... # noqa + # fmt: on def view(self, dtype: Dtype | None = None) -> ArrayLike: # We handle datetime64, datetime64tz, timedelta64, and period diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index f3fad6913d150..f71b786a0adb4 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1917,18 +1917,12 @@ def std( # Constructor Helpers +# fmt: off @overload -def sequence_to_datetimes( - data, allow_object: Literal[False] = ..., require_iso8601: bool = ... -) -> DatetimeArray: - ... - - +def sequence_to_datetimes( data, allow_object: Literal[False] = ..., require_iso8601: bool = ...) -> DatetimeArray: ... # noqa @overload -def sequence_to_datetimes( - data, allow_object: Literal[True] = ..., require_iso8601: bool = ... -) -> np.ndarray | DatetimeArray: - ... +def sequence_to_datetimes( data, allow_object: Literal[True] = ..., require_iso8601: bool = ...) -> np.ndarray | DatetimeArray: ... # noqa +# fmt: on def sequence_to_datetimes( diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index a373b57accaa9..13aea4f0aee8b 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -503,14 +503,12 @@ def maybe_cast_to_extension_array( return result +# fmt: off @overload -def ensure_dtype_can_hold_na(dtype: np.dtype) -> np.dtype: - ... - - +def ensure_dtype_can_hold_na(dtype: np.dtype) -> np.dtype: ... # noqa @overload -def ensure_dtype_can_hold_na(dtype: ExtensionDtype) -> ExtensionDtype: - ... +def ensure_dtype_can_hold_na(dtype: ExtensionDtype) -> ExtensionDtype: ... # noqa +# fmt: on def ensure_dtype_can_hold_na(dtype: DtypeObj) -> DtypeObj: @@ -1117,18 +1115,12 @@ def astype_td64_unit_conversion( return result +# fmt: off @overload -def astype_nansafe( - arr: np.ndarray, dtype: np.dtype, copy: bool = ..., skipna: bool = ... -) -> np.ndarray: - ... - - +def astype_nansafe( arr: np.ndarray, dtype: np.dtype, copy: bool = ..., skipna: bool = ...) -> np.ndarray: ... # noqa @overload -def astype_nansafe( - arr: np.ndarray, dtype: ExtensionDtype, copy: bool = ..., skipna: bool = ... -) -> ExtensionArray: - ... +def astype_nansafe( arr: np.ndarray, dtype: ExtensionDtype, copy: bool = ..., skipna: bool = ...) -> ExtensionArray: ... # noqa +# fmt: on def astype_nansafe( diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 37fc5de95b3d2..bc6f0b17e651e 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1300,13 +1300,12 @@ def __len__(self) -> int: """ return len(self.index) + # fmt: off @overload - def dot(self, other: Series) -> Series: - ... - + def dot(self, other: Series) -> Series: ... # noqa @overload - def dot(self, other: DataFrame | Index | ArrayLike) -> DataFrame: - ... + def dot(self, other: DataFrame | Index | ArrayLike) -> DataFrame: ... # noqa + # fmt: on def dot(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: """ @@ -1418,15 +1417,12 @@ def dot(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: else: # pragma: no cover raise TypeError(f"unsupported type: {type(other)}") + # fmt: off @overload - def __matmul__(self, other: Series) -> Series: - ... - + def __matmul__(self, other: Series) -> Series: ... # noqa @overload - def __matmul__( - self, other: AnyArrayLike | FrameOrSeriesUnion - ) -> FrameOrSeriesUnion: - ... + def __matmul__( self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: ... # noqa + # fmt: on def __matmul__( self, other: AnyArrayLike | FrameOrSeriesUnion @@ -4650,25 +4646,16 @@ def align( broadcast_axis=broadcast_axis, ) + # fmt: off @overload - def set_axis( - self, labels, axis: Axis = ..., inplace: Literal[False] = ... - ) -> DataFrame: - ... - + def set_axis( self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: - ... - + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis(self, labels, *, inplace: Literal[True]) -> None: - ... - + def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis( - self, labels, axis: Axis = ..., inplace: bool = ... - ) -> DataFrame | None: - ... + def set_axis( self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa + # fmt: on @Appender( """ @@ -5007,120 +4994,28 @@ def rename( errors=errors, ) + # fmt: off @overload - def fillna( - self, - value=..., - method: str | None = ..., - axis: Axis | None = ..., - inplace: Literal[False] = ..., - limit=..., - downcast=..., - ) -> DataFrame: - ... - + def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...,) -> DataFrame: ... # noqa @overload - def fillna( - self, - value, - method: str | None, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value, - *, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - method: str | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - method: str | None, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value, - *, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value, - method: str | None, - *, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value=..., - method: str | None = ..., - axis: Axis | None = ..., - inplace: bool = ..., - limit=..., - downcast=..., - ) -> DataFrame | None: - ... + def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...,) -> DataFrame | None: ... # noqa + # fmt: on @doc(NDFrame.fillna, **_shared_doc_kwargs) def fillna( @@ -5496,70 +5391,20 @@ def set_index( if not inplace: return frame + # fmt: off @overload - def reset_index( - self, - level: Hashable | Sequence[Hashable] | None = ..., - drop: bool = ..., - inplace: Literal[False] = ..., - col_level: Hashable = ..., - col_fill: Hashable = ..., - ) -> DataFrame: - ... - + def reset_index( self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: Literal[False] = ..., col_level: Hashable = ..., col_fill: Hashable = ...,) -> DataFrame: ... # noqa @overload - def reset_index( - self, - level: Hashable | Sequence[Hashable] | None, - drop: bool, - inplace: Literal[True], - col_level: Hashable = ..., - col_fill: Hashable = ..., - ) -> None: - ... - + def reset_index( self, level: Hashable | Sequence[Hashable] | None, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa @overload - def reset_index( - self, - *, - drop: bool, - inplace: Literal[True], - col_level: Hashable = ..., - col_fill: Hashable = ..., - ) -> None: - ... - + def reset_index( self, *, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa @overload - def reset_index( - self, - level: Hashable | Sequence[Hashable] | None, - *, - inplace: Literal[True], - col_level: Hashable = ..., - col_fill: Hashable = ..., - ) -> None: - ... - + def reset_index( self, level: Hashable | Sequence[Hashable] | None, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa @overload - def reset_index( - self, - *, - inplace: Literal[True], - col_level: Hashable = ..., - col_fill: Hashable = ..., - ) -> None: - ... - + def reset_index( self, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa @overload - def reset_index( - self, - level: Hashable | Sequence[Hashable] | None = ..., - drop: bool = ..., - inplace: bool = ..., - col_level: Hashable = ..., - col_fill: Hashable = ..., - ) -> DataFrame | None: - ... + def reset_index( self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: bool = ..., col_level: Hashable = ..., col_fill: Hashable = ...,) -> DataFrame | None: ... # noqa + # fmt: on def reset_index( self, diff --git a/pandas/core/generic.py b/pandas/core/generic.py index cbc353eead464..674011152248a 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -681,27 +681,16 @@ def size(self) -> int: # error: Incompatible return value type (got "number", expected "int") return np.prod(self.shape) # type: ignore[return-value] + # fmt: off @overload - def set_axis( - self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[False] = ... - ) -> FrameOrSeries: - ... - + def set_axis( self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> FrameOrSeries: ... # noqa @overload - def set_axis( - self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True] - ) -> None: - ... - + def set_axis( self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: - ... - + def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis( - self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ... - ) -> FrameOrSeries | None: - ... + def set_axis( self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...) -> FrameOrSeries | None: ... # noqa + # fmt: on def set_axis(self, labels, axis: Axis = 0, inplace: bool_t = False): """ @@ -7354,113 +7343,28 @@ def _clip_with_one_bound(self, threshold, method, axis, inplace): threshold = align_method_FRAME(self, threshold, axis, flex=None)[1] return self.where(subset, threshold, axis=axis, inplace=inplace) + # fmt: off @overload - def clip( - self: FrameOrSeries, - lower=..., - upper=..., - axis: Axis | None = ..., - inplace: Literal[False] = ..., - *args, - **kwargs, - ) -> FrameOrSeries: - ... - + def clip( self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: Literal[False] = ..., *args, **kwargs,) -> FrameOrSeries: ... # noqa @overload - def clip( - self: FrameOrSeries, - lower, - *, - axis: Axis | None, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, lower, *, axis: Axis | None, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - lower, - *, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, lower, *, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - *, - upper, - axis: Axis | None, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, *, upper, axis: Axis | None, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - *, - upper, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, *, upper, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - *, - axis: Axis | None, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, *, axis: Axis | None, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - lower, - upper, - axis: Axis | None, - inplace: Literal[True], - *args, - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, lower, upper, axis: Axis | None, inplace: Literal[True], *args, **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - lower, - upper, - *, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, lower, upper, *, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - *, - inplace: Literal[True], - **kwargs, - ) -> None: - ... - + def clip( self: FrameOrSeries, *, inplace: Literal[True], **kwargs,) -> None: ... # noqa @overload - def clip( - self: FrameOrSeries, - lower=..., - upper=..., - axis: Axis | None = ..., - inplace: bool_t = ..., - *args, - **kwargs, - ) -> FrameOrSeries | None: - ... + def clip( self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: bool_t = ..., *args, **kwargs,) -> FrameOrSeries | None: ... # noqa + # fmt: on @final def clip( diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index b3b453ea6355a..7d5d47750d2da 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -52,36 +52,12 @@ # Concatenate DataFrame objects +# fmt: off @overload -def concat( - objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], - axis=0, - join: str = "outer", - ignore_index: bool = False, - keys=None, - levels=None, - names=None, - verify_integrity: bool = False, - sort: bool = False, - copy: bool = True, -) -> DataFrame: - ... - - +def concat( objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True,) -> DataFrame: ... # noqa @overload -def concat( - objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], - axis=0, - join: str = "outer", - ignore_index: bool = False, - keys=None, - levels=None, - names=None, - verify_integrity: bool = False, - sort: bool = False, - copy: bool = True, -) -> FrameOrSeriesUnion: - ... +def concat( objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True,) -> FrameOrSeriesUnion: ... # noqa +# fmt: on def concat( diff --git a/pandas/core/series.py b/pandas/core/series.py index 5c605a6b441c6..fc70986e010f6 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2009,21 +2009,16 @@ def unique(self) -> ArrayLike: """ return super().unique() + # fmt: off @overload - def drop_duplicates(self, keep=..., inplace: Literal[False] = ...) -> Series: - ... - + def drop_duplicates(self, keep=..., inplace: Literal[False] = ...) -> Series: ... # noqa @overload - def drop_duplicates(self, keep, inplace: Literal[True]) -> None: - ... - + def drop_duplicates(self, keep, inplace: Literal[True]) -> None: ... # noqa @overload - def drop_duplicates(self, *, inplace: Literal[True]) -> None: - ... - + def drop_duplicates(self, *, inplace: Literal[True]) -> None: ... # noqa @overload - def drop_duplicates(self, keep=..., inplace: bool = ...) -> Series | None: - ... + def drop_duplicates(self, keep=..., inplace: bool = ...) -> Series | None: ... # noqa + # fmt: on def drop_duplicates(self, keep="first", inplace=False) -> Series | None: """ @@ -4419,23 +4414,16 @@ def rename( else: return self._set_name(index, inplace=inplace) + # fmt: off @overload - def set_axis( - self, labels, axis: Axis = ..., inplace: Literal[False] = ... - ) -> Series: - ... - + def set_axis( self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> Series: ... # noqa @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: - ... - + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis(self, labels, *, inplace: Literal[True]) -> None: - ... - + def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> Series | None: - ... + def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> Series | None: ... # noqa + # fmt: on @Appender( """ @@ -4581,120 +4569,28 @@ def drop( errors=errors, ) + # fmt: off @overload - def fillna( - self, - value=..., - method: str | None = ..., - axis: Axis | None = ..., - inplace: Literal[False] = ..., - limit=..., - downcast=..., - ) -> Series: - ... - + def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...,) -> Series: ... # noqa @overload - def fillna( - self, - value, - method: str | None, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value, - *, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - method: str | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - *, - method: str | None, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value, - *, - axis: Axis | None, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value, - method: str | None, - *, - inplace: Literal[True], - limit=..., - downcast=..., - ) -> None: - ... - + def fillna( self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa @overload - def fillna( - self, - value=..., - method: str | None = ..., - axis: Axis | None = ..., - inplace: bool = ..., - limit=..., - downcast=..., - ) -> Series | None: - ... + def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...,) -> Series | None: ... # noqa + # fmt: on @doc(NDFrame.fillna, **_shared_doc_kwargs) def fillna( diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 77bbde62d607e..c54192afb3337 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -637,55 +637,14 @@ def _adjust_to_origin(arg, origin, unit): return arg +# fmt: off @overload -def to_datetime( - arg: DatetimeScalar, - errors: str = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool | None = ..., - format: str | None = ..., - exact: bool = ..., - unit: str | None = ..., - infer_datetime_format: bool = ..., - origin=..., - cache: bool = ..., -) -> DatetimeScalar | NaTType: - ... - - +def to_datetime( arg: DatetimeScalar, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...,) -> DatetimeScalar | NaTType: ... # noqa @overload -def to_datetime( - arg: Series, - errors: str = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool | None = ..., - format: str | None = ..., - exact: bool = ..., - unit: str | None = ..., - infer_datetime_format: bool = ..., - origin=..., - cache: bool = ..., -) -> Series: - ... - - +def to_datetime( arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...,) -> Series: ... # noqa @overload -def to_datetime( - arg: list | tuple | np.ndarray, - errors: str = ..., - dayfirst: bool = ..., - yearfirst: bool = ..., - utc: bool | None = ..., - format: str | None = ..., - exact: bool = ..., - unit: str | None = ..., - infer_datetime_format: bool = ..., - origin=..., - cache: bool = ..., -) -> DatetimeIndex: - ... +def to_datetime( arg: list | tuple | np.ndarray, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...,) -> DatetimeIndex: ... # noqa +# fmt: on def to_datetime( diff --git a/pandas/io/sas/sasreader.py b/pandas/io/sas/sasreader.py index b323ce39763a1..a2a94921d7861 100644 --- a/pandas/io/sas/sasreader.py +++ b/pandas/io/sas/sasreader.py @@ -42,28 +42,12 @@ def __exit__(self, exc_type, exc_value, traceback): self.close() +# fmt: off @overload -def read_sas( - filepath_or_buffer: FilePathOrBuffer, - format: str | None = ..., - index: Hashable | None = ..., - encoding: str | None = ..., - chunksize: int = ..., - iterator: bool = ..., -) -> ReaderBase: - ... - - +def read_sas( filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int = ..., iterator: bool = ...,) -> ReaderBase: ... # noqa @overload -def read_sas( - filepath_or_buffer: FilePathOrBuffer, - format: str | None = ..., - index: Hashable | None = ..., - encoding: str | None = ..., - chunksize: None = ..., - iterator: bool = ..., -) -> DataFrame | ReaderBase: - ... +def read_sas( filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: None = ..., iterator: bool = ...,) -> DataFrame | ReaderBase: ... # noqa +# fmt: on def read_sas( diff --git a/pandas/io/sql.py b/pandas/io/sql.py index d797fa51984d6..cad1abbc83253 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -211,32 +211,12 @@ def execute(sql, con, cur=None, params=None): # -- Read and write to DataFrames +# fmt: off @overload -def read_sql_table( - table_name, - con, - schema=None, - index_col=None, - coerce_float=True, - parse_dates=None, - columns=None, - chunksize: None = None, -) -> DataFrame: - ... - - +def read_sql_table( table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: None = None,) -> DataFrame: ... # noqa @overload -def read_sql_table( - table_name, - con, - schema=None, - index_col=None, - coerce_float=True, - parse_dates=None, - columns=None, - chunksize: int = 1, -) -> Iterator[DataFrame]: - ... +def read_sql_table( table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: int = 1,) -> Iterator[DataFrame]: ... # noqa +# fmt: on def read_sql_table( @@ -334,32 +314,12 @@ def read_sql_table( raise ValueError(f"Table {table_name} not found", con) +# fmt: off @overload -def read_sql_query( - sql, - con, - index_col=None, - coerce_float=True, - params=None, - parse_dates=None, - chunksize: None = None, - dtype: DtypeArg | None = None, -) -> DataFrame: - ... - - +def read_sql_query( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: None = None, dtype: DtypeArg | None = None,) -> DataFrame: ... # noqa @overload -def read_sql_query( - sql, - con, - index_col=None, - coerce_float=True, - params=None, - parse_dates=None, - chunksize: int = 1, - dtype: DtypeArg | None = None, -) -> Iterator[DataFrame]: - ... +def read_sql_query( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: int = 1, dtype: DtypeArg | None = None,) -> Iterator[DataFrame]: ... # noqa +# fmt: on def read_sql_query( @@ -441,32 +401,12 @@ def read_sql_query( ) +# fmt: off @overload -def read_sql( - sql, - con, - index_col=None, - coerce_float=True, - params=None, - parse_dates=None, - columns=None, - chunksize: None = None, -) -> DataFrame: - ... - - +def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: None = None,) -> DataFrame: ... # noqa @overload -def read_sql( - sql, - con, - index_col=None, - coerce_float=True, - params=None, - parse_dates=None, - columns=None, - chunksize: int = 1, -) -> Iterator[DataFrame]: - ... +def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: int = 1,) -> Iterator[DataFrame]: ... # noqa +# fmt: on def read_sql( From e2177627719084aa9a755eb7919378ec3e88dbe9 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 10:35:41 +0100 Subject: [PATCH 2/8] fmt off for overloads --- pandas/core/array_algos/take.py | 4 ++-- pandas/core/arrays/datetimes.py | 4 ++-- pandas/core/dtypes/cast.py | 4 ++-- pandas/core/frame.py | 38 ++++++++++++++++----------------- pandas/core/generic.py | 26 +++++++++++----------- pandas/core/reshape/concat.py | 4 ++-- pandas/core/series.py | 20 ++++++++--------- pandas/core/tools/datetimes.py | 6 +++--- pandas/io/sas/sasreader.py | 4 ++-- pandas/io/sql.py | 12 +++++------ 10 files changed, 61 insertions(+), 61 deletions(-) diff --git a/pandas/core/array_algos/take.py b/pandas/core/array_algos/take.py index 87bc05c240fed..238a2f9a7ab2f 100644 --- a/pandas/core/array_algos/take.py +++ b/pandas/core/array_algos/take.py @@ -28,9 +28,9 @@ # fmt: off @overload -def take_nd( arr: np.ndarray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...,) -> np.ndarray: ... # noqa +def take_nd(arr: np.ndarray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...) -> np.ndarray: ... # noqa @overload -def take_nd( arr: ExtensionArray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...,) -> ArrayLike: ... # noqa +def take_nd(arr: ExtensionArray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...) -> ArrayLike: ... # noqa # fmt: on diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index f71b786a0adb4..96b64eed3de9f 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1919,9 +1919,9 @@ def std( # fmt: off @overload -def sequence_to_datetimes( data, allow_object: Literal[False] = ..., require_iso8601: bool = ...) -> DatetimeArray: ... # noqa +def sequence_to_datetimes(data, allow_object: Literal[False] = ..., require_iso8601: bool = ...) -> DatetimeArray: ... # noqa @overload -def sequence_to_datetimes( data, allow_object: Literal[True] = ..., require_iso8601: bool = ...) -> np.ndarray | DatetimeArray: ... # noqa +def sequence_to_datetimes(data, allow_object: Literal[True] = ..., require_iso8601: bool = ...) -> np.ndarray | DatetimeArray: ... # noqa # fmt: on diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index 13aea4f0aee8b..6fa4de0a9630d 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -1117,9 +1117,9 @@ def astype_td64_unit_conversion( # fmt: off @overload -def astype_nansafe( arr: np.ndarray, dtype: np.dtype, copy: bool = ..., skipna: bool = ...) -> np.ndarray: ... # noqa +def astype_nansafe(arr: np.ndarray, dtype: np.dtype, copy: bool = ..., skipna: bool = ...) -> np.ndarray: ... # noqa @overload -def astype_nansafe( arr: np.ndarray, dtype: ExtensionDtype, copy: bool = ..., skipna: bool = ...) -> ExtensionArray: ... # noqa +def astype_nansafe(arr: np.ndarray, dtype: ExtensionDtype, copy: bool = ..., skipna: bool = ...) -> ExtensionArray: ... # noqa # fmt: on diff --git a/pandas/core/frame.py b/pandas/core/frame.py index bc6f0b17e651e..81c5b9789bf19 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1421,7 +1421,7 @@ def dot(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: @overload def __matmul__(self, other: Series) -> Series: ... # noqa @overload - def __matmul__( self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: ... # noqa + def __matmul__(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: ... # noqa # fmt: on def __matmul__( @@ -4648,13 +4648,13 @@ def align( # fmt: off @overload - def set_axis( self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa + def set_axis(self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa @overload def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa @overload def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis( self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa + def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa # fmt: on @Appender( @@ -4996,25 +4996,25 @@ def rename( # fmt: off @overload - def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...,) -> DataFrame: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...) -> DataFrame: ... # noqa @overload - def fillna( self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...,) -> DataFrame | None: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...) -> DataFrame | None: ... # noqa # fmt: on @doc(NDFrame.fillna, **_shared_doc_kwargs) @@ -5393,17 +5393,17 @@ def set_index( # fmt: off @overload - def reset_index( self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: Literal[False] = ..., col_level: Hashable = ..., col_fill: Hashable = ...,) -> DataFrame: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: Literal[False] = ..., col_level: Hashable = ..., col_fill: Hashable = ...) -> DataFrame: ... # noqa @overload - def reset_index( self, level: Hashable | Sequence[Hashable] | None, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa @overload - def reset_index( self, *, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa + def reset_index(self, *, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa @overload - def reset_index( self, level: Hashable | Sequence[Hashable] | None, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa @overload - def reset_index( self, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...,) -> None: ... # noqa + def reset_index(self, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa @overload - def reset_index( self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: bool = ..., col_level: Hashable = ..., col_fill: Hashable = ...,) -> DataFrame | None: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: bool = ..., col_level: Hashable = ..., col_fill: Hashable = ...) -> DataFrame | None: ... # noqa # fmt: on def reset_index( diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 674011152248a..2293f1aeb212b 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -683,13 +683,13 @@ def size(self) -> int: # fmt: off @overload - def set_axis( self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> FrameOrSeries: ... # noqa + def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> FrameOrSeries: ... # noqa @overload - def set_axis( self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa @overload def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: ... # noqa @overload - def set_axis( self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...) -> FrameOrSeries | None: ... # noqa + def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...) -> FrameOrSeries | None: ... # noqa # fmt: on def set_axis(self, labels, axis: Axis = 0, inplace: bool_t = False): @@ -7345,25 +7345,25 @@ def _clip_with_one_bound(self, threshold, method, axis, inplace): # fmt: off @overload - def clip( self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: Literal[False] = ..., *args, **kwargs,) -> FrameOrSeries: ... # noqa + def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: Literal[False] = ..., *args, **kwargs) -> FrameOrSeries: ... # noqa @overload - def clip( self: FrameOrSeries, lower, *, axis: Axis | None, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, *, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, lower, *, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, *, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, *, upper, axis: Axis | None, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, *, upper, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, *, upper, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, *, upper, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, *, axis: Axis | None, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, *, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, lower, upper, axis: Axis | None, inplace: Literal[True], *args, **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, upper, axis: Axis | None, inplace: Literal[True], *args, **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, lower, upper, *, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, upper, *, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, *, inplace: Literal[True], **kwargs,) -> None: ... # noqa + def clip(self: FrameOrSeries, *, inplace: Literal[True], **kwargs) -> None: ... # noqa @overload - def clip( self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: bool_t = ..., *args, **kwargs,) -> FrameOrSeries | None: ... # noqa + def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: bool_t = ..., *args, **kwargs) -> FrameOrSeries | None: ... # noqa # fmt: on @final diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index 7d5d47750d2da..1b1c8585e828b 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -54,9 +54,9 @@ # fmt: off @overload -def concat( objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True,) -> DataFrame: ... # noqa +def concat(objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> DataFrame: ... # noqa @overload -def concat( objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True,) -> FrameOrSeriesUnion: ... # noqa +def concat(objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> FrameOrSeriesUnion: ... # noqa # fmt: on diff --git a/pandas/core/series.py b/pandas/core/series.py index fc70986e010f6..e2f62a9bfc5bc 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -4571,25 +4571,25 @@ def drop( # fmt: off @overload - def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...,) -> Series: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...) -> Series: ... # noqa @overload - def fillna( self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...,) -> None: ... # noqa + def fillna(self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa @overload - def fillna( self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...,) -> Series | None: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...) -> Series | None: ... # noqa # fmt: on @doc(NDFrame.fillna, **_shared_doc_kwargs) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index c54192afb3337..99c3ee5f6eac0 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -639,11 +639,11 @@ def _adjust_to_origin(arg, origin, unit): # fmt: off @overload -def to_datetime( arg: DatetimeScalar, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...,) -> DatetimeScalar | NaTType: ... # noqa +def to_datetime(arg: DatetimeScalar, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeScalar | NaTType: ... # noqa @overload -def to_datetime( arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...,) -> Series: ... # noqa +def to_datetime(arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> Series: ... # noqa @overload -def to_datetime( arg: list | tuple | np.ndarray, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...,) -> DatetimeIndex: ... # noqa +def to_datetime(arg: list | tuple | np.ndarray, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeIndex: ... # noqa # fmt: on diff --git a/pandas/io/sas/sasreader.py b/pandas/io/sas/sasreader.py index a2a94921d7861..143664d1769de 100644 --- a/pandas/io/sas/sasreader.py +++ b/pandas/io/sas/sasreader.py @@ -44,9 +44,9 @@ def __exit__(self, exc_type, exc_value, traceback): # fmt: off @overload -def read_sas( filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int = ..., iterator: bool = ...,) -> ReaderBase: ... # noqa +def read_sas(filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int = ..., iterator: bool = ...) -> ReaderBase: ... # noqa @overload -def read_sas( filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: None = ..., iterator: bool = ...,) -> DataFrame | ReaderBase: ... # noqa +def read_sas(filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: None = ..., iterator: bool = ...) -> DataFrame | ReaderBase: ... # noqa # fmt: on diff --git a/pandas/io/sql.py b/pandas/io/sql.py index cad1abbc83253..53e957bf4114c 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -213,9 +213,9 @@ def execute(sql, con, cur=None, params=None): # fmt: off @overload -def read_sql_table( table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: None = None,) -> DataFrame: ... # noqa +def read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: None = None) -> DataFrame: ... # noqa @overload -def read_sql_table( table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: int = 1,) -> Iterator[DataFrame]: ... # noqa +def read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: int = 1) -> Iterator[DataFrame]: ... # noqa # fmt: on @@ -316,9 +316,9 @@ def read_sql_table( # fmt: off @overload -def read_sql_query( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: None = None, dtype: DtypeArg | None = None,) -> DataFrame: ... # noqa +def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: None = None, dtype: DtypeArg | None = None) -> DataFrame: ... # noqa @overload -def read_sql_query( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: int = 1, dtype: DtypeArg | None = None,) -> Iterator[DataFrame]: ... # noqa +def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: int = 1, dtype: DtypeArg | None = None) -> Iterator[DataFrame]: ... # noqa # fmt: on @@ -403,9 +403,9 @@ def read_sql_query( # fmt: off @overload -def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: None = None,) -> DataFrame: ... # noqa +def read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: None = None) -> DataFrame: ... # noqa @overload -def read_sql( sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: int = 1,) -> Iterator[DataFrame]: ... # noqa +def read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: int = 1) -> Iterator[DataFrame]: ... # noqa # fmt: on From e9c127caaaa551c868edf03924d19940fd300cfa Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 10:56:20 +0100 Subject: [PATCH 3/8] use flake8 linter --- .pep8speaks.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.pep8speaks.yml b/.pep8speaks.yml index 5a83727ddf5f8..0b8d5b0eeaa91 100644 --- a/.pep8speaks.yml +++ b/.pep8speaks.yml @@ -2,3 +2,4 @@ scanner: diff_only: True # If True, errors caused by only the patch are shown + linter: flake8 From ec4b7d1170a836f59dfd3147cca8a269ae04d124 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 10:58:07 +0100 Subject: [PATCH 4/8] remvoe pep8speaks --- .pep8speaks.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .pep8speaks.yml diff --git a/.pep8speaks.yml b/.pep8speaks.yml deleted file mode 100644 index 0b8d5b0eeaa91..0000000000000 --- a/.pep8speaks.yml +++ /dev/null @@ -1,5 +0,0 @@ -# File : .pep8speaks.yml - -scanner: - diff_only: True # If True, errors caused by only the patch are shown - linter: flake8 From 0d05ad11aad3240b9efd9e37535d27e30bceaf27 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 18:31:56 +0100 Subject: [PATCH 5/8] wip --- pandas/core/array_algos/take.py | 4 +-- pandas/core/arrays/datetimelike.py | 8 ++--- pandas/core/arrays/datetimes.py | 4 +-- pandas/core/dtypes/cast.py | 8 ++--- pandas/core/frame.py | 48 +++++++++++++++--------------- pandas/core/generic.py | 28 ++++++++--------- pandas/core/reshape/concat.py | 4 +-- pandas/core/series.py | 36 +++++++++++----------- pandas/core/tools/datetimes.py | 6 ++-- pandas/io/sas/sasreader.py | 4 +-- pandas/io/sql.py | 12 ++++---- 11 files changed, 81 insertions(+), 81 deletions(-) diff --git a/pandas/core/array_algos/take.py b/pandas/core/array_algos/take.py index 238a2f9a7ab2f..b325ce2d5d08e 100644 --- a/pandas/core/array_algos/take.py +++ b/pandas/core/array_algos/take.py @@ -28,9 +28,9 @@ # fmt: off @overload -def take_nd(arr: np.ndarray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...) -> np.ndarray: ... # noqa +def take_nd(arr: np.ndarray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...) -> np.ndarray: ... # noqa: E501, E704 @overload -def take_nd(arr: ExtensionArray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...) -> ArrayLike: ... # noqa +def take_nd(arr: ExtensionArray, indexer, axis: int = ..., fill_value=..., allow_fill: bool = ...) -> ArrayLike: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/core/arrays/datetimelike.py b/pandas/core/arrays/datetimelike.py index c3399ea657e16..f0ea724ca137f 100644 --- a/pandas/core/arrays/datetimelike.py +++ b/pandas/core/arrays/datetimelike.py @@ -429,13 +429,13 @@ def astype(self, dtype, copy: bool = True): # fmt: off @overload - def view(self: DatetimeLikeArrayT) -> DatetimeLikeArrayT: ... # noqa + def view(self: DatetimeLikeArrayT) -> DatetimeLikeArrayT: ... # noqa: E704 @overload - def view(self, dtype: Literal["M8[ns]"]) -> DatetimeArray: ... # noqa + def view(self, dtype: Literal["M8[ns]"]) -> DatetimeArray: ... # noqa: E704 @overload - def view(self, dtype: Literal["m8[ns]"]) -> TimedeltaArray: ... # noqa + def view(self, dtype: Literal["m8[ns]"]) -> TimedeltaArray: ... # noqa: E704 @overload - def view(self, dtype: Dtype | None = ...) -> ArrayLike: ... # noqa + def view(self, dtype: Dtype | None = ...) -> ArrayLike: ... # noqa: E704 # fmt: on def view(self, dtype: Dtype | None = None) -> ArrayLike: diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 96b64eed3de9f..316df221f1fc5 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -1919,9 +1919,9 @@ def std( # fmt: off @overload -def sequence_to_datetimes(data, allow_object: Literal[False] = ..., require_iso8601: bool = ...) -> DatetimeArray: ... # noqa +def sequence_to_datetimes(data, allow_object: Literal[False] = ..., require_iso8601: bool = ...) -> DatetimeArray: ... # noqa: E501, E704 @overload -def sequence_to_datetimes(data, allow_object: Literal[True] = ..., require_iso8601: bool = ...) -> np.ndarray | DatetimeArray: ... # noqa +def sequence_to_datetimes(data, allow_object: Literal[True] = ..., require_iso8601: bool = ...) -> np.ndarray | DatetimeArray: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/core/dtypes/cast.py b/pandas/core/dtypes/cast.py index 6fa4de0a9630d..297f00feadc49 100644 --- a/pandas/core/dtypes/cast.py +++ b/pandas/core/dtypes/cast.py @@ -505,9 +505,9 @@ def maybe_cast_to_extension_array( # fmt: off @overload -def ensure_dtype_can_hold_na(dtype: np.dtype) -> np.dtype: ... # noqa +def ensure_dtype_can_hold_na(dtype: np.dtype) -> np.dtype: ... # noqa: E704 @overload -def ensure_dtype_can_hold_na(dtype: ExtensionDtype) -> ExtensionDtype: ... # noqa +def ensure_dtype_can_hold_na(dtype: ExtensionDtype) -> ExtensionDtype: ... # noqa: E704 # fmt: on @@ -1117,9 +1117,9 @@ def astype_td64_unit_conversion( # fmt: off @overload -def astype_nansafe(arr: np.ndarray, dtype: np.dtype, copy: bool = ..., skipna: bool = ...) -> np.ndarray: ... # noqa +def astype_nansafe(arr: np.ndarray, dtype: np.dtype, copy: bool = ..., skipna: bool = ...) -> np.ndarray: ... # noqa: E501, E704 @overload -def astype_nansafe(arr: np.ndarray, dtype: ExtensionDtype, copy: bool = ..., skipna: bool = ...) -> ExtensionArray: ... # noqa +def astype_nansafe(arr: np.ndarray, dtype: ExtensionDtype, copy: bool = ..., skipna: bool = ...) -> ExtensionArray: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 81c5b9789bf19..dacc687b090d8 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -1302,9 +1302,9 @@ def __len__(self) -> int: # fmt: off @overload - def dot(self, other: Series) -> Series: ... # noqa + def dot(self, other: Series) -> Series: ... # noqa: E704 @overload - def dot(self, other: DataFrame | Index | ArrayLike) -> DataFrame: ... # noqa + def dot(self, other: DataFrame | Index | ArrayLike) -> DataFrame: ... # noqa: E704 # fmt: on def dot(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: @@ -1419,9 +1419,9 @@ def dot(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: # fmt: off @overload - def __matmul__(self, other: Series) -> Series: ... # noqa + def __matmul__(self, other: Series) -> Series: ... # noqa: E704 @overload - def __matmul__(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: ... # noqa + def __matmul__(self, other: AnyArrayLike | FrameOrSeriesUnion) -> FrameOrSeriesUnion: ... # noqa: E501, E704 # fmt: on def __matmul__( @@ -4648,13 +4648,13 @@ def align( # fmt: off @overload - def set_axis(self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa + def set_axis(self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa: E501, E704 @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # @overload - def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa + def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa: E501, E704 # fmt: on @Appender( @@ -4996,25 +4996,25 @@ def rename( # fmt: off @overload - def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...) -> DataFrame: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...) -> DataFrame: ... # noqa: E501, E704 @overload - def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E704 @overload - def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...) -> DataFrame | None: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...) -> DataFrame | None: ... # noqa: E501, E704 # fmt: on @doc(NDFrame.fillna, **_shared_doc_kwargs) @@ -5393,17 +5393,17 @@ def set_index( # fmt: off @overload - def reset_index(self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: Literal[False] = ..., col_level: Hashable = ..., col_fill: Hashable = ...) -> DataFrame: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: Literal[False] = ..., col_level: Hashable = ..., col_fill: Hashable = ...) -> DataFrame: ... # noqa: E501, E704 @overload - def reset_index(self, level: Hashable | Sequence[Hashable] | None, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa: E501, E704 @overload - def reset_index(self, *, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa + def reset_index(self, *, drop: bool, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa: E501, E704 @overload - def reset_index(self, level: Hashable | Sequence[Hashable] | None, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa: E501, E704 @overload - def reset_index(self, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa + def reset_index(self, *, inplace: Literal[True], col_level: Hashable = ..., col_fill: Hashable = ...) -> None: ... # noqa: E501, E704 @overload - def reset_index(self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: bool = ..., col_level: Hashable = ..., col_fill: Hashable = ...) -> DataFrame | None: ... # noqa + def reset_index(self, level: Hashable | Sequence[Hashable] | None = ..., drop: bool = ..., inplace: bool = ..., col_level: Hashable = ..., col_fill: Hashable = ...) -> DataFrame | None: ... # noqa: E501, E704 # fmt: on def reset_index( diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 2293f1aeb212b..c0f44922513a9 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -683,13 +683,13 @@ def size(self) -> int: # fmt: off @overload - def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> FrameOrSeries: ... # noqa + def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> FrameOrSeries: ... # noqa: E501, E704 @overload - def set_axis(self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E501, E704 @overload - def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...) -> FrameOrSeries | None: ... # noqa + def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...) -> FrameOrSeries | None: ... # noqa: E501, E704 # fmt: on def set_axis(self, labels, axis: Axis = 0, inplace: bool_t = False): @@ -7345,25 +7345,25 @@ def _clip_with_one_bound(self, threshold, method, axis, inplace): # fmt: off @overload - def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: Literal[False] = ..., *args, **kwargs) -> FrameOrSeries: ... # noqa + def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: Literal[False] = ..., *args, **kwargs) -> FrameOrSeries: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, lower, *, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, *, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, lower, *, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, *, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, *, upper, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, *, upper, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, *, upper, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, *, upper, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, *, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, *, axis: Axis | None, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, lower, upper, axis: Axis | None, inplace: Literal[True], *args, **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, upper, axis: Axis | None, inplace: Literal[True], *args, **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, lower, upper, *, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, lower, upper, *, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, *, inplace: Literal[True], **kwargs) -> None: ... # noqa + def clip(self: FrameOrSeries, *, inplace: Literal[True], **kwargs) -> None: ... # noqa: E704 @overload - def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: bool_t = ..., *args, **kwargs) -> FrameOrSeries | None: ... # noqa + def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: bool_t = ..., *args, **kwargs) -> FrameOrSeries | None: ... # noqa: E501, E704 # fmt: on @final diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index 1b1c8585e828b..8889f88ed8eab 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -54,9 +54,9 @@ # fmt: off @overload -def concat(objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> DataFrame: ... # noqa +def concat(objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> DataFrame: ... # noqa: E501, E704 @overload -def concat(objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> FrameOrSeriesUnion: ... # noqa +def concat(objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> FrameOrSeriesUnion: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/core/series.py b/pandas/core/series.py index e2f62a9bfc5bc..2e4d5184d26a0 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2011,13 +2011,13 @@ def unique(self) -> ArrayLike: # fmt: off @overload - def drop_duplicates(self, keep=..., inplace: Literal[False] = ...) -> Series: ... # noqa + def drop_duplicates(self, keep=..., inplace: Literal[False] = ...) -> Series: ... # noqa: E704 @overload - def drop_duplicates(self, keep, inplace: Literal[True]) -> None: ... # noqa + def drop_duplicates(self, keep, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def drop_duplicates(self, *, inplace: Literal[True]) -> None: ... # noqa + def drop_duplicates(self, *, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def drop_duplicates(self, keep=..., inplace: bool = ...) -> Series | None: ... # noqa + def drop_duplicates(self, keep=..., inplace: bool = ...) -> Series | None: ... # noqa: E704 # fmt: on def drop_duplicates(self, keep="first", inplace=False) -> Series | None: @@ -4416,13 +4416,13 @@ def rename( # fmt: off @overload - def set_axis( self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> Series: ... # noqa + def set_axis( self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> Series: ... # noqa: E501, E704 @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa + def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> Series | None: ... # noqa + def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> Series | None: ... # noqa: E501, E704 # fmt: on @Appender( @@ -4571,25 +4571,25 @@ def drop( # fmt: off @overload - def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...) -> Series: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: Literal[False] = ..., limit=..., downcast=...) -> Series: ... # noqa: E501, E704 @overload - def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E704 @overload - def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, method: str | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, *, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, *, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa + def fillna(self, value, method: str | None, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...) -> Series | None: ... # noqa + def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., inplace: bool = ..., limit=..., downcast=...) -> Series | None: ... # noqa: E501, E704 # fmt: on @doc(NDFrame.fillna, **_shared_doc_kwargs) diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 99c3ee5f6eac0..77d3524577cbf 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -639,11 +639,11 @@ def _adjust_to_origin(arg, origin, unit): # fmt: off @overload -def to_datetime(arg: DatetimeScalar, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeScalar | NaTType: ... # noqa +def to_datetime(arg: DatetimeScalar, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeScalar | NaTType: ... # noqa: E501, E704 @overload -def to_datetime(arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> Series: ... # noqa +def to_datetime(arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> Series: ... # noqa: E501, E704 @overload -def to_datetime(arg: list | tuple | np.ndarray, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeIndex: ... # noqa +def to_datetime(arg: list | tuple | np.ndarray, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeIndex: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/io/sas/sasreader.py b/pandas/io/sas/sasreader.py index 143664d1769de..704aa58674162 100644 --- a/pandas/io/sas/sasreader.py +++ b/pandas/io/sas/sasreader.py @@ -44,9 +44,9 @@ def __exit__(self, exc_type, exc_value, traceback): # fmt: off @overload -def read_sas(filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int = ..., iterator: bool = ...) -> ReaderBase: ... # noqa +def read_sas(filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: int = ..., iterator: bool = ...) -> ReaderBase: ... # noqa: E501, E704 @overload -def read_sas(filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: None = ..., iterator: bool = ...) -> DataFrame | ReaderBase: ... # noqa +def read_sas(filepath_or_buffer: FilePathOrBuffer, format: str | None = ..., index: Hashable | None = ..., encoding: str | None = ..., chunksize: None = ..., iterator: bool = ...) -> DataFrame | ReaderBase: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/io/sql.py b/pandas/io/sql.py index 53e957bf4114c..235433ca483af 100644 --- a/pandas/io/sql.py +++ b/pandas/io/sql.py @@ -213,9 +213,9 @@ def execute(sql, con, cur=None, params=None): # fmt: off @overload -def read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: None = None) -> DataFrame: ... # noqa +def read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: None = None) -> DataFrame: ... # noqa: E501, E704 @overload -def read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: int = 1) -> Iterator[DataFrame]: ... # noqa +def read_sql_table(table_name, con, schema=None, index_col=None, coerce_float=True, parse_dates=None, columns=None, chunksize: int = 1) -> Iterator[DataFrame]: ... # noqa: E501, E704 # fmt: on @@ -316,9 +316,9 @@ def read_sql_table( # fmt: off @overload -def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: None = None, dtype: DtypeArg | None = None) -> DataFrame: ... # noqa +def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: None = None, dtype: DtypeArg | None = None) -> DataFrame: ... # noqa: E501, E704 @overload -def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: int = 1, dtype: DtypeArg | None = None) -> Iterator[DataFrame]: ... # noqa +def read_sql_query(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, chunksize: int = 1, dtype: DtypeArg | None = None) -> Iterator[DataFrame]: ... # noqa: E501, E704 # fmt: on @@ -403,9 +403,9 @@ def read_sql_query( # fmt: off @overload -def read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: None = None) -> DataFrame: ... # noqa +def read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: None = None) -> DataFrame: ... # noqa: E501, E704 @overload -def read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: int = 1) -> Iterator[DataFrame]: ... # noqa +def read_sql(sql, con, index_col=None, coerce_float=True, params=None, parse_dates=None, columns=None, chunksize: int = 1) -> Iterator[DataFrame]: ... # noqa: E501, E704 # fmt: on From 5a777301b89782e3ca3c6af350e686bc06f46d53 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 18:55:41 +0100 Subject: [PATCH 6/8] indent --- pandas/core/frame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index dacc687b090d8..30fbfbaef8418 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -4650,9 +4650,9 @@ def align( @overload def set_axis(self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa: E501, E704 @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E704 + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E501, E704 ................. @overload - def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # + def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa: E501, E704 .......................... @overload def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa: E501, E704 # fmt: on @@ -5000,7 +5000,7 @@ def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., i @overload def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E704 + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 ...... @overload def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload From d5dba3b459eacba4f7cb74df26ca6b2bfb23eb2f Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 18:59:15 +0100 Subject: [PATCH 7/8] link to yesqa issue --- pandas/core/frame.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 30fbfbaef8418..3f72752612237 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -4650,9 +4650,9 @@ def align( @overload def set_axis(self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> DataFrame: ... # noqa: E501, E704 @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E501, E704 ................. + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload - def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa: E501, E704 .......................... + def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def set_axis(self, labels, axis: Axis = ..., inplace: bool = ...) -> DataFrame | None: ... # noqa: E501, E704 # fmt: on @@ -5000,7 +5000,7 @@ def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., i @overload def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 ...... + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload From 3f4e908a0132ea6ed72477435bf225f48e43b4e0 Mon Sep 17 00:00:00 2001 From: Marco Gorelli Date: Fri, 16 Apr 2021 19:32:51 +0100 Subject: [PATCH 8/8] fixup yesqa/flake8 --- pandas/core/generic.py | 4 ++-- pandas/core/reshape/concat.py | 2 +- pandas/core/series.py | 10 +++++----- pandas/core/tools/datetimes.py | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index c0f44922513a9..923fdc2ddb46a 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -687,7 +687,7 @@ def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: Literal[Fal @overload def set_axis(self: FrameOrSeries, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E501, E704 @overload - def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: ... # noqa: E704 + def set_axis(self: FrameOrSeries, labels, *, inplace: Literal[True]) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def set_axis(self: FrameOrSeries, labels, axis: Axis = ..., inplace: bool_t = ...) -> FrameOrSeries | None: ... # noqa: E501, E704 # fmt: on @@ -7361,7 +7361,7 @@ def clip(self: FrameOrSeries, lower, upper, axis: Axis | None, inplace: Literal[ @overload def clip(self: FrameOrSeries, lower, upper, *, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 @overload - def clip(self: FrameOrSeries, *, inplace: Literal[True], **kwargs) -> None: ... # noqa: E704 + def clip(self: FrameOrSeries, *, inplace: Literal[True], **kwargs) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def clip(self: FrameOrSeries, lower=..., upper=..., axis: Axis | None = ..., inplace: bool_t = ..., *args, **kwargs) -> FrameOrSeries | None: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/core/reshape/concat.py b/pandas/core/reshape/concat.py index 8889f88ed8eab..7e852a0e1352d 100644 --- a/pandas/core/reshape/concat.py +++ b/pandas/core/reshape/concat.py @@ -56,7 +56,7 @@ @overload def concat(objs: Iterable[DataFrame] | Mapping[Hashable, DataFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> DataFrame: ... # noqa: E501, E704 @overload -def concat(objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> FrameOrSeriesUnion: ... # noqa: E501, E704 +def concat(objs: Iterable[NDFrame] | Mapping[Hashable, NDFrame], axis=0, join: str = "outer", ignore_index: bool = False, keys=None, levels=None, names=None, verify_integrity: bool = False, sort: bool = False, copy: bool = True) -> FrameOrSeriesUnion: ... # noqa: E501, E704 # fmt: on diff --git a/pandas/core/series.py b/pandas/core/series.py index 2e4d5184d26a0..cd72c78326d8b 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2011,13 +2011,13 @@ def unique(self) -> ArrayLike: # fmt: off @overload - def drop_duplicates(self, keep=..., inplace: Literal[False] = ...) -> Series: ... # noqa: E704 + def drop_duplicates(self, keep=..., inplace: Literal[False] = ...) -> Series: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def drop_duplicates(self, keep, inplace: Literal[True]) -> None: ... # noqa: E704 @overload def drop_duplicates(self, *, inplace: Literal[True]) -> None: ... # noqa: E704 @overload - def drop_duplicates(self, keep=..., inplace: bool = ...) -> Series | None: ... # noqa: E704 + def drop_duplicates(self, keep=..., inplace: bool = ...) -> Series | None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 # fmt: on def drop_duplicates(self, keep="first", inplace=False) -> Series | None: @@ -4416,9 +4416,9 @@ def rename( # fmt: off @overload - def set_axis( self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> Series: ... # noqa: E501, E704 + def set_axis(self, labels, axis: Axis = ..., inplace: Literal[False] = ...) -> Series: ... # noqa: E501, E704 @overload - def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E704 + def set_axis(self, labels, axis: Axis, inplace: Literal[True]) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def set_axis(self, labels, *, inplace: Literal[True]) -> None: ... # noqa: E704 @overload @@ -4575,7 +4575,7 @@ def fillna(self, value=..., method: str | None = ..., axis: Axis | None = ..., i @overload def fillna(self, value, method: str | None, axis: Axis | None, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload - def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E704 + def fillna(self, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 https://github.com/asottile/yesqa/issues/67 @overload def fillna(self, value, *, inplace: Literal[True], limit=..., downcast=...) -> None: ... # noqa: E501, E704 @overload diff --git a/pandas/core/tools/datetimes.py b/pandas/core/tools/datetimes.py index 77d3524577cbf..aaf981b5d00b8 100644 --- a/pandas/core/tools/datetimes.py +++ b/pandas/core/tools/datetimes.py @@ -641,7 +641,7 @@ def _adjust_to_origin(arg, origin, unit): @overload def to_datetime(arg: DatetimeScalar, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeScalar | NaTType: ... # noqa: E501, E704 @overload -def to_datetime(arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> Series: ... # noqa: E501, E704 +def to_datetime(arg: Series, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> Series: ... # noqa: E501, E704 @overload def to_datetime(arg: list | tuple | np.ndarray, errors: str = ..., dayfirst: bool = ..., yearfirst: bool = ..., utc: bool | None = ..., format: str | None = ..., exact: bool = ..., unit: str | None = ..., infer_datetime_format: bool = ..., origin=..., cache: bool = ...) -> DatetimeIndex: ... # noqa: E501, E704 # fmt: on