Skip to content

STYLE, TYP Turn black formatter off for overloads #40973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
4 changes: 0 additions & 4 deletions .pep8speaks.yml

This file was deleted.

22 changes: 4 additions & 18 deletions pandas/core/array_algos/take.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the noqa be made specific, i think # noqa:F501,E704

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, thanks!

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(
Expand Down
17 changes: 6 additions & 11 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
24 changes: 8 additions & 16 deletions pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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(
Expand Down
Loading