Skip to content

Commit 010ea17

Browse files
authored
enable reportInvalidStubStatement (#43775)
1 parent 4988d6e commit 010ea17

13 files changed

+88
-89
lines changed

pandas/_libs/algos.pyi

+23-23
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,16 @@ def kth_smallest(
5050

5151
def nancorr(
5252
mat: np.ndarray, # const float64_t[:, :]
53-
cov: bool = False,
54-
minp=None,
53+
cov: bool = ...,
54+
minp=...,
5555
) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
5656
def nancorr_spearman(
5757
mat: np.ndarray, # ndarray[float64_t, ndim=2]
58-
minp: int = 1,
58+
minp: int = ...,
5959
) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
6060
def nancorr_kendall(
6161
mat: np.ndarray, # ndarray[float64_t, ndim=2]
62-
minp: int = 1,
62+
minp: int = ...,
6363
) -> np.ndarray: ... # ndarray[float64_t, ndim=2]
6464

6565
# ----------------------------------------------------------------------
@@ -77,36 +77,36 @@ def nancorr_kendall(
7777
# uint16_t
7878
# uint8_t
7979

80-
def validate_limit(nobs: int | None, limit=None) -> int: ...
80+
def validate_limit(nobs: int | None, limit=...) -> int: ...
8181
def pad(
8282
old: np.ndarray, # ndarray[algos_t]
8383
new: np.ndarray, # ndarray[algos_t]
84-
limit=None,
84+
limit=...,
8585
) -> np.ndarray: ... # np.ndarray[np.intp, ndim=1]
8686
def pad_inplace(
8787
values: np.ndarray, # algos_t[:]
8888
mask: np.ndarray, # uint8_t[:]
89-
limit=None,
89+
limit=...,
9090
) -> None: ...
9191
def pad_2d_inplace(
9292
values: np.ndarray, # algos_t[:, :]
9393
mask: np.ndarray, # const uint8_t[:, :]
94-
limit=None,
94+
limit=...,
9595
) -> None: ...
9696
def backfill(
9797
old: np.ndarray, # ndarray[algos_t]
9898
new: np.ndarray, # ndarray[algos_t]
99-
limit=None,
99+
limit=...,
100100
) -> np.ndarray: ... # np.ndarray[np.intp, ndim=1]
101101
def backfill_inplace(
102102
values: np.ndarray, # algos_t[:]
103103
mask: np.ndarray, # uint8_t[:]
104-
limit=None,
104+
limit=...,
105105
) -> None: ...
106106
def backfill_2d_inplace(
107107
values: np.ndarray, # algos_t[:, :]
108108
mask: np.ndarray, # const uint8_t[:, :]
109-
limit=None,
109+
limit=...,
110110
) -> None: ...
111111
def is_monotonic(
112112
arr: np.ndarray, # ndarray[algos_t, ndim=1]
@@ -150,18 +150,18 @@ def diff_2d(
150150
) -> None: ...
151151
def ensure_platform_int(arr: object) -> npt.NDArray[np.intp]: ...
152152
def ensure_object(arr: object) -> npt.NDArray[np.object_]: ...
153-
def ensure_complex64(arr: object, copy=True) -> npt.NDArray[np.complex64]: ...
154-
def ensure_complex128(arr: object, copy=True) -> npt.NDArray[np.complex128]: ...
155-
def ensure_float64(arr: object, copy=True) -> npt.NDArray[np.float64]: ...
156-
def ensure_float32(arr: object, copy=True) -> npt.NDArray[np.float32]: ...
157-
def ensure_int8(arr: object, copy=True) -> npt.NDArray[np.int8]: ...
158-
def ensure_int16(arr: object, copy=True) -> npt.NDArray[np.int16]: ...
159-
def ensure_int32(arr: object, copy=True) -> npt.NDArray[np.int32]: ...
160-
def ensure_int64(arr: object, copy=True) -> npt.NDArray[np.int64]: ...
161-
def ensure_uint8(arr: object, copy=True) -> npt.NDArray[np.uint8]: ...
162-
def ensure_uint16(arr: object, copy=True) -> npt.NDArray[np.uint16]: ...
163-
def ensure_uint32(arr: object, copy=True) -> npt.NDArray[np.uint32]: ...
164-
def ensure_uint64(arr: object, copy=True) -> npt.NDArray[np.uint64]: ...
153+
def ensure_complex64(arr: object, copy=...) -> npt.NDArray[np.complex64]: ...
154+
def ensure_complex128(arr: object, copy=...) -> npt.NDArray[np.complex128]: ...
155+
def ensure_float64(arr: object, copy=...) -> npt.NDArray[np.float64]: ...
156+
def ensure_float32(arr: object, copy=...) -> npt.NDArray[np.float32]: ...
157+
def ensure_int8(arr: object, copy=...) -> npt.NDArray[np.int8]: ...
158+
def ensure_int16(arr: object, copy=...) -> npt.NDArray[np.int16]: ...
159+
def ensure_int32(arr: object, copy=...) -> npt.NDArray[np.int32]: ...
160+
def ensure_int64(arr: object, copy=...) -> npt.NDArray[np.int64]: ...
161+
def ensure_uint8(arr: object, copy=...) -> npt.NDArray[np.uint8]: ...
162+
def ensure_uint16(arr: object, copy=...) -> npt.NDArray[np.uint16]: ...
163+
def ensure_uint32(arr: object, copy=...) -> npt.NDArray[np.uint32]: ...
164+
def ensure_uint64(arr: object, copy=...) -> npt.NDArray[np.uint64]: ...
165165
def take_1d_int8_int8(
166166
values: np.ndarray, indexer: np.ndarray, out: np.ndarray, fill_value=...
167167
) -> None: ...

pandas/_libs/arrays.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ class NDArrayBacked:
2525
@property
2626
def nbytes(self) -> int: ...
2727
def copy(self): ...
28-
def delete(self, loc, axis=0): ...
28+
def delete(self, loc, axis=...): ...
2929
def swapaxes(self, axis1, axis2): ...
3030
def repeat(self, repeats: int | Sequence[int], axis: int | None = ...): ...
3131
def reshape(self, *args, **kwargs): ...
32-
def ravel(self, order="C"): ...
32+
def ravel(self, order=...): ...
3333
@property
3434
def T(self): ...

pandas/_libs/index.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class IndexEngine:
1010
def __contains__(self, val: object) -> bool: ...
1111
# -> int | slice | np.ndarray[bool]
1212
def get_loc(self, val: object) -> int | slice | np.ndarray: ...
13-
def sizeof(self, deep: bool = False) -> int: ...
13+
def sizeof(self, deep: bool = ...) -> int: ...
1414
def __sizeof__(self) -> int: ...
1515
@property
1616
def is_unique(self) -> bool: ...

pandas/_libs/internals.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class BlockManager:
7979
_blknos: np.ndarray
8080
_blklocs: np.ndarray
8181
def __init__(
82-
self, blocks: tuple[B, ...], axes: list[Index], verify_integrity=True
82+
self, blocks: tuple[B, ...], axes: list[Index], verify_integrity=...
8383
): ...
8484
def get_slice(self: T, slobj: slice, axis: int = ...) -> T: ...
8585
def _rebuild_blknos_and_blklocs(self) -> None: ...

pandas/_libs/join.pyi

+13-13
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def left_outer_join(
1111
left: np.ndarray, # const intp_t[:]
1212
right: np.ndarray, # const intp_t[:]
1313
max_groups: int,
14-
sort: bool = True,
14+
sort: bool = ...,
1515
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
1616
def full_outer_join(
1717
left: np.ndarray, # const intp_t[:]
@@ -54,40 +54,40 @@ def asof_join_backward_on_X_by_Y(
5454
right_values: np.ndarray, # asof_t[:]
5555
left_by_values: np.ndarray, # by_t[:]
5656
right_by_values: np.ndarray, # by_t[:]
57-
allow_exact_matches: bool = True,
58-
tolerance=None,
57+
allow_exact_matches: bool = ...,
58+
tolerance=...,
5959
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
6060
def asof_join_forward_on_X_by_Y(
6161
left_values: np.ndarray, # asof_t[:]
6262
right_values: np.ndarray, # asof_t[:]
6363
left_by_values: np.ndarray, # by_t[:]
6464
right_by_values: np.ndarray, # by_t[:]
65-
allow_exact_matches: bool = True,
66-
tolerance=None,
65+
allow_exact_matches: bool = ...,
66+
tolerance=...,
6767
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
6868
def asof_join_nearest_on_X_by_Y(
6969
left_values: np.ndarray, # asof_t[:]
7070
right_values: np.ndarray, # asof_t[:]
7171
left_by_values: np.ndarray, # by_t[:]
7272
right_by_values: np.ndarray, # by_t[:]
73-
allow_exact_matches: bool = True,
74-
tolerance=None,
73+
allow_exact_matches: bool = ...,
74+
tolerance=...,
7575
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
7676
def asof_join_backward(
7777
left_values: np.ndarray, # asof_t[:]
7878
right_values: np.ndarray, # asof_t[:]
79-
allow_exact_matches: bool = True,
80-
tolerance=None,
79+
allow_exact_matches: bool = ...,
80+
tolerance=...,
8181
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
8282
def asof_join_forward(
8383
left_values: np.ndarray, # asof_t[:]
8484
right_values: np.ndarray, # asof_t[:]
85-
allow_exact_matches: bool = True,
86-
tolerance=None,
85+
allow_exact_matches: bool = ...,
86+
tolerance=...,
8787
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...
8888
def asof_join_nearest(
8989
left_values: np.ndarray, # asof_t[:]
9090
right_values: np.ndarray, # asof_t[:]
91-
allow_exact_matches: bool = True,
92-
tolerance=None,
91+
allow_exact_matches: bool = ...,
92+
tolerance=...,
9393
) -> tuple[npt.NDArray[np.intp], npt.NDArray[np.intp]]: ...

pandas/_libs/lib.pyi

+26-26
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ i8max: int
3030
u8max: int
3131

3232
def item_from_zerodim(val: object) -> object: ...
33-
def infer_dtype(value: object, skipna: bool = True) -> str: ...
33+
def infer_dtype(value: object, skipna: bool = ...) -> str: ...
3434
def is_iterator(obj: object) -> bool: ...
3535
def is_scalar(val: object) -> bool: ...
36-
def is_list_like(obj: object, allow_sets: bool = True) -> bool: ...
36+
def is_list_like(obj: object, allow_sets: bool = ...) -> bool: ...
3737
def is_period(val: object) -> bool: ...
3838
def is_interval(val: object) -> bool: ...
3939
def is_decimal(val: object) -> bool: ...
@@ -45,22 +45,22 @@ def is_interval_array(values: np.ndarray) -> bool: ...
4545
def is_datetime64_array(values: np.ndarray) -> bool: ...
4646
def is_timedelta_or_timedelta64_array(values: np.ndarray) -> bool: ...
4747
def is_datetime_with_singletz_array(values: np.ndarray) -> bool: ...
48-
def is_time_array(values: np.ndarray, skipna: bool = False): ...
49-
def is_date_array(values: np.ndarray, skipna: bool = False): ...
50-
def is_datetime_array(values: np.ndarray, skipna: bool = False): ...
51-
def is_string_array(values: np.ndarray, skipna: bool = False): ...
52-
def is_float_array(values: np.ndarray, skipna: bool = False): ...
53-
def is_integer_array(values: np.ndarray, skipna: bool = False): ...
54-
def is_bool_array(values: np.ndarray, skipna: bool = False): ...
55-
def fast_multiget(mapping: dict, keys: np.ndarray, default=np.nan) -> np.ndarray: ...
56-
def fast_unique_multiple_list_gen(gen: Generator, sort: bool = True) -> list: ...
57-
def fast_unique_multiple_list(lists: list, sort: bool = True) -> list: ...
58-
def fast_unique_multiple(arrays: list, sort: bool = True) -> list: ...
48+
def is_time_array(values: np.ndarray, skipna: bool = ...): ...
49+
def is_date_array(values: np.ndarray, skipna: bool = ...): ...
50+
def is_datetime_array(values: np.ndarray, skipna: bool = ...): ...
51+
def is_string_array(values: np.ndarray, skipna: bool = ...): ...
52+
def is_float_array(values: np.ndarray, skipna: bool = ...): ...
53+
def is_integer_array(values: np.ndarray, skipna: bool = ...): ...
54+
def is_bool_array(values: np.ndarray, skipna: bool = ...): ...
55+
def fast_multiget(mapping: dict, keys: np.ndarray, default=...) -> np.ndarray: ...
56+
def fast_unique_multiple_list_gen(gen: Generator, sort: bool = ...) -> list: ...
57+
def fast_unique_multiple_list(lists: list, sort: bool = ...) -> list: ...
58+
def fast_unique_multiple(arrays: list, sort: bool = ...) -> list: ...
5959
def map_infer(
6060
arr: np.ndarray,
6161
f: Callable[[Any], Any],
62-
convert: bool = True,
63-
ignore_na: bool = False,
62+
convert: bool = ...,
63+
ignore_na: bool = ...,
6464
) -> np.ndarray: ...
6565
@overload # both convert_datetime and convert_to_nullable_integer False -> np.ndarray
6666
def maybe_convert_objects(
@@ -131,27 +131,27 @@ def maybe_convert_objects(
131131
def maybe_convert_numeric(
132132
values: npt.NDArray[np.object_],
133133
na_values: set,
134-
convert_empty: bool = True,
135-
coerce_numeric: bool = False,
134+
convert_empty: bool = ...,
135+
coerce_numeric: bool = ...,
136136
convert_to_masked_nullable: Literal[False] = ...,
137137
) -> tuple[np.ndarray, None]: ...
138138
@overload
139139
def maybe_convert_numeric(
140140
values: npt.NDArray[np.object_],
141141
na_values: set,
142-
convert_empty: bool = True,
143-
coerce_numeric: bool = False,
142+
convert_empty: bool = ...,
143+
coerce_numeric: bool = ...,
144144
*,
145145
convert_to_masked_nullable: Literal[True],
146146
) -> tuple[np.ndarray, np.ndarray]: ...
147147

148148
# TODO: restrict `arr`?
149149
def ensure_string_array(
150150
arr,
151-
na_value: object = np.nan,
152-
convert_na_value: bool = True,
153-
copy: bool = True,
154-
skipna: bool = True,
151+
na_value: object = ...,
152+
convert_na_value: bool = ...,
153+
copy: bool = ...,
154+
skipna: bool = ...,
155155
) -> npt.NDArray[np.object_]: ...
156156
def infer_datetimelike_array(
157157
arr: npt.NDArray[np.object_],
@@ -169,7 +169,7 @@ def tuples_to_object_array(
169169
) -> ndarray_obj_2d: ...
170170

171171
# TODO: can we be more specific about rows?
172-
def to_object_array(rows: object, min_width: int = 0) -> ndarray_obj_2d: ...
172+
def to_object_array(rows: object, min_width: int = ...) -> ndarray_obj_2d: ...
173173
def dicts_to_array(dicts: list, columns: list) -> ndarray_obj_2d: ...
174174
def maybe_booleans_to_slice(
175175
mask: npt.NDArray[np.uint8],
@@ -214,8 +214,8 @@ def get_level_sorter(
214214
def generate_bins_dt64(
215215
values: npt.NDArray[np.int64],
216216
binner: np.ndarray, # const int64_t[:]
217-
closed: object = "left",
218-
hasnans: bool = False,
217+
closed: object = ...,
218+
hasnans: bool = ...,
219219
) -> np.ndarray: ... # np.ndarray[np.int64, ndim=1]
220220
def array_equivalent_object(
221221
left: np.ndarray, # object[:]

pandas/_libs/sparse.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class SparseIndex:
2828
class IntIndex(SparseIndex):
2929
indices: npt.NDArray[np.int32]
3030
def __init__(
31-
self, length: int, indices: Sequence[int], check_integrity: bool = True
31+
self, length: int, indices: Sequence[int], check_integrity: bool = ...
3232
): ...
3333

3434
class BlockIndex(SparseIndex):

pandas/_libs/tslibs/fields.pyi

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ def isleapyear_arr(
3131
def build_isocalendar_sarray(
3232
dtindex: npt.NDArray[np.int64], # const int64_t[:]
3333
) -> np.ndarray: ...
34-
def get_locale_names(name_type: str, locale: object = None): ...
34+
def get_locale_names(name_type: str, locale: object = ...): ...
3535

3636
class RoundTo:
3737
@property

pandas/_libs/tslibs/period.pyi

+10-10
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,16 @@ class Period:
5858
# error: "__new__" must return a class instance (got "Union[Period, NaTType]")
5959
def __new__( # type: ignore[misc]
6060
cls,
61-
value=None,
62-
freq=None,
63-
ordinal=None,
64-
year=None,
65-
month=None,
66-
quarter=None,
67-
day=None,
68-
hour=None,
69-
minute=None,
70-
second=None,
61+
value=...,
62+
freq=...,
63+
ordinal=...,
64+
year=...,
65+
month=...,
66+
quarter=...,
67+
day=...,
68+
hour=...,
69+
minute=...,
70+
second=...,
7171
) -> Period | NaTType: ...
7272
@classmethod
7373
def _maybe_convert_freq(cls, freq) -> BaseOffset: ...

pandas/_libs/tslibs/strptime.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ from pandas._typing import npt
55
def array_strptime(
66
values: npt.NDArray[np.object_],
77
fmt: str | None,
8-
exact: bool = True,
9-
errors: str = "raise",
8+
exact: bool = ...,
9+
errors: str = ...,
1010
) -> tuple[np.ndarray, np.ndarray]: ...
1111

1212
# first ndarray is M8[ns], second is object ndarray of tzinfo | None

pandas/_libs/tslibs/tzconversion.pyi

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ def tz_convert_from_utc_single(val: np.int64, tz: tzinfo) -> np.int64: ...
1616
def tz_localize_to_utc(
1717
vals: npt.NDArray[np.int64],
1818
tz: tzinfo | None,
19-
ambiguous: str | bool | Iterable[bool] | None = None,
20-
nonexistent: str | timedelta | np.timedelta64 | None = None,
19+
ambiguous: str | bool | Iterable[bool] | None = ...,
20+
nonexistent: str | timedelta | np.timedelta64 | None = ...,
2121
) -> npt.NDArray[np.int64]: ...

pandas/_libs/tslibs/vectorized.pyi

+6-6
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,20 @@ def dt64arr_to_periodarr(
1717
) -> npt.NDArray[np.int64]: ... # np.ndarray[np.int64, ndim=1]
1818
def is_date_array_normalized(
1919
stamps: npt.NDArray[np.int64], # const int64_t[:]
20-
tz: tzinfo | None = None,
20+
tz: tzinfo | None = ...,
2121
) -> bool: ...
2222
def normalize_i8_timestamps(
2323
stamps: npt.NDArray[np.int64], # const int64_t[:]
2424
tz: tzinfo | None,
2525
) -> npt.NDArray[np.int64]: ...
2626
def get_resolution(
2727
stamps: npt.NDArray[np.int64], # const int64_t[:]
28-
tz: tzinfo | None = None,
28+
tz: tzinfo | None = ...,
2929
) -> Resolution: ...
3030
def ints_to_pydatetime(
3131
arr: npt.NDArray[np.int64], # const int64_t[:}]
32-
tz: tzinfo | None = None,
33-
freq: str | BaseOffset | None = None,
34-
fold: bool = False,
35-
box: str = "datetime",
32+
tz: tzinfo | None = ...,
33+
freq: str | BaseOffset | None = ...,
34+
fold: bool = ...,
35+
box: str = ...,
3636
) -> npt.NDArray[np.object_]: ...

pyproject.toml

-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,6 @@ reportFunctionMemberAccess = false
165165
reportImportCycles = false
166166
reportIncompatibleMethodOverride = false
167167
reportIncompatibleVariableOverride = false
168-
reportInvalidStubStatement = false
169168
reportMissingImports = false
170169
reportMissingModuleSource = false
171170
reportMissingTypeArgument = false

0 commit comments

Comments
 (0)