Skip to content

Add more parameter defaults #1318

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions pandas-stubs/_testing/__init__.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -115,19 +115,19 @@ def assert_extension_array_equal(
def assert_series_equal(
left: Series,
right: Series,
check_dtype: bool | Literal["equiv"] = ...,
check_index_type: bool | Literal["equiv"] = ...,
check_series_type: bool = ...,
check_names: bool = ...,
check_dtype: bool | Literal["equiv"] = True,
check_index_type: bool | Literal["equiv"] = "equiv",
check_series_type: bool = True,
check_names: bool = True,
check_exact: bool = ...,
check_datetimelike_compat: bool = ...,
check_categorical: bool = ...,
check_category_order: bool = ...,
check_freq: bool = ...,
check_flags: bool = ...,
check_datetimelike_compat: bool = False,
check_categorical: bool = True,
check_category_order: bool = True,
check_freq: bool = True,
check_flags: bool = True,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
obj: str = "Series",
*,
check_index: Literal[False],
check_like: Literal[False] = ...,
Expand All @@ -136,19 +136,19 @@ def assert_series_equal(
def assert_series_equal(
left: Series,
right: Series,
check_dtype: bool | Literal["equiv"] = ...,
check_index_type: bool | Literal["equiv"] = ...,
check_series_type: bool = ...,
check_names: bool = ...,
check_dtype: bool | Literal["equiv"] = True,
check_index_type: bool | Literal["equiv"] = "equiv",
check_series_type: bool = True,
check_names: bool = True,
check_exact: bool = ...,
check_datetimelike_compat: bool = ...,
check_categorical: bool = ...,
check_category_order: bool = ...,
check_freq: bool = ...,
check_flags: bool = ...,
check_datetimelike_compat: bool = False,
check_categorical: bool = True,
check_category_order: bool = True,
check_freq: bool = True,
check_flags: bool = True,
rtol: float = ...,
atol: float = ...,
obj: str = ...,
obj: str = "Series",
*,
check_index: Literal[True] = ...,
check_like: bool = ...,
Expand Down
18 changes: 9 additions & 9 deletions pandas-stubs/core/algorithms.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ def unique(values: ExtensionArray) -> ExtensionArray: ...
@overload
def factorize(
values: np.ndarray,
sort: bool = ...,
use_na_sentinel: bool = ...,
size_hint: int | None = ...,
sort: bool = False,
use_na_sentinel: bool = True,
size_hint: int | None = None,
) -> tuple[np.ndarray, np.ndarray]: ...
@overload
def factorize(
values: Index | Series,
sort: bool = ...,
use_na_sentinel: bool = ...,
size_hint: int | None = ...,
sort: bool = False,
use_na_sentinel: bool = True,
size_hint: int | None = None,
) -> tuple[np.ndarray, Index]: ...
@overload
def factorize(
values: Categorical,
sort: bool = ...,
use_na_sentinel: bool = ...,
size_hint: int | None = ...,
sort: bool = False,
use_na_sentinel: bool = True,
size_hint: int | None = None,
) -> tuple[np.ndarray, Categorical]: ...
def value_counts(
values: AnyArrayLike | list | tuple,
Expand Down
2 changes: 1 addition & 1 deletion pandas-stubs/core/computation/eval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ from pandas._typing import (
def eval(
expr: str | BinOp,
parser: Literal["pandas", "python"] = "pandas",
engine: Literal["python", "numexpr"] | None = ...,
engine: Literal["python", "numexpr"] | None = None,
local_dict: dict[str, Any] | None = None,
global_dict: dict[str, Any] | None = None,
resolvers: list[Mapping] | None = ...,
Expand Down
62 changes: 31 additions & 31 deletions pandas-stubs/core/groupby/generic.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -308,49 +308,49 @@ class DataFrameGroupBy(GroupBy[DataFrame], Generic[ByT, _TT]):
@overload
def boxplot(
self,
subplots: Literal[True] = ...,
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
ax: PlotAxes | None = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
backend: str | None = ...,
subplots: Literal[True] = True,
column: IndexLabel | None = None,
fontsize: float | str | None = None,
rot: float = 0,
grid: bool = True,
ax: PlotAxes | None = None,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
sharex: bool = False,
sharey: bool = True,
backend: str | None = None,
**kwargs,
) -> Series: ... # Series[PlotAxes] but this is not allowed
@overload
def boxplot(
self,
subplots: Literal[False],
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
ax: PlotAxes | None = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
backend: str | None = ...,
column: IndexLabel | None = None,
fontsize: float | str | None = None,
rot: float = 0,
grid: bool = True,
ax: PlotAxes | None = None,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
sharex: bool = False,
sharey: bool = True,
backend: str | None = None,
**kwargs,
) -> PlotAxes: ...
@overload
def boxplot(
self,
subplots: bool,
column: IndexLabel | None = ...,
fontsize: float | str | None = ...,
rot: float = ...,
grid: bool = ...,
ax: PlotAxes | None = ...,
figsize: tuple[float, float] | None = ...,
layout: tuple[int, int] | None = ...,
sharex: bool = ...,
sharey: bool = ...,
backend: str | None = ...,
column: IndexLabel | None = None,
fontsize: float | str | None = None,
rot: float = 0,
grid: bool = True,
ax: PlotAxes | None = None,
figsize: tuple[float, float] | None = None,
layout: tuple[int, int] | None = None,
sharex: bool = False,
sharey: bool = True,
backend: str | None = None,
**kwargs,
) -> PlotAxes | Series: ... # Series[PlotAxes]
@overload
Expand Down
26 changes: 13 additions & 13 deletions pandas-stubs/core/indexes/datetimes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,22 @@ def date_range(
) -> DatetimeIndex: ...
@overload
def bdate_range(
start: str | DateAndDatetimeLike | None = ...,
end: str | DateAndDatetimeLike | None = ...,
periods: int | None = ...,
freq: str | timedelta | Timedelta | BaseOffset = ...,
tz: TimeZones = ...,
normalize: bool = ...,
name: Hashable | None = ...,
weekmask: str | None = ...,
holidays: None = ...,
inclusive: IntervalClosedType = ...,
start: str | DateAndDatetimeLike | None = None,
end: str | DateAndDatetimeLike | None = None,
periods: int | None = None,
freq: str | timedelta | Timedelta | BaseOffset = "B",
tz: TimeZones = None,
normalize: bool = True,
name: Hashable | None = None,
weekmask: str | None = None,
holidays: None = None,
inclusive: IntervalClosedType = "both",
) -> DatetimeIndex: ...
@overload
def bdate_range(
start: str | DateAndDatetimeLike | None = ...,
end: str | DateAndDatetimeLike | None = ...,
periods: int | None = ...,
start: str | DateAndDatetimeLike | None = None,
end: str | DateAndDatetimeLike | None = None,
periods: int | None = None,
*,
freq: str | timedelta | Timedelta | BaseOffset,
tz: TimeZones = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

shouldn't you add defaults for the ones with ... in them above?

Expand Down
44 changes: 22 additions & 22 deletions pandas-stubs/core/indexes/interval.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -310,30 +310,30 @@ class IntervalIndex(ExtensionIndex[IntervalT], IntervalMixin):
# int gets hit first and so the correct type is returned
@overload
def interval_range( # pyright: ignore[reportOverlappingOverload]
start: int | None = ...,
end: int | None = ...,
periods: int | None = ...,
freq: int | None = ...,
name: Hashable = ...,
closed: IntervalClosedType = ...,
start: int | None = None,
end: int | None = None,
periods: int | None = None,
freq: int | None = None,
name: Hashable = None,
closed: IntervalClosedType = "right",
) -> IntervalIndex[Interval[int]]: ...
@overload
def interval_range(
start: float | None = ...,
end: float | None = ...,
periods: int | None = ...,
freq: int | None = ...,
name: Hashable = ...,
closed: IntervalClosedType = ...,
start: float | None = None,
end: float | None = None,
periods: int | None = None,
freq: int | None = None,
name: Hashable = None,
closed: IntervalClosedType = "right",
) -> IntervalIndex[Interval[float]]: ...
@overload
def interval_range(
start: _TimestampLike,
end: _TimestampLike | None = ...,
periods: int | None = ...,
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ...,
name: Hashable = ...,
closed: IntervalClosedType = ...,
end: _TimestampLike | None = None,
periods: int | None = None,
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = None,
name: Hashable = None,
closed: IntervalClosedType = "right",
) -> IntervalIndex[Interval[pd.Timestamp]]: ...
@overload
def interval_range(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing some defaults here

Expand All @@ -348,11 +348,11 @@ def interval_range(
@overload
Copy link
Collaborator

Choose a reason for hiding this comment

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

Missing some defaults in lines 341 to 346

def interval_range(
start: _TimedeltaLike,
end: _TimedeltaLike | None = ...,
periods: int | None = ...,
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = ...,
name: Hashable = ...,
closed: IntervalClosedType = ...,
end: _TimedeltaLike | None = None,
periods: int | None = None,
freq: str | BaseOffset | pd.Timedelta | dt.timedelta | None = None,
name: Hashable = None,
closed: IntervalClosedType = "right",
) -> IntervalIndex[Interval[pd.Timedelta]]: ...
@overload
def interval_range(
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing defaults in the parameters below

Expand Down
42 changes: 21 additions & 21 deletions pandas-stubs/core/reshape/merge.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,42 @@ def merge(
def merge_ordered(
left: DataFrame,
right: DataFrame,
on: Label | list[HashableT] | None = ...,
left_on: Label | list[HashableT] | None = ...,
right_on: Label | list[HashableT] | None = ...,
left_by: Label | list[HashableT] | None = ...,
right_by: Label | list[HashableT] | None = ...,
fill_method: Literal["ffill"] | None = ...,
on: Label | list[HashableT] | None = None,
left_on: Label | list[HashableT] | None = None,
right_on: Label | list[HashableT] | None = None,
left_by: Label | list[HashableT] | None = None,
right_by: Label | list[HashableT] | None = None,
fill_method: Literal["ffill"] | None = None,
suffixes: Suffixes = ...,
Comment on lines +46 to 47
Copy link
Collaborator

Choose a reason for hiding this comment

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

suffixes has a default of ("_x", "_y")

how: JoinHow = ...,
how: JoinHow = "outer",
) -> DataFrame: ...
@overload
def merge_ordered(
left: Series,
right: DataFrame | Series,
on: Label | list[HashableT] | None = ...,
left_on: Label | list[HashableT] | None = ...,
right_on: Label | list[HashableT] | None = ...,
left_by: None = ...,
right_by: None = ...,
fill_method: Literal["ffill"] | None = ...,
on: Label | list[HashableT] | None = None,
left_on: Label | list[HashableT] | None = None,
right_on: Label | list[HashableT] | None = None,
left_by: None = None,
right_by: None = None,
fill_method: Literal["ffill"] | None = None,
suffixes: (
list[str | None] | tuple[str, str] | tuple[None, str] | tuple[str, None]
) = ...,
Comment on lines 60 to 62
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be suffixes: Suffixes = ("_x", "_y")

how: JoinHow = ...,
how: JoinHow = "outer",
) -> DataFrame: ...
@overload
def merge_ordered(
left: DataFrame | Series,
right: Series,
on: Label | list[HashableT] | None = ...,
left_on: Label | list[HashableT] | None = ...,
right_on: Label | list[HashableT] | None = ...,
left_by: None = ...,
right_by: None = ...,
fill_method: Literal["ffill"] | None = ...,
on: Label | list[HashableT] | None = None,
left_on: Label | list[HashableT] | None = None,
right_on: Label | list[HashableT] | None = None,
left_by: None = None,
right_by: None = None,
fill_method: Literal["ffill"] | None = None,
suffixes: Suffixes = ...,
Copy link
Collaborator

Choose a reason for hiding this comment

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

needs default

how: JoinHow = ...,
how: JoinHow = "outer",
) -> DataFrame: ...
def merge_asof(
left: DataFrame | Series,
Expand Down
Loading
Loading