Skip to content

Commit dd6869f

Browse files
authored
TYP: enable reportOverlappingOverload (#46969)
1 parent b7d72f6 commit dd6869f

File tree

4 files changed

+32
-29
lines changed

4 files changed

+32
-29
lines changed

.github/workflows/code-checks.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474

7575
- name: Install pyright
7676
# note: keep version in sync with .pre-commit-config.yaml
77-
run: npm install -g [email protected].230
77+
run: npm install -g [email protected].245
7878

7979
- name: Build Pandas
8080
id: build

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ repos:
8989
types: [python]
9090
stages: [manual]
9191
# note: keep version in sync with .github/workflows/code-checks.yml
92-
additional_dependencies: ['[email protected].230']
92+
additional_dependencies: ['[email protected].245']
9393
- repo: local
9494
hooks:
9595
- id: flake8-rst

pandas/_libs/interval.pyi

+29-27
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,12 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
6868
left: _OrderableT,
6969
right: _OrderableT,
7070
closed: IntervalClosedType = ...,
71-
): ...
71+
) -> None: ...
7272
def __hash__(self) -> int: ...
7373
@overload
74-
def __contains__(self: Interval[_OrderableTimesT], _OrderableTimesT) -> bool: ...
74+
def __contains__(
75+
self: Interval[_OrderableTimesT], key: _OrderableTimesT
76+
) -> bool: ...
7577
@overload
7678
def __contains__(
7779
self: Interval[_OrderableScalarT], key: Union[int, float]
@@ -83,63 +85,63 @@ class Interval(IntervalMixin, Generic[_OrderableT]):
8385
self: Interval[_OrderableTimesT], y: Timedelta
8486
) -> Interval[_OrderableTimesT]: ...
8587
@overload
86-
def __add__(self: Interval[int], y: int) -> Interval[int]: ...
87-
@overload
88-
def __add__(self: Interval[int], y: float) -> Interval[float]: ...
88+
def __add__(
89+
self: Interval[int], y: _OrderableScalarT
90+
) -> Interval[_OrderableScalarT]: ...
8991
@overload
9092
def __add__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
9193
@overload
9294
def __radd__(
9395
self: Interval[_OrderableTimesT], y: Timedelta
9496
) -> Interval[_OrderableTimesT]: ...
9597
@overload
96-
def __radd__(self: Interval[int], y: int) -> Interval[int]: ...
97-
@overload
98-
def __radd__(self: Interval[int], y: float) -> Interval[float]: ...
98+
def __radd__(
99+
self: Interval[int], y: _OrderableScalarT
100+
) -> Interval[_OrderableScalarT]: ...
99101
@overload
100102
def __radd__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
101103
@overload
102104
def __sub__(
103105
self: Interval[_OrderableTimesT], y: Timedelta
104106
) -> Interval[_OrderableTimesT]: ...
105107
@overload
106-
def __sub__(self: Interval[int], y: int) -> Interval[int]: ...
107-
@overload
108-
def __sub__(self: Interval[int], y: float) -> Interval[float]: ...
108+
def __sub__(
109+
self: Interval[int], y: _OrderableScalarT
110+
) -> Interval[_OrderableScalarT]: ...
109111
@overload
110112
def __sub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
111113
@overload
112114
def __rsub__(
113115
self: Interval[_OrderableTimesT], y: Timedelta
114116
) -> Interval[_OrderableTimesT]: ...
115117
@overload
116-
def __rsub__(self: Interval[int], y: int) -> Interval[int]: ...
117-
@overload
118-
def __rsub__(self: Interval[int], y: float) -> Interval[float]: ...
118+
def __rsub__(
119+
self: Interval[int], y: _OrderableScalarT
120+
) -> Interval[_OrderableScalarT]: ...
119121
@overload
120122
def __rsub__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
121123
@overload
122-
def __mul__(self: Interval[int], y: int) -> Interval[int]: ...
123-
@overload
124-
def __mul__(self: Interval[int], y: float) -> Interval[float]: ...
124+
def __mul__(
125+
self: Interval[int], y: _OrderableScalarT
126+
) -> Interval[_OrderableScalarT]: ...
125127
@overload
126128
def __mul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
127129
@overload
128-
def __rmul__(self: Interval[int], y: int) -> Interval[int]: ...
129-
@overload
130-
def __rmul__(self: Interval[int], y: float) -> Interval[float]: ...
130+
def __rmul__(
131+
self: Interval[int], y: _OrderableScalarT
132+
) -> Interval[_OrderableScalarT]: ...
131133
@overload
132134
def __rmul__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
133135
@overload
134-
def __truediv__(self: Interval[int], y: int) -> Interval[int]: ...
135-
@overload
136-
def __truediv__(self: Interval[int], y: float) -> Interval[float]: ...
136+
def __truediv__(
137+
self: Interval[int], y: _OrderableScalarT
138+
) -> Interval[_OrderableScalarT]: ...
137139
@overload
138140
def __truediv__(self: Interval[float], y: Union[int, float]) -> Interval[float]: ...
139141
@overload
140-
def __floordiv__(self: Interval[int], y: int) -> Interval[int]: ...
141-
@overload
142-
def __floordiv__(self: Interval[int], y: float) -> Interval[float]: ...
142+
def __floordiv__(
143+
self: Interval[int], y: _OrderableScalarT
144+
) -> Interval[_OrderableScalarT]: ...
143145
@overload
144146
def __floordiv__(
145147
self: Interval[float], y: Union[int, float]
@@ -157,7 +159,7 @@ class IntervalTree(IntervalMixin):
157159
right: np.ndarray,
158160
closed: IntervalClosedType = ...,
159161
leaf_size: int = ...,
160-
): ...
162+
) -> None: ...
161163
@property
162164
def mid(self) -> np.ndarray: ...
163165
@property

pyproject.toml

+1
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ exclude = ["pandas/tests", "pandas/io/clipboard", "pandas/util/version"]
156156
# enable subset of "strict"
157157
reportDuplicateImport = true
158158
reportInvalidStubStatement = true
159+
reportOverlappingOverload = true
159160
reportPropertyTypeMismatch = true
160161
reportUntypedClassDecorator = true
161162
reportUntypedFunctionDecorator = true

0 commit comments

Comments
 (0)