Skip to content

Commit 8239685

Browse files
author
Bas van Beek
committed
STY: Use the PEP 457 positional-only syntax in numpy.typing
1 parent 45e43d7 commit 8239685

File tree

2 files changed

+102
-100
lines changed

2 files changed

+102
-100
lines changed

numpy/typing/_callable.py

Lines changed: 89 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -62,264 +62,264 @@
6262

6363
class _BoolOp(Protocol[_GenericType_co]):
6464
@overload
65-
def __call__(self, __other: _BoolLike_co) -> _GenericType_co: ...
65+
def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
6666
@overload # platform dependent
67-
def __call__(self, __other: int) -> int_: ...
67+
def __call__(self, other: int, /) -> int_: ...
6868
@overload
69-
def __call__(self, __other: float) -> float64: ...
69+
def __call__(self, other: float, /) -> float64: ...
7070
@overload
71-
def __call__(self, __other: complex) -> complex128: ...
71+
def __call__(self, other: complex, /) -> complex128: ...
7272
@overload
73-
def __call__(self, __other: _NumberType) -> _NumberType: ...
73+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
7474

7575
class _BoolBitOp(Protocol[_GenericType_co]):
7676
@overload
77-
def __call__(self, __other: _BoolLike_co) -> _GenericType_co: ...
77+
def __call__(self, other: _BoolLike_co, /) -> _GenericType_co: ...
7878
@overload # platform dependent
79-
def __call__(self, __other: int) -> int_: ...
79+
def __call__(self, other: int, /) -> int_: ...
8080
@overload
81-
def __call__(self, __other: _IntType) -> _IntType: ...
81+
def __call__(self, other: _IntType, /) -> _IntType: ...
8282

8383
class _BoolSub(Protocol):
84-
# Note that `__other: bool_` is absent here
84+
# Note that `other: bool_` is absent here
8585
@overload
86-
def __call__(self, __other: bool) -> NoReturn: ...
86+
def __call__(self, other: bool, /) -> NoReturn: ...
8787
@overload # platform dependent
88-
def __call__(self, __other: int) -> int_: ...
88+
def __call__(self, other: int, /) -> int_: ...
8989
@overload
90-
def __call__(self, __other: float) -> float64: ...
90+
def __call__(self, other: float, /) -> float64: ...
9191
@overload
92-
def __call__(self, __other: complex) -> complex128: ...
92+
def __call__(self, other: complex, /) -> complex128: ...
9393
@overload
94-
def __call__(self, __other: _NumberType) -> _NumberType: ...
94+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
9595

9696
class _BoolTrueDiv(Protocol):
9797
@overload
98-
def __call__(self, __other: float | _IntLike_co) -> float64: ...
98+
def __call__(self, other: float | _IntLike_co, /) -> float64: ...
9999
@overload
100-
def __call__(self, __other: complex) -> complex128: ...
100+
def __call__(self, other: complex, /) -> complex128: ...
101101
@overload
102-
def __call__(self, __other: _NumberType) -> _NumberType: ...
102+
def __call__(self, other: _NumberType, /) -> _NumberType: ...
103103

104104
class _BoolMod(Protocol):
105105
@overload
106-
def __call__(self, __other: _BoolLike_co) -> int8: ...
106+
def __call__(self, other: _BoolLike_co, /) -> int8: ...
107107
@overload # platform dependent
108-
def __call__(self, __other: int) -> int_: ...
108+
def __call__(self, other: int, /) -> int_: ...
109109
@overload
110-
def __call__(self, __other: float) -> float64: ...
110+
def __call__(self, other: float, /) -> float64: ...
111111
@overload
112-
def __call__(self, __other: _IntType) -> _IntType: ...
112+
def __call__(self, other: _IntType, /) -> _IntType: ...
113113
@overload
114-
def __call__(self, __other: _FloatType) -> _FloatType: ...
114+
def __call__(self, other: _FloatType, /) -> _FloatType: ...
115115

116116
class _BoolDivMod(Protocol):
117117
@overload
118-
def __call__(self, __other: _BoolLike_co) -> _2Tuple[int8]: ...
118+
def __call__(self, other: _BoolLike_co, /) -> _2Tuple[int8]: ...
119119
@overload # platform dependent
120-
def __call__(self, __other: int) -> _2Tuple[int_]: ...
120+
def __call__(self, other: int, /) -> _2Tuple[int_]: ...
121121
@overload
122-
def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
122+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
123123
@overload
124-
def __call__(self, __other: _IntType) -> _2Tuple[_IntType]: ...
124+
def __call__(self, other: _IntType, /) -> _2Tuple[_IntType]: ...
125125
@overload
126-
def __call__(self, __other: _FloatType) -> _2Tuple[_FloatType]: ...
126+
def __call__(self, other: _FloatType, /) -> _2Tuple[_FloatType]: ...
127127

128128
class _TD64Div(Protocol[_NumberType_co]):
129129
@overload
130-
def __call__(self, __other: timedelta64) -> _NumberType_co: ...
130+
def __call__(self, other: timedelta64, /) -> _NumberType_co: ...
131131
@overload
132-
def __call__(self, __other: _BoolLike_co) -> NoReturn: ...
132+
def __call__(self, other: _BoolLike_co, /) -> NoReturn: ...
133133
@overload
134-
def __call__(self, __other: _FloatLike_co) -> timedelta64: ...
134+
def __call__(self, other: _FloatLike_co, /) -> timedelta64: ...
135135

136136
class _IntTrueDiv(Protocol[_NBit1]):
137137
@overload
138-
def __call__(self, __other: bool) -> floating[_NBit1]: ...
138+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
139139
@overload
140-
def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
140+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
141141
@overload
142-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
142+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
143143
@overload
144144
def __call__(
145-
self, __other: complex
145+
self, other: complex, /,
146146
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
147147
@overload
148-
def __call__(self, __other: integer[_NBit2]) -> floating[_NBit1 | _NBit2]: ...
148+
def __call__(self, other: integer[_NBit2], /) -> floating[_NBit1 | _NBit2]: ...
149149

150150
class _UnsignedIntOp(Protocol[_NBit1]):
151151
# NOTE: `uint64 + signedinteger -> float64`
152152
@overload
153-
def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ...
153+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
154154
@overload
155155
def __call__(
156-
self, __other: int | signedinteger[Any]
156+
self, other: int | signedinteger[Any], /
157157
) -> Any: ...
158158
@overload
159-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
159+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
160160
@overload
161161
def __call__(
162-
self, __other: complex
162+
self, other: complex, /,
163163
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
164164
@overload
165165
def __call__(
166-
self, __other: unsignedinteger[_NBit2]
166+
self, other: unsignedinteger[_NBit2], /
167167
) -> unsignedinteger[_NBit1 | _NBit2]: ...
168168

169169
class _UnsignedIntBitOp(Protocol[_NBit1]):
170170
@overload
171-
def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ...
171+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
172172
@overload
173-
def __call__(self, __other: int) -> signedinteger[Any]: ...
173+
def __call__(self, other: int, /) -> signedinteger[Any]: ...
174174
@overload
175-
def __call__(self, __other: signedinteger[Any]) -> signedinteger[Any]: ...
175+
def __call__(self, other: signedinteger[Any], /) -> signedinteger[Any]: ...
176176
@overload
177177
def __call__(
178-
self, __other: unsignedinteger[_NBit2]
178+
self, other: unsignedinteger[_NBit2], /
179179
) -> unsignedinteger[_NBit1 | _NBit2]: ...
180180

181181
class _UnsignedIntMod(Protocol[_NBit1]):
182182
@overload
183-
def __call__(self, __other: bool) -> unsignedinteger[_NBit1]: ...
183+
def __call__(self, other: bool, /) -> unsignedinteger[_NBit1]: ...
184184
@overload
185185
def __call__(
186-
self, __other: int | signedinteger[Any]
186+
self, other: int | signedinteger[Any], /
187187
) -> Any: ...
188188
@overload
189-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
189+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
190190
@overload
191191
def __call__(
192-
self, __other: unsignedinteger[_NBit2]
192+
self, other: unsignedinteger[_NBit2], /
193193
) -> unsignedinteger[_NBit1 | _NBit2]: ...
194194

195195
class _UnsignedIntDivMod(Protocol[_NBit1]):
196196
@overload
197-
def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit1]]: ...
197+
def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
198198
@overload
199199
def __call__(
200-
self, __other: int | signedinteger[Any]
200+
self, other: int | signedinteger[Any], /
201201
) -> _2Tuple[Any]: ...
202202
@overload
203-
def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
203+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
204204
@overload
205205
def __call__(
206-
self, __other: unsignedinteger[_NBit2]
206+
self, other: unsignedinteger[_NBit2], /
207207
) -> _2Tuple[unsignedinteger[_NBit1 | _NBit2]]: ...
208208

209209
class _SignedIntOp(Protocol[_NBit1]):
210210
@overload
211-
def __call__(self, __other: bool) -> signedinteger[_NBit1]: ...
211+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
212212
@overload
213-
def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ...
213+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
214214
@overload
215-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
215+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
216216
@overload
217217
def __call__(
218-
self, __other: complex
218+
self, other: complex, /,
219219
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
220220
@overload
221221
def __call__(
222-
self, __other: signedinteger[_NBit2]
222+
self, other: signedinteger[_NBit2], /,
223223
) -> signedinteger[_NBit1 | _NBit2]: ...
224224

225225
class _SignedIntBitOp(Protocol[_NBit1]):
226226
@overload
227-
def __call__(self, __other: bool) -> signedinteger[_NBit1]: ...
227+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
228228
@overload
229-
def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ...
229+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
230230
@overload
231231
def __call__(
232-
self, __other: signedinteger[_NBit2]
232+
self, other: signedinteger[_NBit2], /,
233233
) -> signedinteger[_NBit1 | _NBit2]: ...
234234

235235
class _SignedIntMod(Protocol[_NBit1]):
236236
@overload
237-
def __call__(self, __other: bool) -> signedinteger[_NBit1]: ...
237+
def __call__(self, other: bool, /) -> signedinteger[_NBit1]: ...
238238
@overload
239-
def __call__(self, __other: int) -> signedinteger[_NBit1 | _NBitInt]: ...
239+
def __call__(self, other: int, /) -> signedinteger[_NBit1 | _NBitInt]: ...
240240
@overload
241-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
241+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
242242
@overload
243243
def __call__(
244-
self, __other: signedinteger[_NBit2]
244+
self, other: signedinteger[_NBit2], /,
245245
) -> signedinteger[_NBit1 | _NBit2]: ...
246246

247247
class _SignedIntDivMod(Protocol[_NBit1]):
248248
@overload
249-
def __call__(self, __other: bool) -> _2Tuple[signedinteger[_NBit1]]: ...
249+
def __call__(self, other: bool, /) -> _2Tuple[signedinteger[_NBit1]]: ...
250250
@overload
251-
def __call__(self, __other: int) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...
251+
def __call__(self, other: int, /) -> _2Tuple[signedinteger[_NBit1 | _NBitInt]]: ...
252252
@overload
253-
def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
253+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
254254
@overload
255255
def __call__(
256-
self, __other: signedinteger[_NBit2]
256+
self, other: signedinteger[_NBit2], /,
257257
) -> _2Tuple[signedinteger[_NBit1 | _NBit2]]: ...
258258

259259
class _FloatOp(Protocol[_NBit1]):
260260
@overload
261-
def __call__(self, __other: bool) -> floating[_NBit1]: ...
261+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
262262
@overload
263-
def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
263+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
264264
@overload
265-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
265+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
266266
@overload
267267
def __call__(
268-
self, __other: complex
268+
self, other: complex, /,
269269
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
270270
@overload
271271
def __call__(
272-
self, __other: integer[_NBit2] | floating[_NBit2]
272+
self, other: integer[_NBit2] | floating[_NBit2], /
273273
) -> floating[_NBit1 | _NBit2]: ...
274274

275275
class _FloatMod(Protocol[_NBit1]):
276276
@overload
277-
def __call__(self, __other: bool) -> floating[_NBit1]: ...
277+
def __call__(self, other: bool, /) -> floating[_NBit1]: ...
278278
@overload
279-
def __call__(self, __other: int) -> floating[_NBit1 | _NBitInt]: ...
279+
def __call__(self, other: int, /) -> floating[_NBit1 | _NBitInt]: ...
280280
@overload
281-
def __call__(self, __other: float) -> floating[_NBit1 | _NBitDouble]: ...
281+
def __call__(self, other: float, /) -> floating[_NBit1 | _NBitDouble]: ...
282282
@overload
283283
def __call__(
284-
self, __other: integer[_NBit2] | floating[_NBit2]
284+
self, other: integer[_NBit2] | floating[_NBit2], /
285285
) -> floating[_NBit1 | _NBit2]: ...
286286

287287
class _FloatDivMod(Protocol[_NBit1]):
288288
@overload
289-
def __call__(self, __other: bool) -> _2Tuple[floating[_NBit1]]: ...
289+
def __call__(self, other: bool, /) -> _2Tuple[floating[_NBit1]]: ...
290290
@overload
291-
def __call__(self, __other: int) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...
291+
def __call__(self, other: int, /) -> _2Tuple[floating[_NBit1 | _NBitInt]]: ...
292292
@overload
293-
def __call__(self, __other: float) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
293+
def __call__(self, other: float, /) -> _2Tuple[floating[_NBit1 | _NBitDouble]]: ...
294294
@overload
295295
def __call__(
296-
self, __other: integer[_NBit2] | floating[_NBit2]
296+
self, other: integer[_NBit2] | floating[_NBit2], /
297297
) -> _2Tuple[floating[_NBit1 | _NBit2]]: ...
298298

299299
class _ComplexOp(Protocol[_NBit1]):
300300
@overload
301-
def __call__(self, __other: bool) -> complexfloating[_NBit1, _NBit1]: ...
301+
def __call__(self, other: bool, /) -> complexfloating[_NBit1, _NBit1]: ...
302302
@overload
303-
def __call__(self, __other: int) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...
303+
def __call__(self, other: int, /) -> complexfloating[_NBit1 | _NBitInt, _NBit1 | _NBitInt]: ...
304304
@overload
305305
def __call__(
306-
self, __other: complex
306+
self, other: complex, /,
307307
) -> complexfloating[_NBit1 | _NBitDouble, _NBit1 | _NBitDouble]: ...
308308
@overload
309309
def __call__(
310310
self,
311-
__other: Union[
311+
other: Union[
312312
integer[_NBit2],
313313
floating[_NBit2],
314314
complexfloating[_NBit2, _NBit2],
315-
]
315+
], /,
316316
) -> complexfloating[_NBit1 | _NBit2, _NBit1 | _NBit2]: ...
317317

318318
class _NumberOp(Protocol):
319-
def __call__(self, __other: _NumberLike_co) -> Any: ...
319+
def __call__(self, other: _NumberLike_co, /) -> Any: ...
320320

321321
class _ComparisonOp(Protocol[_T1, _T2]):
322322
@overload
323-
def __call__(self, __other: _T1) -> bool_: ...
323+
def __call__(self, other: _T1, /) -> bool_: ...
324324
@overload
325-
def __call__(self, __other: _T2) -> NDArray[bool_]: ...
325+
def __call__(self, other: _T2, /) -> NDArray[bool_]: ...

0 commit comments

Comments
 (0)