Skip to content

Commit e66384f

Browse files
committed
add more defaults
1 parent 9617ee6 commit e66384f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+617
-615
lines changed

pandas-stubs/_libs/lib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,10 @@ class _NoDefault(Enum):
1616
no_default: Final = _NoDefault.no_default
1717
_NoDefaultDoNotUse: TypeAlias = Literal[_NoDefault.no_default] # noqa: PYI047
1818

19-
def infer_dtype(value: object, skipna: bool = ...) -> str: ...
19+
def infer_dtype(value: object, skipna: bool = True) -> str: ...
2020
def is_iterator(obj: object) -> bool: ...
2121
def is_scalar(val: object) -> bool: ...
22-
def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ...
22+
def is_list_like(obj: object, allow_sets: bool = True) -> bool: ...
2323
def is_complex(val: object) -> TypeGuard[complex]: ...
2424
def is_bool(val: object) -> TypeGuard[bool | np.bool_]: ...
2525
def is_integer(val: object) -> TypeGuard[int | np.integer]: ...

pandas-stubs/_libs/tslibs/nattype.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,27 +81,27 @@ class NaTType:
8181
def round(
8282
self,
8383
freq: Frequency,
84-
ambiguous: bool | Literal["raise"] | NaTType = ...,
85-
nonexistent: TimestampNonexistent = ...,
84+
ambiguous: bool | Literal["raise"] | NaTType = "raise",
85+
nonexistent: TimestampNonexistent = "raise",
8686
) -> NaTType: ...
8787
def floor(
8888
self,
8989
freq: Frequency,
90-
ambiguous: bool | Literal["raise"] | NaTType = ...,
91-
nonexistent: TimestampNonexistent = ...,
90+
ambiguous: bool | Literal["raise"] | NaTType = "raise",
91+
nonexistent: TimestampNonexistent = "raise",
9292
) -> NaTType: ...
9393
def ceil(
9494
self,
9595
freq: Frequency,
96-
ambiguous: bool | Literal["raise"] | NaTType = ...,
97-
nonexistent: TimestampNonexistent = ...,
96+
ambiguous: bool | Literal["raise"] | NaTType = "raise",
97+
nonexistent: TimestampNonexistent = "raise",
9898
) -> NaTType: ...
9999
def tz_convert(self) -> NaTType: ...
100100
def tz_localize(
101101
self,
102102
tz: _tzinfo | str | None,
103-
ambiguous: bool | Literal["raise"] | NaTType = ...,
104-
nonexistent: TimestampNonexistent = ...,
103+
ambiguous: bool | Literal["raise"] | NaTType = "raise",
104+
nonexistent: TimestampNonexistent = "raise",
105105
) -> NaTType: ...
106106
def replace(
107107
self,
@@ -154,4 +154,4 @@ class NaTType:
154154
__ge__: _NatComparison
155155
@property
156156
def unit(self) -> TimeUnit: ...
157-
def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ...
157+
def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ...

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,12 @@ class Period(PeriodMixin):
197197
def day_of_year(self) -> int: ...
198198
@property
199199
def day_of_week(self) -> int: ...
200-
def asfreq(self, freq: str | BaseOffset, how: _PeriodFreqHow = ...) -> Period: ...
200+
def asfreq(self, freq: str | BaseOffset, how: _PeriodFreqHow = "end") -> Period: ...
201201
@classmethod
202202
def now(cls, freq: str | BaseOffset = ...) -> Period: ...
203203
def strftime(self, fmt: str) -> str: ...
204204
def to_timestamp(
205205
self,
206206
freq: str | BaseOffset | None = ...,
207-
how: _PeriodToTimestampHow = ...,
207+
how: _PeriodToTimestampHow = "S",
208208
) -> Timestamp: ...

pandas-stubs/_libs/tslibs/timedeltas.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,4 +388,4 @@ class Timedelta(timedelta):
388388
def view(self, dtype: npt.DTypeLike = ...) -> object: ...
389389
@property
390390
def unit(self) -> TimeUnit: ...
391-
def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ...
391+
def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ...

pandas-stubs/_libs/tslibs/timestamps.pyi

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ class Timestamp(datetime, SupportsIndex):
157157
) -> Timestamp: ...
158158
def astimezone(self, tz: _tzinfo | None = ...) -> Self: ...
159159
def ctime(self) -> str: ...
160-
def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
160+
def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ...
161161
@classmethod
162162
def strptime(cls, date_string: Never, format: Never) -> Never: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
163163
def utcoffset(self) -> timedelta | None: ...
@@ -276,28 +276,28 @@ class Timestamp(datetime, SupportsIndex):
276276
def tz_localize(
277277
self,
278278
tz: TimeZones,
279-
ambiguous: _Ambiguous = ...,
280-
nonexistent: TimestampNonexistent = ...,
279+
ambiguous: _Ambiguous = "raise",
280+
nonexistent: TimestampNonexistent = "raise",
281281
) -> Self: ...
282282
def normalize(self) -> Self: ...
283283
# TODO: round/floor/ceil could return NaT?
284284
def round(
285285
self,
286286
freq: str,
287-
ambiguous: _Ambiguous = ...,
288-
nonexistent: TimestampNonexistent = ...,
287+
ambiguous: _Ambiguous = "raise",
288+
nonexistent: TimestampNonexistent = "raise",
289289
) -> Self: ...
290290
def floor(
291291
self,
292292
freq: str,
293-
ambiguous: _Ambiguous = ...,
294-
nonexistent: TimestampNonexistent = ...,
293+
ambiguous: _Ambiguous = "raise",
294+
nonexistent: TimestampNonexistent = "raise",
295295
) -> Self: ...
296296
def ceil(
297297
self,
298298
freq: str,
299-
ambiguous: _Ambiguous = ...,
300-
nonexistent: TimestampNonexistent = ...,
299+
ambiguous: _Ambiguous = "raise",
300+
nonexistent: TimestampNonexistent = "raise",
301301
) -> Self: ...
302302
def day_name(self, locale: str | None = None) -> str: ...
303303
def month_name(self, locale: str | None = None) -> str: ...
@@ -322,6 +322,6 @@ class Timestamp(datetime, SupportsIndex):
322322
def daysinmonth(self) -> int: ...
323323
@property
324324
def unit(self) -> TimeUnit: ...
325-
def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Self: ...
325+
def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ...
326326
# To support slicing
327327
def __index__(self) -> int: ...

pandas-stubs/_testing/__init__.pyi

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -36,29 +36,29 @@ from pandas._typing import (
3636
def assert_almost_equal(
3737
left: T,
3838
right: T,
39-
check_dtype: bool | Literal["equiv"] = ...,
40-
rtol: float = ...,
41-
atol: float = ...,
39+
check_dtype: bool | Literal["equiv"] = "equiv",
40+
rtol: float = 1e-5,
41+
atol: float = 1e-8,
4242
**kwargs,
4343
) -> None: ...
4444
def assert_dict_equal(left: dict, right: dict, compare_keys: bool = ...) -> None: ...
4545
def assert_index_equal(
4646
left: Index,
4747
right: Index,
48-
exact: bool | Literal["equiv"] = ...,
49-
check_names: bool = ...,
50-
check_exact: bool = ...,
51-
check_categorical: bool = ...,
52-
check_order: bool = ...,
53-
rtol: float = ...,
54-
atol: float = ...,
55-
obj: str = ...,
48+
exact: bool | Literal["equiv"] = "equiv",
49+
check_names: bool = True,
50+
check_exact: bool = True,
51+
check_categorical: bool = True,
52+
check_order: bool = True,
53+
rtol: float = 1e-5,
54+
atol: float = 1e-8,
55+
obj: str = "Index",
5656
) -> None: ...
5757
def assert_class_equal(
5858
left: T, right: T, exact: bool | Literal["equiv"] = ..., obj: str = ...
5959
) -> None: ...
6060
def assert_attr_equal(
61-
attr: str, left: object, right: object, obj: str = ...
61+
attr: str, left: object, right: object, obj: str = "Attributes"
6262
) -> None: ...
6363
def assert_is_valid_plot_return_object(
6464
objs: Series | np.ndarray | Artist | tuple | dict,
@@ -67,15 +67,15 @@ def assert_is_sorted(seq: AnyArrayLike) -> None: ...
6767
def assert_categorical_equal(
6868
left: Categorical,
6969
right: Categorical,
70-
check_dtype: bool = ...,
71-
check_category_order: bool = ...,
72-
obj: str = ...,
70+
check_dtype: bool = True,
71+
check_category_order: bool = True,
72+
obj: str = "Categorical",
7373
) -> None: ...
7474
def assert_interval_array_equal(
7575
left: IntervalArray,
7676
right: IntervalArray,
77-
exact: bool | Literal["equiv"] = ...,
78-
obj: str = ...,
77+
exact: bool | Literal["equiv"] = "equiv",
78+
obj: str = "IntervalArray",
7979
) -> None: ...
8080
def assert_period_array_equal(
8181
left: PeriodArray, right: PeriodArray, obj: str = ...
@@ -89,22 +89,22 @@ def assert_timedelta_array_equal(
8989
def assert_numpy_array_equal(
9090
left,
9191
right,
92-
strict_nan: bool = ...,
93-
check_dtype: bool | Literal["equiv"] = ...,
92+
strict_nan: bool = False,
93+
check_dtype: bool | Literal["equiv"] = True,
9494
err_msg: str | None = None,
9595
check_same: Literal["copy", "same"] | None = None,
96-
obj: str = ...,
96+
obj: str = "numpy array",
9797
index_values: Index | np.ndarray | None = None,
9898
) -> None: ...
9999
def assert_extension_array_equal(
100100
left: ExtensionArray,
101101
right: ExtensionArray,
102-
check_dtype: bool | Literal["equiv"] = ...,
102+
check_dtype: bool | Literal["equiv"] = True,
103103
index_values: Index | np.ndarray | None = None,
104-
check_exact: bool = ...,
105-
rtol: float = ...,
106-
atol: float = ...,
107-
obj: str = ...,
104+
check_exact: bool = False,
105+
rtol: float = 1e-5,
106+
atol: float = 1e-8,
107+
obj: str = "ExtensionArray",
108108
) -> None: ...
109109
@overload
110110
def assert_series_equal(
@@ -151,21 +151,21 @@ def assert_series_equal(
151151
def assert_frame_equal(
152152
left: DataFrame,
153153
right: DataFrame,
154-
check_dtype: bool | Literal["equiv"] = ...,
155-
check_index_type: bool | Literal["equiv"] = ...,
156-
check_column_type: bool | Literal["equiv"] = ...,
157-
check_frame_type: bool = ...,
158-
check_names: bool = ...,
159-
by_blocks: bool = ...,
160-
check_exact: bool = ...,
161-
check_datetimelike_compat: bool = ...,
162-
check_categorical: bool = ...,
163-
check_like: bool = ...,
164-
check_freq: bool = ...,
165-
check_flags: bool = ...,
166-
rtol: float = ...,
167-
atol: float = ...,
168-
obj: str = ...,
154+
check_dtype: bool | Literal["equiv"] = True,
155+
check_index_type: bool | Literal["equiv"] = "equiv",
156+
check_column_type: bool | Literal["equiv"] = "equiv",
157+
check_frame_type: bool = True,
158+
check_names: bool = True,
159+
by_blocks: bool = False,
160+
check_exact: bool = False,
161+
check_datetimelike_compat: bool = False,
162+
check_categorical: bool = True,
163+
check_like: bool = False,
164+
check_freq: bool = True,
165+
check_flags: bool = True,
166+
rtol: float = 1e-5,
167+
atol: float = 1e-8,
168+
obj: str = "DataFrame",
169169
) -> None: ...
170170
def assert_equal(left, right, **kwargs) -> None: ...
171171
def assert_sp_array_equal(left: SparseArray, right: SparseArray) -> None: ...
@@ -178,12 +178,12 @@ def assert_produces_warning(
178178
) = ...,
179179
filter_level: Literal[
180180
"error", "ignore", "always", "default", "module", "once"
181-
] = ...,
182-
check_stacklevel: bool = ...,
183-
raise_on_extra_warnings: bool = ...,
181+
] = "always",
182+
check_stacklevel: bool = True,
183+
raise_on_extra_warnings: bool = True,
184184
match: str | None = None,
185185
) -> Generator[list[warnings.WarningMessage], None, None]: ...
186186
@contextmanager
187187
def ensure_clean(
188-
filename: str | None = ..., return_filelike: bool = ..., **kwargs: Any
188+
filename: str | None = ..., return_filelike: bool = False, **kwargs: Any
189189
) -> Generator[str, None, None]: ...

pandas-stubs/core/algorithms.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ def factorize(
6464
) -> tuple[np.ndarray, Categorical]: ...
6565
def value_counts(
6666
values: AnyArrayLike | list | tuple,
67-
sort: bool = ...,
68-
ascending: bool = ...,
69-
normalize: bool = ...,
67+
sort: bool = True,
68+
ascending: bool = False,
69+
normalize: bool = False,
7070
bins: int | None = ...,
71-
dropna: bool = ...,
71+
dropna: bool = True,
7272
) -> Series: ...
7373
def take(
7474
arr,

pandas-stubs/core/arrays/base.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ExtensionArray:
2929
def to_numpy(
3030
self,
3131
dtype: npt.DTypeLike | None = ...,
32-
copy: bool = ...,
32+
copy: bool = False,
3333
na_value: Scalar = ...,
3434
) -> np.ndarray: ...
3535
@property
@@ -40,17 +40,17 @@ class ExtensionArray:
4040
def ndim(self) -> int: ...
4141
@property
4242
def nbytes(self) -> int: ...
43-
def astype(self, dtype, copy: bool = ...): ...
43+
def astype(self, dtype, copy: bool = True): ...
4444
def isna(self) -> ArrayLike: ...
4545
def argsort(
4646
self, *, ascending: bool = ..., kind: str = ..., **kwargs
4747
) -> np.ndarray: ...
4848
def fillna(self, value=..., method=None, limit=None): ...
4949
def dropna(self): ...
50-
def shift(self, periods: int = ..., fill_value: object = ...) -> Self: ...
50+
def shift(self, periods: int = 1, fill_value: object = ...) -> Self: ...
5151
def unique(self): ...
5252
def searchsorted(self, value, side: str = ..., sorter=...): ...
53-
def factorize(self, use_na_sentinel: bool = ...) -> tuple[np.ndarray, Self]: ...
53+
def factorize(self, use_na_sentinel: bool = True) -> tuple[np.ndarray, Self]: ...
5454
def repeat(self, repeats, axis=...): ...
5555
def take(
5656
self,
@@ -61,7 +61,7 @@ class ExtensionArray:
6161
) -> Self: ...
6262
def copy(self) -> Self: ...
6363
def view(self, dtype=...) -> Self | np.ndarray: ...
64-
def ravel(self, order=...) -> Self: ...
64+
def ravel(self, order="C") -> Self: ...
6565
def tolist(self) -> list: ...
6666
def _reduce(
6767
self, name: str, *, skipna: bool = ..., keepdims: bool = ..., **kwargs

pandas-stubs/core/arrays/boolean.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ class BooleanArray(BaseMaskedArray):
2020
def dtype(self): ...
2121
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ...
2222
def __setitem__(self, key, value) -> None: ...
23-
def astype(self, dtype, copy: bool = ...): ...
23+
def astype(self, dtype, copy: bool = True): ...
2424
def any(self, *, skipna: bool = ..., **kwargs): ...
2525
def all(self, *, skipna: bool = ..., **kwargs): ...

pandas-stubs/core/arrays/categorical.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ class Categorical(ExtensionArray):
4949
def ordered(self) -> Ordered: ...
5050
@property
5151
def dtype(self) -> CategoricalDtype: ...
52-
def astype(self, dtype: Dtype, copy: bool = ...) -> ArrayLike: ...
52+
def astype(self, dtype: Dtype, copy: bool = True) -> ArrayLike: ...
5353
def size(self) -> int: ...
5454
def tolist(self) -> list[Scalar]: ...
5555
to_list = ...
@@ -70,8 +70,8 @@ class Categorical(ExtensionArray):
7070
def set_categories(
7171
self,
7272
new_categories,
73-
ordered: bool | None = ...,
74-
rename: bool = ...,
73+
ordered: bool | None = False,
74+
rename: bool = False,
7575
) -> Categorical: ...
7676
def rename_categories(self, new_categories) -> Categorical: ...
7777
def reorder_categories(
@@ -89,7 +89,7 @@ class Categorical(ExtensionArray):
8989
def __ge__(self, other) -> bool: ...
9090
@property
9191
def shape(self): ...
92-
def shift(self, periods=..., fill_value=...): ...
92+
def shift(self, periods=1, fill_value=...): ...
9393
def __array__(self, dtype=...) -> np.ndarray: ...
9494
def __array_ufunc__(self, ufunc, method, *inputs, **kwargs): ...
9595
@property
@@ -103,7 +103,7 @@ class Categorical(ExtensionArray):
103103
def notna(self) -> np_ndarray_bool: ...
104104
def notnull(self) -> np_ndarray_bool: ...
105105
def dropna(self): ...
106-
def value_counts(self, dropna: bool = ...): ...
106+
def value_counts(self, dropna: bool = True): ...
107107
def check_for_ordered(self, op) -> None: ...
108108
def argsort(self, *, ascending: bool = ..., kind: str = ..., **kwargs): ...
109109
def sort_values(
@@ -155,8 +155,8 @@ class CategoricalAccessor(PandasDelegate, NoNewAttributesMixin):
155155
def set_categories(
156156
self,
157157
new_categories: ListLike,
158-
ordered: bool | None = ...,
159-
rename: bool = ...,
158+
ordered: bool | None = False,
159+
rename: bool = False,
160160
) -> Series: ...
161161
def as_ordered(self) -> Series: ...
162162
def as_unordered(self) -> Series: ...

0 commit comments

Comments
 (0)