Skip to content

Commit d0f2be9

Browse files
authored
Bump pyright to v1.1.360 (#11810)
1 parent 29db988 commit d0f2be9

File tree

20 files changed

+100
-46
lines changed

20 files changed

+100
-46
lines changed

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ flake8-noqa==1.4.0 # must match .pre-commit-config.yaml
77
flake8-pyi==24.4.1 # must match .pre-commit-config.yaml
88
mypy==1.9.0
99
pre-commit-hooks==4.5.0 # must match .pre-commit-config.yaml
10-
pyright==1.1.358
10+
pyright==1.1.360
1111
pytype==2024.4.11; platform_system != "Windows" and python_version < "3.12"
1212
ruff==0.3.7 # must match .pre-commit-config.yaml
1313

stdlib/builtins.pyi

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,15 +1031,25 @@ class dict(MutableMapping[_KT, _VT]):
10311031
@overload
10321032
def __init__(self) -> None: ...
10331033
@overload
1034-
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ...
1034+
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
10351035
@overload
10361036
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
10371037
@overload
1038-
def __init__(self: dict[str, _VT], map: SupportsKeysAndGetItem[str, _VT], /, **kwargs: _VT) -> None: ...
1038+
def __init__(
1039+
self: dict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
1040+
map: SupportsKeysAndGetItem[str, _VT],
1041+
/,
1042+
**kwargs: _VT,
1043+
) -> None: ...
10391044
@overload
10401045
def __init__(self, iterable: Iterable[tuple[_KT, _VT]], /) -> None: ...
10411046
@overload
1042-
def __init__(self: dict[str, _VT], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT) -> None: ...
1047+
def __init__(
1048+
self: dict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
1049+
iterable: Iterable[tuple[str, _VT]],
1050+
/,
1051+
**kwargs: _VT,
1052+
) -> None: ...
10431053
# Next two overloads are for dict(string.split(sep) for string in iterable)
10441054
# Cannot be Iterable[Sequence[_T]] or otherwise dict(["foo", "bar", "baz"]) is not an error
10451055
@overload

stdlib/collections/__init__.pyi

Lines changed: 24 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,27 @@ class UserDict(MutableMapping[_KT, _VT]):
5151
@overload
5252
def __init__(self, dict: None = None, /) -> None: ...
5353
@overload
54-
def __init__(self: UserDict[str, _VT], dict: None = None, /, **kwargs: _VT) -> None: ...
54+
def __init__(
55+
self: UserDict[str, _VT], dict: None = None, /, **kwargs: _VT # pyright: ignore[reportInvalidTypeVarUse] #11780
56+
) -> None: ...
5557
@overload
5658
def __init__(self, dict: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
5759
@overload
58-
def __init__(self: UserDict[str, _VT], dict: SupportsKeysAndGetItem[str, _VT], /, **kwargs: _VT) -> None: ...
60+
def __init__(
61+
self: UserDict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
62+
dict: SupportsKeysAndGetItem[str, _VT],
63+
/,
64+
**kwargs: _VT,
65+
) -> None: ...
5966
@overload
6067
def __init__(self, iterable: Iterable[tuple[_KT, _VT]], /) -> None: ...
6168
@overload
62-
def __init__(self: UserDict[str, _VT], iterable: Iterable[tuple[str, _VT]], /, **kwargs: _VT) -> None: ...
69+
def __init__(
70+
self: UserDict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
71+
iterable: Iterable[tuple[str, _VT]],
72+
/,
73+
**kwargs: _VT,
74+
) -> None: ...
6375
@overload
6476
def __init__(self: UserDict[str, str], iterable: Iterable[list[str]], /) -> None: ...
6577
@overload
@@ -389,16 +401,21 @@ class defaultdict(dict[_KT, _VT]):
389401
@overload
390402
def __init__(self) -> None: ...
391403
@overload
392-
def __init__(self: defaultdict[str, _VT], **kwargs: _VT) -> None: ...
404+
def __init__(self: defaultdict[str, _VT], **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
393405
@overload
394406
def __init__(self, default_factory: Callable[[], _VT] | None, /) -> None: ...
395407
@overload
396-
def __init__(self: defaultdict[str, _VT], default_factory: Callable[[], _VT] | None, /, **kwargs: _VT) -> None: ...
408+
def __init__(
409+
self: defaultdict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
410+
default_factory: Callable[[], _VT] | None,
411+
/,
412+
**kwargs: _VT,
413+
) -> None: ...
397414
@overload
398415
def __init__(self, default_factory: Callable[[], _VT] | None, map: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
399416
@overload
400417
def __init__(
401-
self: defaultdict[str, _VT],
418+
self: defaultdict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
402419
default_factory: Callable[[], _VT] | None,
403420
map: SupportsKeysAndGetItem[str, _VT],
404421
/,
@@ -408,7 +425,7 @@ class defaultdict(dict[_KT, _VT]):
408425
def __init__(self, default_factory: Callable[[], _VT] | None, iterable: Iterable[tuple[_KT, _VT]], /) -> None: ...
409426
@overload
410427
def __init__(
411-
self: defaultdict[str, _VT],
428+
self: defaultdict[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
412429
default_factory: Callable[[], _VT] | None,
413430
iterable: Iterable[tuple[str, _VT]],
414431
/,

stdlib/contextlib.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ if sys.version_info >= (3, 10):
183183
@overload
184184
def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
185185
@overload
186-
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
186+
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
187187
def __enter__(self) -> _T: ...
188188
def __exit__(self, *exctype: Unused) -> None: ...
189189
async def __aenter__(self) -> _T: ...
@@ -195,7 +195,7 @@ else:
195195
@overload
196196
def __init__(self: nullcontext[None], enter_result: None = None) -> None: ...
197197
@overload
198-
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ...
198+
def __init__(self: nullcontext[_T], enter_result: _T) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
199199
def __enter__(self) -> _T: ...
200200
def __exit__(self, *exctype: Unused) -> None: ...
201201

stdlib/logging/__init__.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ class StreamHandler(Handler, Generic[_StreamT]):
597597
@overload
598598
def __init__(self: StreamHandler[TextIO], stream: None = None) -> None: ...
599599
@overload
600-
def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ...
600+
def __init__(self: StreamHandler[_StreamT], stream: _StreamT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
601601
def setStream(self, stream: _StreamT) -> _StreamT | None: ...
602602
if sys.version_info >= (3, 11):
603603
def __class_getitem__(cls, item: Any) -> GenericAlias: ...

stdlib/unittest/mock.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class _patch(Generic[_T]):
188188
# but that's impossible with the current type system.
189189
if sys.version_info >= (3, 10):
190190
def __init__(
191-
self: _patch[_T],
191+
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
192192
getter: Callable[[], Any],
193193
attribute: str,
194194
new: _T,
@@ -203,7 +203,7 @@ class _patch(Generic[_T]):
203203
) -> None: ...
204204
else:
205205
def __init__(
206-
self: _patch[_T],
206+
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
207207
getter: Callable[[], Any],
208208
attribute: str,
209209
new: _T,

stdlib/weakref.pyi

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,17 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
5151
@overload
5252
def __init__(self) -> None: ...
5353
@overload
54-
def __init__(self: WeakValueDictionary[_KT, _VT], other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]], /) -> None: ...
54+
def __init__(
55+
self: WeakValueDictionary[_KT, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
56+
other: Mapping[_KT, _VT] | Iterable[tuple[_KT, _VT]],
57+
/,
58+
) -> None: ...
5559
@overload
5660
def __init__(
57-
self: WeakValueDictionary[str, _VT], other: Mapping[str, _VT] | Iterable[tuple[str, _VT]] = (), /, **kwargs: _VT
61+
self: WeakValueDictionary[str, _VT], # pyright: ignore[reportInvalidTypeVarUse] #11780
62+
other: Mapping[str, _VT] | Iterable[tuple[str, _VT]] = (),
63+
/,
64+
**kwargs: _VT,
5865
) -> None: ...
5966
def __len__(self) -> int: ...
6067
def __getitem__(self, key: _KT) -> _VT: ...

stubs/PyMySQL/pymysql/connections.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ class Connection(Generic[_C]):
124124
) -> None: ...
125125
@overload
126126
def __init__(
127-
self: Connection[_C], # different between overloads
127+
# different between overloads:
128+
self: Connection[_C], # pyright: ignore[reportInvalidTypeVarUse] #11780
128129
*,
129130
host: str | None = None,
130131
user: Incomplete | None = None,

stubs/WTForms/wtforms/fields/form.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class FormField(Field, Generic[_BoundFormT]):
1212
form: _BoundFormT
1313
separator: str
1414
def __init__(
15-
self: FormField[_BoundFormT],
15+
self: FormField[_BoundFormT], # pyright: ignore[reportInvalidTypeVarUse] #11780
1616
form_class: type[_BoundFormT],
1717
label: str | None = None,
1818
validators: None = None,

stubs/WTForms/wtforms/fields/list.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class FieldList(Field, Generic[_BoundFieldT]):
1515
entries: list[_BoundFieldT]
1616
object_data: Iterable[Any]
1717
def __init__(
18-
self: FieldList[_BoundFieldT],
18+
self: FieldList[_BoundFieldT], # pyright: ignore[reportInvalidTypeVarUse] #11780
1919
# because of our workaround we need to accept Field as well
2020
unbound_field: UnboundField[_BoundFieldT] | _BoundFieldT,
2121
label: str | None = None,

stubs/WebOb/webob/dec.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
4545
) -> None: ...
4646
@overload
4747
def __init__(
48-
self: wsgify[_RequestT_contra, []],
48+
self: wsgify[_RequestT_contra, []], # pyright: ignore[reportInvalidTypeVarUse] #11780
4949
func: _RequestHandler[_RequestT_contra, []] | None,
5050
RequestClass: type[_RequestT_contra],
5151
args: tuple[()] = (),
@@ -54,7 +54,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
5454
) -> None: ...
5555
@overload
5656
def __init__(
57-
self: wsgify[_RequestT_contra, []],
57+
self: wsgify[_RequestT_contra, []], # pyright: ignore[reportInvalidTypeVarUse] #11780
5858
func: _RequestHandler[_RequestT_contra, []] | None = None,
5959
*,
6060
RequestClass: type[_RequestT_contra],
@@ -74,7 +74,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
7474
) -> None: ...
7575
@overload
7676
def __init__(
77-
self: wsgify[_RequestT_contra, [_AppT_contra]],
77+
self: wsgify[_RequestT_contra, [_AppT_contra]], # pyright: ignore[reportInvalidTypeVarUse] #11780
7878
func: _Middleware[_RequestT_contra, _AppT_contra, []] | None,
7979
RequestClass: type[_RequestT_contra],
8080
args: tuple[()] = (),
@@ -84,7 +84,7 @@ class wsgify(Generic[_RequestT_contra, _P]):
8484
) -> None: ...
8585
@overload
8686
def __init__(
87-
self: wsgify[_RequestT_contra, [_AppT_contra]],
87+
self: wsgify[_RequestT_contra, [_AppT_contra]], # pyright: ignore[reportInvalidTypeVarUse] #11780
8888
func: _Middleware[_RequestT_contra, _AppT_contra, []] | None = None,
8989
*,
9090
RequestClass: type[_RequestT_contra],

stubs/gevent/gevent/_fileobjectcommon.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ class OpenDescriptor(Generic[_IOT]):
8080
def buffer_size_for_stream(cls, stream: object) -> int: ...
8181

8282
class FileObjectBase(Generic[_IOT, AnyStr]):
83-
def __init__(self: FileObjectBase[_IOT, AnyStr], descriptor: OpenDescriptor[_IOT]) -> None: ...
83+
def __init__(
84+
self: FileObjectBase[_IOT, AnyStr], descriptor: OpenDescriptor[_IOT] # pyright: ignore[reportInvalidTypeVarUse] #11780
85+
) -> None: ...
8486
io: _IOT
8587
@property
8688
def closed(self) -> bool: ...

stubs/gevent/gevent/_util.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ class Lazy(Generic[_T]):
3131

3232
class readproperty(Generic[_T]):
3333
func: Callable[[Any], _T]
34-
def __init__(self: readproperty[_T], func: Callable[[Any], _T]) -> None: ...
34+
def __init__(
35+
self: readproperty[_T], func: Callable[[Any], _T] # pyright: ignore[reportInvalidTypeVarUse] #11780
36+
) -> None: ...
3537
@overload
3638
def __get__(self, inst: None, class_: type[object]) -> Self: ...
3739
@overload

stubs/gevent/gevent/greenlet.pyi

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,12 @@ class Greenlet(greenlet.greenlet, Generic[_P, _T]):
1919
kwargs: dict[str, Any]
2020
value: _T | None
2121
@overload
22-
def __init__(self: Greenlet[_P, _T], run: Callable[_P, _T], *args: _P.args, **kwargs: _P.kwargs) -> None: ...
22+
def __init__(
23+
self: Greenlet[_P, _T], # pyright: ignore[reportInvalidTypeVarUse] #11780
24+
run: Callable[_P, _T],
25+
*args: _P.args,
26+
**kwargs: _P.kwargs,
27+
) -> None: ...
2328
@overload
2429
def __init__(self: Greenlet[[], None]) -> None: ...
2530
@readproperty

stubs/libsass/sass.pyi

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,25 @@ class SassMap(Mapping[_KT, _VT_co]):
160160
@overload
161161
def __init__(self) -> None: ...
162162
@overload
163-
def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ...
163+
def __init__(self: SassMap[str, _VT_co], **kwargs: _VT_co) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
164164
@overload
165165
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT_co], /) -> None: ...
166166
@overload
167-
def __init__(self: SassMap[str, _VT_co], map: SupportsKeysAndGetItem[str, _VT_co], /, **kwargs: _VT_co) -> None: ...
167+
def __init__(
168+
self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780
169+
map: SupportsKeysAndGetItem[str, _VT_co],
170+
/,
171+
**kwargs: _VT_co,
172+
) -> None: ...
168173
@overload
169174
def __init__(self, iterable: Iterable[tuple[_KT, _VT_co]], /) -> None: ...
170175
@overload
171-
def __init__(self: SassMap[str, _VT_co], iterable: Iterable[tuple[str, _VT_co]], /, **kwargs: _VT_co) -> None: ...
176+
def __init__(
177+
self: SassMap[str, _VT_co], # pyright: ignore[reportInvalidTypeVarUse] #11780
178+
iterable: Iterable[tuple[str, _VT_co]],
179+
/,
180+
**kwargs: _VT_co,
181+
) -> None: ...
172182
def __getitem__(self, key: _KT) -> _VT_co: ...
173183
def __iter__(self) -> Iterator[_KT]: ...
174184
def __len__(self) -> int: ...

stubs/mock/mock/mock.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ class _patch(Generic[_T]):
177177
kwargs: Mapping[str, Any]
178178
additional_patchers: Any
179179
def __init__(
180-
self: _patch[_T],
180+
self: _patch[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
181181
getter: Callable[[], Any],
182182
attribute: str,
183183
new: _T,

stubs/openpyxl/openpyxl/descriptors/base.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
3636

3737
@overload
3838
def __init__(
39-
self: Typed[_T, Literal[True]],
39+
self: Typed[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
4040
name: str | None = None,
4141
*,
4242
expected_type: _ExpectedTypeParam[_T],
@@ -45,7 +45,7 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
4545
) -> None: ...
4646
@overload
4747
def __init__(
48-
self: Typed[_T, Literal[False]],
48+
self: Typed[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
4949
name: str | None = None,
5050
*,
5151
expected_type: _ExpectedTypeParam[_T],
@@ -64,15 +64,15 @@ class Typed(Descriptor[_T], Generic[_T, _N]):
6464
class Convertible(Typed[_T, _N]):
6565
@overload
6666
def __init__(
67-
self: Convertible[_T, Literal[True]],
67+
self: Convertible[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
6868
name: str | None = None,
6969
*,
7070
expected_type: _ExpectedTypeParam[_T],
7171
allow_none: Literal[True],
7272
) -> None: ...
7373
@overload
7474
def __init__(
75-
self: Convertible[_T, Literal[False]],
75+
self: Convertible[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
7676
name: str | None = None,
7777
*,
7878
expected_type: _ExpectedTypeParam[_T],

stubs/openpyxl/openpyxl/descriptors/nested.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Nested(Descriptor[_T]):
2525
namespace: str | None
2626
# In usage, "Nested" is closed to "Typed" than "Descriptor", but doesn't use allow_none
2727
def __init__(
28-
self: Nested[_T],
28+
self: Nested[_T], # pyright: ignore[reportInvalidTypeVarUse] #11780
2929
name: str | None = None,
3030
*,
3131
expected_type: _ExpectedTypeParam[_T],
@@ -44,15 +44,15 @@ class Nested(Descriptor[_T]):
4444
class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
4545
@overload
4646
def __init__(
47-
self: NestedValue[_T, Literal[True]],
47+
self: NestedValue[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
4848
name: str | None = None,
4949
*,
5050
expected_type: _ExpectedTypeParam[_T],
5151
allow_none: Literal[True],
5252
) -> None: ...
5353
@overload
5454
def __init__(
55-
self: NestedValue[_T, Literal[False]],
55+
self: NestedValue[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
5656
name: str | None = None,
5757
*,
5858
expected_type: _ExpectedTypeParam[_T],
@@ -115,15 +115,15 @@ class NestedValue(Nested[_T], Convertible[_T, _N]): # type: ignore[misc]
115115
class NestedText(NestedValue[_T, _N]):
116116
@overload
117117
def __init__(
118-
self: NestedText[_T, Literal[True]],
118+
self: NestedText[_T, Literal[True]], # pyright: ignore[reportInvalidTypeVarUse] #11780
119119
name: str | None = None,
120120
*,
121121
expected_type: _ExpectedTypeParam[_T],
122122
allow_none: Literal[True],
123123
) -> None: ...
124124
@overload
125125
def __init__(
126-
self: NestedText[_T, Literal[False]],
126+
self: NestedText[_T, Literal[False]], # pyright: ignore[reportInvalidTypeVarUse] #11780
127127
name: str | None = None,
128128
*,
129129
expected_type: _ExpectedTypeParam[_T],

0 commit comments

Comments
 (0)