8000 TYP: return values in core/*.py by twoertwein · Pull Request #47587 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

TYP: return values in core/*.py #47587

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

Merged
merged 14 commits into from
Jul 6, 2022
Prev Previous commit
Next Next commit
more overloads
  • Loading branch information
twoertwein committed Jul 4, 2022
commit ef4f674925a855b54b7e7c370c6e75d2f247c8f3
130 changes: 112 additions & 18 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -2791,6 +2791,32 @@ def to_markdown(
handles.handle.write(result)
return None

@overload
def to_parquet(
self,
path: None = ...,
engine: str = ...,
compression: str | None = ...,
index: bool | None = ...,
partition_cols: list[str] | None = ...,
storage_options: StorageOptions = ...,
**kwargs,
) -> bytes:
...

@overload
def to_parquet(
self,
path: FilePath | WriteBuffer[bytes],
engine: str = ...,
compression: str | None = ...,
index: bool | None = ...,
partition_cols: list[str] | None = ...,
storage_options: StorageOptions = ...,
**kwargs,
) -> None:
...

@doc(storage_options=_shared_docs["storage_options"])
@deprecate_kwarg(old_arg_name="fname", new_arg_name="path")
def to_parquet(
Expand Down Expand Up @@ -5055,11 +5081,11 @@ def reindex(self, *args, **kwargs) -> DataFrame:
@overload
def drop(
self,
labels: Hashable | list[Hashable] = ...,
labels: IndexLabel = ...,
*,
axis: Axis = ...,
index: Hashable | list[Hashable] = ...,
columns: Hashable | list[Hashable] = ...,
index: IndexLabel = ...,
columns: IndexLabel = ...,
level: Level | None = ...,
inplace: Literal[True],
errors: IgnoreRaise = ...,
Expand All @@ -5069,11 +5095,11 @@ def drop(
@overload
def drop(
self,
labels: Hashable | list[Hashable] = ...,
labels: IndexLabel = ...,
*,
axis: Axis = ...,
index: Hashable | list[Hashable] = ...,
columns: Hashable | list[Hashable] = ...,
8000 index: IndexLabel = ...,
columns: IndexLabel = ...,
level: Level | None = ...,
inplace: Literal[False] = ...,
errors: IgnoreRaise = ...,
Expand All @@ -5083,11 +5109,11 @@ def drop(
@overload
def drop(
self,
labels: Hashable | list[Hashable] = ...,
labels: IndexLabel = ...,
*,
axis: Axis = ...,
index: Hashable | list[Hashable] = ...,
columns: Hashable | list[Hashable] = ...,
index: IndexLabel = ...,
columns: IndexLabel = ...,
level: Level | None = ...,
inplace: bool = ...,
errors: IgnoreRaise = ...,
Expand All @@ -5099,10 +5125,10 @@ def drop(
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self", "labels"])
def drop( # type: ignore[override]
self,
labels: Hashable | list[Hashable] = None,
labels: IndexLabel = None,
axis: Axis = 0,
index: Hashable | list[Hashable] = None,
columns: Hashable | list[Hashable] = None,
index: IndexLabel = None,
columns: IndexLabel = None,
level: Level | None = None,
inplace: bool = False,
errors: IgnoreRaise = "raise",
Expand Down Expand Up @@ -11585,25 +11611,93 @@ def values(self) -> np.ndarray:
self._consolidate_inplace()
return self._mgr.as_array()

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
@overload
def ffill(
self: DataFrame,
self,
*,
axis: None | Axis = ...,
inplace: Literal[False] = ...,
limit: None | int = ...,
downcast=...,
) -> DataFrame:
...

@overload
def ffill(
self,
*,
axis: None | Axis = ...,
inplace: Literal[True],
limit: None | int = ...,
downcast=...,
) -> None:
...

@overload
def ffill(
self,
*,
axis: None | Axis = ...,
inplace: bool = ...,
limit: None | int = ...,
downcast=...,
) -> DataFrame | None:
...

# error: Signature of "ffill" incompatible with supertype "NDFrame"
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def ffill( # type: ignore[override]
self,
axis: None | Axis = None,
inplace: bool = False,
limit: None | int = None,
downcast=None,
) -> DataFrame | None:
return super().ffill(axis, inplace, limit, downcast)
return super().ffill(axis=axis, inplace=inplace, limit=limit, downcast=downcast)

@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
@overload
def bfill(
self: DataFrame,
self,
*,
axis: None | Axis = ...,
inplace: Literal[False] = ...,
limit: None | int = ...,
downcast=...,
) -> DataFrame:
...

@overload
def bfill(
self,
*,
axis: None | Axis = ...,
inplace: Literal[True],
limit: None | int = ...,
downcast=...,
) -> None:
...

@overload
def bfill(
self,
*,
axis: None | Axis = ...,
inplace: bool = ...,
limit: None | int = ...,
downcast=...,
) -> DataFrame | None:
...

# error: Signature of "bfill" incompatible with supertype "NDFrame"
@deprecate_nonkeyword_arguments(version=None, allowed_args=["self"])
def bfill( # type: ignore[override]
self,
axis: None | Axis = None,
inplace: bool = False,
limit: None | int = None,
downcast=None,
) -> DataFrame | None:
return super().bfill(axis, inplace, limit, downcast)
return super().bfill(axis=axis, inplace=inplace, limit=limit, downcast=downcast)

@deprecate_nonkeyword_arguments(
version=None, allowed_args=["self", "lower", "upper"]
Expand Down
Loading
0