Skip to content

Commit 87930ef

Browse files
authored
TYP: a few mismatches found by stubtest (#47764)
* TYP: a few mismatches found by stubtest * a few more * flake8
1 parent b731518 commit 87930ef

11 files changed

+24
-34
lines changed

pandas/_libs/algos.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def groupsort_indexer(
4242
np.ndarray, # ndarray[int64_t, ndim=1]
4343
]: ...
4444
def kth_smallest(
45-
a: np.ndarray, # numeric[:]
45+
arr: np.ndarray, # numeric[:]
4646
k: int,
4747
) -> Any: ... # numeric
4848

pandas/_libs/groupby.pyi

+13-3
Original file line numberDiff line numberDiff line change
@@ -105,26 +105,28 @@ def group_last(
105105
values: np.ndarray, # ndarray[rank_t, ndim=2]
106106
labels: np.ndarray, # const int64_t[:]
107107
mask: npt.NDArray[np.bool_] | None,
108-
result_mask: npt.NDArray[np.bool_] | None,
108+
result_mask: npt.NDArray[np.bool_] | None = ...,
109109
min_count: int = ..., # Py_ssize_t
110+
is_datetimelike: bool = ...,
110111
) -> None: ...
111112
def group_nth(
112113
out: np.ndarray, # rank_t[:, ::1]
113114
counts: np.ndarray, # int64_t[::1]
114115
values: np.ndarray, # ndarray[rank_t, ndim=2]
115116
labels: np.ndarray, # const int64_t[:]
116117
mask: npt.NDArray[np.bool_] | None,
117-
result_mask: npt.NDArray[np.bool_] | None,
118+
result_mask: npt.NDArray[np.bool_] | None = ...,
118119
min_count: int = ..., # int64_t
119120
rank: int = ..., # int64_t
121+
is_datetimelike: bool = ...,
120122
) -> None: ...
121123
def group_rank(
122124
out: np.ndarray, # float64_t[:, ::1]
123125
values: np.ndarray, # ndarray[rank_t, ndim=2]
124126
labels: np.ndarray, # const int64_t[:]
125127
ngroups: int,
126128
is_datetimelike: bool,
127-
ties_method: Literal["aveage", "min", "max", "first", "dense"] = ...,
129+
ties_method: Literal["average", "min", "max", "first", "dense"] = ...,
128130
ascending: bool = ...,
129131
pct: bool = ...,
130132
na_option: Literal["keep", "top", "bottom"] = ...,
@@ -136,6 +138,7 @@ def group_max(
136138
values: np.ndarray, # ndarray[groupby_t, ndim=2]
137139
labels: np.ndarray, # const int64_t[:]
138140
min_count: int = ...,
141+
is_datetimelike: bool = ...,
139142
mask: np.ndarray | None = ...,
140143
result_mask: np.ndarray | None = ...,
141144
) -> None: ...
@@ -145,6 +148,7 @@ def group_min(
145148
values: np.ndarray, # ndarray[groupby_t, ndim=2]
146149
labels: np.ndarray, # const int64_t[:]
147150
min_count: int = ...,
151+
is_datetimelike: bool = ...,
148152
mask: np.ndarray | None = ...,
149153
result_mask: np.ndarray | None = ...,
150154
) -> None: ...
@@ -154,11 +158,17 @@ def group_cummin(
154158
labels: np.ndarray, # const int64_t[:]
155159
ngroups: int,
156160
is_datetimelike: bool,
161+
mask: np.ndarray | None = ...,
162+
result_mask: np.ndarray | None = ...,
163+
skipna: bool = ...,
157164
) -> None: ...
158165
def group_cummax(
159166
out: np.ndarray, # groupby_t[:, ::1]
160167
values: np.ndarray, # ndarray[groupby_t, ndim=2]
161168
labels: np.ndarray, # const int64_t[:]
162169
ngroups: int,
163170
is_datetimelike: bool,
171+
mask: np.ndarray | None = ...,
172+
result_mask: np.ndarray | None = ...,
173+
skipna: bool = ...,
164174
) -> None: ...

pandas/_libs/internals.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ def update_blklocs_and_blknos(
3232
loc: int,
3333
nblocks: int,
3434
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
35-
35+
@final
3636
class BlockPlacement:
3737
def __init__(self, val: int | slice | np.ndarray): ...
3838
@property

pandas/_libs/join.pyi

+3-18
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def asof_join_backward_on_X_by_Y(
5656
right_by_values: np.ndarray, # by_t[:]
5757
allow_exact_matches: bool = ...,
5858
tolerance: np.number | int | float | None = ...,
59+
use_hashtable: bool = ...,
5960
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
6061
def asof_join_forward_on_X_by_Y(
6162
left_values: np.ndarray, # asof_t[:]
@@ -64,6 +65,7 @@ def asof_join_forward_on_X_by_Y(
6465
right_by_values: np.ndarray, # by_t[:]
6566
allow_exact_matches: bool = ...,
6667
tolerance: np.number | int | float | None = ...,
68+
use_hashtable: bool = ...,
6769
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
6870
def asof_join_nearest_on_X_by_Y(
6971
left_values: np.ndarray, # asof_t[:]
@@ -72,22 +74,5 @@ def asof_join_nearest_on_X_by_Y(
7274
right_by_values: np.ndarray, # by_t[:]
7375
allow_exact_matches: bool = ...,
7476
tolerance: np.number | int | float | None = ...,
75-
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
76-
def asof_join_backward(
77-
left_values: np.ndarray, # asof_t[:]
78-
right_values: np.ndarray, # asof_t[:]
79-
allow_exact_matches: bool = ...,
80-
tolerance: np.number | int | float | None = ...,
81-
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
82-
def asof_join_forward(
83-
left_values: np.ndarray, # asof_t[:]
84-
right_values: np.ndarray, # asof_t[:]
85-
allow_exact_matches: bool = ...,
86-
tolerance: np.number | int | float | None = ...,
87-
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
88-
def asof_join_nearest(
89-
left_values: np.ndarray, # asof_t[:]
90-
right_values: np.ndarray, # asof_t[:]
91-
allow_exact_matches: bool = ...,
92-
tolerance: np.number | int | float | None = ...,
77+
use_hashtable: bool = ...,
9378
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...

pandas/_libs/missing.pyi

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
import numpy as np
22
from numpy import typing as npt
33

4-
class NAType: ...
4+
class NAType:
5+
def __new__(cls, *args, **kwargs): ...
56

67
NA: NAType
78

pandas/_libs/parsers.pyi

-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class TextReader:
6363
skip_blank_lines: bool = ...,
6464
encoding_errors: bytes | str = ...,
6565
): ...
66-
def set_error_bad_lines(self, status: int) -> None: ...
6766
def set_noconvert(self, i: int) -> None: ...
6867
def remove_noconvert(self, i: int) -> None: ...
6968
def close(self) -> None: ...

pandas/_libs/tslibs/ccalendar.pyi

-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,5 @@ def get_firstbday(year: int, month: int) -> int: ...
88
def get_lastbday(year: int, month: int) -> int: ...
99
def get_day_of_year(year: int, month: int, day: int) -> int: ...
1010
def get_iso_calendar(year: int, month: int, day: int) -> tuple[int, int, int]: ...
11-
def is_leapyear(year: int) -> bool: ...
1211
def get_week_of_year(year: int, month: int, day: int) -> int: ...
1312
def get_days_in_month(year: int, month: int) -> int: ...
14-
def dayofweek(y: int, m: int, d: int) -> int: ...

pandas/_libs/tslibs/dtypes.pyi

+2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,12 @@ class PeriodDtypeBase:
1414

1515
# actually __cinit__
1616
def __new__(cls, code: int): ...
17+
@property
1718
def _freq_group_code(self) -> int: ...
1819
@property
1920
def _resolution_obj(self) -> Resolution: ...
2021
def _get_to_timestamp_base(self) -> int: ...
22+
@property
2123
def _freqstr(self) -> str: ...
2224

2325
class FreqGroup(Enum):

pandas/_libs/tslibs/nattype.pyi

+1-2
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,14 @@ NaT: NaTType
1212
iNaT: int
1313
nat_strings: set[str]
1414

15-
def is_null_datetimelike(val: object, inat_is_null: bool = ...) -> bool: ...
16-
1715
_NaTComparisonTypes = datetime | timedelta | Period | np.datetime64 | np.timedelta64
1816

1917
class _NatComparison:
2018
def __call__(self, other: _NaTComparisonTypes) -> bool: ...
2119

2220
class NaTType:
2321
value: np.int64
22+
@property
2423
def asm8(self) -> np.datetime64: ...
2524
def to_datetime64(self) -> np.datetime64: ...
2625
def to_numpy(

pandas/_libs/tslibs/offsets.pyi

+1
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ class BaseOffset:
8080
def name(self) -> str: ...
8181
@property
8282
def rule_code(self) -> str: ...
83+
@property
8384
def freqstr(self) -> str: ...
8485
def apply_index(self, dtindex: DatetimeIndex) -> DatetimeIndex: ...
8586
def _apply_array(self, dtarr) -> None: ...

pandas/_libs/tslibs/timezones.pyi

-5
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ from typing import Callable
66

77
import numpy as np
88

9-
from pandas._typing import npt
10-
119
# imported from dateutil.tz
1210
dateutil_gettz: Callable[[str], tzinfo]
1311

@@ -17,9 +15,6 @@ def infer_tzinfo(
1715
start: datetime | None,
1816
end: datetime | None,
1917
) -> tzinfo | None: ...
20-
def get_dst_info(
21-
tz: tzinfo,
22-
) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.int64], str]: ...
2318
def maybe_get_tz(tz: str | int | np.int64 | tzinfo | None) -> tzinfo | None: ...
2419
def get_timezone(tz: tzinfo) -> tzinfo | str: ...
2520
def is_utc(tz: tzinfo | None) -> bool: ...

0 commit comments

Comments
 (0)