Skip to content

Commit 7dad4e7

Browse files
TYP: misc (#47509)
* TYP: misc * Update pandas/core/generic.py Co-authored-by: Matthew Roeschke <emailformattr@gmail.com> * None errors Co-authored-by: Matthew Roeschke <emailformattr@gmail.com>
1 parent e48c9c3 commit 7dad4e7

File tree

7 files changed

+14
-9
lines changed

7 files changed

+14
-9
lines changed

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5545,7 +5545,7 @@ def replace(
55455545
inplace: bool = False,
55465546
limit=None,
55475547
regex: bool = False,
5548-
method: str | lib.NoDefault = lib.no_default,
5548+
method: Literal["pad", "ffill", "bfill"] | lib.NoDefault = lib.no_default,
55495549
):
55505550
return super().replace(
55515551
to_replace=to_replace,

pandas/core/generic.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6608,7 +6608,7 @@ def replace(
66086608
inplace: bool_t = False,
66096609
limit: int | None = None,
66106610
regex=False,
6611-
method=lib.no_default,
6611+
method: Literal["pad", "ffill", "bfill"] | lib.NoDefault = lib.no_default,
66126612
):
66136613
if not (
66146614
is_scalar(to_replace)

pandas/core/indexes/multi.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2643,7 +2643,10 @@ def _get_indexer_level_0(self, target) -> npt.NDArray[np.intp]:
26432643
return ci.get_indexer_for(target)
26442644

26452645
def get_slice_bound(
2646-
self, label: Hashable | Sequence[Hashable], side: str, kind=lib.no_default
2646+
self,
2647+
label: Hashable | Sequence[Hashable],
2648+
side: Literal["left", "right"],
2649+
kind=lib.no_default,
26472650
) -> int:
26482651
"""
26492652
For an ordered MultiIndex, compute slice bound
@@ -2758,7 +2761,7 @@ def slice_locs(
27582761
# happens in get_slice_bound method), but it adds meaningful doc.
27592762
return super().slice_locs(start, end, step)
27602763

2761-
def _partial_tup_index(self, tup: tuple, side="left"):
2764+
def _partial_tup_index(self, tup: tuple, side: Literal["left", "right"] = "left"):
27622765
if len(tup) > self._lexsort_depth:
27632766
raise UnsortedIndexError(
27642767
f"Key length ({len(tup)}) was greater than MultiIndex lexsort depth "

pandas/core/series.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5204,7 +5204,7 @@ def replace(
52045204
inplace=False,
52055205
limit=None,
52065206
regex=False,
5207-
method: str | lib.NoDefault = lib.no_default,
5207+
method: Literal["pad", "ffill", "bfill"] | lib.NoDefault = lib.no_default,
52085208
):
52095209
return super().replace(
52105210
to_replace=to_replace,

pandas/core/shared_docs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@
541541
string. Alternatively, this could be a regular expression or a
542542
list, dict, or array of regular expressions in which case
543543
`to_replace` must be ``None``.
544-
method : {{'pad', 'ffill', 'bfill', `None`}}
544+
method : {{'pad', 'ffill', 'bfill'}}
545545
The method to use when for replacement, when `to_replace` is a
546546
scalar, list or tuple and `value` is ``None``.
547547

pandas/core/window/expanding.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from pandas._typing import (
1111
Axis,
12+
QuantileInterpolation,
1213
WindowingRankType,
1314
)
1415

@@ -651,7 +652,7 @@ def kurt(self, numeric_only: bool = False, **kwargs):
651652
def quantile(
652653
self,
653654
quantile: float,
654-
interpolation: str = "linear",
655+
interpolation: QuantileInterpolation = "linear",
655656
numeric_only: bool = False,
656657
**kwargs,
657658
):

pandas/core/window/rolling.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
ArrayLike,
3030
Axis,
3131
NDFrameT,
32+
QuantileInterpolation,
3233
WindowingRankType,
3334
)
3435
from pandas.compat._optional import import_optional_dependency
@@ -1658,7 +1659,7 @@ def kurt(self, numeric_only: bool = False, **kwargs):
16581659
def quantile(
16591660
self,
16601661
quantile: float,
1661-
interpolation: str = "linear",
1662+
interpolation: QuantileInterpolation = "linear",
16621663
numeric_only: bool = False,
16631664
**kwargs,
16641665
):
@@ -2553,7 +2554,7 @@ def kurt(self, numeric_only: bool = False, **kwargs):
25532554
def quantile(
25542555
self,
25552556
quantile: float,
2556-
interpolation: str = "linear",
2557+
interpolation: QuantileInterpolation = "linear",
25572558
numeric_only: bool = False,
25582559
**kwargs,
25592560
):

0 commit comments

Comments
 (0)