Skip to content

Commit 1118b79

Browse files
authored
TYP/CI: enable more pyright checks (#59)
1 parent b4db0a6 commit 1118b79

File tree

7 files changed

+44
-40
lines changed

7 files changed

+44
-40
lines changed

pandas-stubs/_libs/interval.pyi

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,63 +87,63 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
8787
self: Interval[_OrderableTimesT], y: Timedelta
8888
) -> Interval[_OrderableTimesT]: ...
8989
@overload
90-
def __add__(self: Interval[int], y: int) -> Interval[int]: ...
91-
@overload
92-
def __add__(self: Interval[int], y: float) -> Interval[float]: ...
90+
def __add__(
91+
self: Interval[int], y: _OrderableScalarT
92+
) -> Interval[_OrderableScalarT]: ...
9393
@overload
9494
def __add__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
9595
@overload
9696
def __radd__(
9797
self: Interval[_OrderableTimesT], y: Timedelta
9898
) -> Interval[_OrderableTimesT]: ...
9999
@overload
100-
def __radd__(self: Interval[int], y: int) -> Interval[int]: ...
101-
@overload
102-
def __radd__(self: Interval[int], y: float) -> Interval[float]: ...
100+
def __radd__(
101+
self: Interval[int], y: _OrderableScalarT
102+
) -> Interval[_OrderableScalarT]: ...
103103
@overload
104104
def __radd__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
105105
@overload
106106
def __sub__(
107107
self: Interval[_OrderableTimesT], y: Timedelta
108108
) -> Interval[_OrderableTimesT]: ...
109109
@overload
110-
def __sub__(self: Interval[int], y: int) -> Interval[int]: ...
111-
@overload
112-
def __sub__(self: Interval[int], y: float) -> Interval[float]: ...
110+
def __sub__(
111+
self: Interval[int], y: _OrderableScalarT
112+
) -> Interval[_OrderableScalarT]: ...
113113
@overload
114114
def __sub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
115115
@overload
116116
def __rsub__(
117117
self: Interval[_OrderableTimesT], y: Timedelta
118118
) -> Interval[_OrderableTimesT]: ...
119119
@overload
120-
def __rsub__(self: Interval[int], y: int) -> Interval[int]: ...
121-
@overload
122-
def __rsub__(self: Interval[int], y: float) -> Interval[float]: ...
120+
def __rsub__(
121+
self: Interval[int], y: _OrderableScalarT
122+
) -> Interval[_OrderableScalarT]: ...
123123
@overload
124124
def __rsub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
125125
@overload
126-
def __mul__(self: Interval[int], y: int) -> Interval[int]: ...
127-
@overload
128-
def __mul__(self: Interval[int], y: float) -> Interval[float]: ...
126+
def __mul__(
127+
self: Interval[int], y: _OrderableScalarT
128+
) -> Interval[_OrderableScalarT]: ...
129129
@overload
130130
def __mul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
131131
@overload
132-
def __rmul__(self: Interval[int], y: int) -> Interval[int]: ...
133-
@overload
134-
def __rmul__(self: Interval[int], y: float) -> Interval[float]: ...
132+
def __rmul__(
133+
self: Interval[int], y: _OrderableScalarT
134+
) -> Interval[_OrderableScalarT]: ...
135135
@overload
136136
def __rmul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
137137
@overload
138-
def __truediv__(self: Interval[int], y: int) -> Interval[int]: ...
139-
@overload
140-
def __truediv__(self: Interval[int], y: float) -> Interval[float]: ...
138+
def __truediv__(
139+
self: Interval[int], y: _OrderableScalarT
140+
) -> Interval[_OrderableScalarT]: ...
141141
@overload
142142
def __truediv__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
143143
@overload
144-
def __floordiv__(self: Interval[int], y: int) -> Interval[int]: ...
145-
@overload
146-
def __floordiv__(self: Interval[int], y: float) -> Interval[float]: ...
144+
def __floordiv__(
145+
self: Interval[int], y: _OrderableScalarT
146+
) -> Interval[_OrderableScalarT]: ...
147147
@overload
148148
def __floordiv__(
149149
self: Interval[float], y: Union[int, float]

pandas-stubs/core/algorithms.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def factorize(
2020
values: Any,
2121
sort: bool = ...,
2222
na_sentinel: int = ...,
23-
size_hint: Union[int, None] = None,
23+
size_hint: Union[int, None] = ...,
2424
) -> Tuple[np.ndarray, Union[np.ndarray, Index]]: ...
2525
def value_counts(
2626
values,

pandas-stubs/core/frame.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ class DataFrame(NDFrame, OpsMixin):
950950
**kwargs,
951951
) -> DataFrame: ...
952952
def applymap(
953-
self, func: Callable, na_action: Optional[Literal["ignore"]] = None, **kwargs
953+
self, func: Callable, na_action: Optional[Literal["ignore"]] = ..., **kwargs
954954
) -> DataFrame: ...
955955
def append(
956956
self,
@@ -993,7 +993,7 @@ class DataFrame(NDFrame, OpsMixin):
993993
method: Union[_str, Literal["pearson", "kendall", "spearman"]] = ...,
994994
min_periods: int = ...,
995995
) -> DataFrame: ...
996-
def cov(self, min_periods: Optional[int] = ..., ddof: int = 1) -> DataFrame: ...
996+
def cov(self, min_periods: Optional[int] = ..., ddof: int = ...) -> DataFrame: ...
997997
def corrwith(
998998
self,
999999
other: Union[DataFrame, Series],
@@ -1009,7 +1009,7 @@ class DataFrame(NDFrame, OpsMixin):
10091009
def count(
10101010
self, axis: AxisType = ..., level: None = ..., numeric_only: _bool = ...
10111011
) -> Series: ...
1012-
def nunique(self, axis: AxisType = ..., dropna=True) -> Series: ...
1012+
def nunique(self, axis: AxisType = ..., dropna: bool = ...) -> Series: ...
10131013
def idxmax(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ...
10141014
def idxmin(self, axis: AxisType = ..., skipna: _bool = ...) -> Series: ...
10151015
@overload
@@ -1731,7 +1731,7 @@ class DataFrame(NDFrame, OpsMixin):
17311731
origin: Union[
17321732
Timestamp, Literal["epoch", "start", "start_day", "end", "end_day"]
17331733
] = ...,
1734-
offset: Optional[Union[Timedelta, _str]] = None,
1734+
offset: Optional[Union[Timedelta, _str]] = ...,
17351735
) -> Resampler: ...
17361736
def rfloordiv(
17371737
self,

pandas-stubs/core/series.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -769,7 +769,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
769769
self,
770770
left: Union[Scalar, Sequence],
771771
right: Union[Scalar, Sequence],
772-
inclusive: Literal["both", "neither", "left", "right"] = "both",
772+
inclusive: Literal["both", "neither", "left", "right"] = ...,
773773
) -> Series[_bool]: ...
774774
def isna(self) -> Series[_bool]: ...
775775
def isnull(self) -> Series[_bool]: ...
@@ -997,7 +997,7 @@ class Series(IndexOpsMixin, NDFrame, Generic[S1]):
997997
origin: Union[
998998
Timestamp, Literal["epoch", "start", "start_day", "end", "end_day"]
999999
] = ...,
1000-
offset: Optional[Union[Timedelta, _str]] = None,
1000+
offset: Optional[Union[Timedelta, _str]] = ...,
10011001
) -> Resampler: ...
10021002
def first(self, offset) -> Series[S1]: ...
10031003
def last(self, offset) -> Series[S1]: ...

pandas-stubs/io/json/_normalize.pyi

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,11 @@ def nested_to_record(
2020
) -> Any: ...
2121
def json_normalize(
2222
data: Union[Dict, List[Dict]],
23-
record_path: Optional[Union[str, List]] = None,
24-
meta: Optional[Union[str, List[Union[str, List[str]]]]] = None,
25-
meta_prefix: Optional[str] = None,
26-
record_prefix: Optional[str] = None,
27-
errors: str = "raise",
28-
sep: str = ".",
29-
max_level: Optional[int] = None,
23+
record_path: Optional[Union[str, List]] = ...,
24+
meta: Optional[Union[str, List[Union[str, List[str]]]]] = ...,
25+
meta_prefix: Optional[str] = ...,
26+
record_prefix: Optional[str] = ...,
27+
errors: str = ...,
28+
sep: str = ...,
29+
max_level: Optional[int] = ...,
3030
) -> DataFrame: ...

pandas-stubs/plotting/_misc.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ from pandas.core.series import Series
1717
def table(
1818
ax,
1919
data,
20-
rowLabels=None,
21-
colLabels=None,
20+
rowLabels=...,
21+
colLabels=...,
2222
): ...
2323
def register() -> None: ...
2424
def deregister() -> None: ...

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,7 @@ typeCheckingMode = "basic"
193193
stubPath = "."
194194
include = ["tests", "pandas-stubs"]
195195
useLibraryCodeForTypes = true
196+
# enable subset of "strict"
197+
reportDuplicateImport = true
198+
reportInvalidStubStatement = true
199+
reportOverlappingOverload = true

0 commit comments

Comments
 (0)