Skip to content

Commit 6f248df

Browse files
authored
Bump mypy to 1.11.1 (#12463)
1 parent 0fd6cd2 commit 6f248df

File tree

46 files changed

+120
-113
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+120
-113
lines changed

.github/workflows/daily.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ jobs:
5151
check-latest: true
5252
- name: Install dependencies
5353
run: pip install -r requirements-tests.txt
54-
- name: Install mypy from git
55-
run: pip install git+https://github.com/python/mypy@e8a26308d5d06925cf769b62f41ef2e4bc546ada
5654
- name: Run stubtest
5755
run: python tests/stubtest_stdlib.py
5856

.github/workflows/stubtest_stdlib.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,5 @@ jobs:
4747
check-latest: true
4848
- name: Install dependencies
4949
run: pip install -r requirements-tests.txt
50-
- name: Install mypy from git
51-
run: pip install git+https://github.com/python/mypy@e8a26308d5d06925cf769b62f41ef2e4bc546ada
5250
- name: Run stubtest
5351
run: python tests/stubtest_stdlib.py

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ black==24.4.2 # must match .pre-commit-config.yaml
55
flake8==7.1.0 # must match .pre-commit-config.yaml
66
flake8-noqa==1.4.0 # must match .pre-commit-config.yaml
77
flake8-pyi==24.6.0 # must match .pre-commit-config.yaml
8-
mypy==1.10.1
8+
mypy==1.11.1
99
pre-commit-hooks==4.6.0 # must match .pre-commit-config.yaml
1010
pyright==1.1.374
1111
pytype==2024.4.11; platform_system != "Windows" and python_version < "3.12"

stdlib/@tests/test_cases/check_enum.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77

88
A = enum.Enum("A", "spam eggs bacon")
99
B = enum.Enum("B", ["spam", "eggs", "bacon"])
10-
C = enum.Enum("Bar", [("spam", 1), ("eggs", 2), ("bacon", 3)])
11-
D = enum.Enum("Bar", {"spam": 1, "eggs": 2})
10+
C = enum.Enum("C", [("spam", 1), ("eggs", 2), ("bacon", 3)])
11+
D = enum.Enum("D", {"spam": 1, "eggs": 2})
1212

1313
assert_type(A, Type[A])
1414
assert_type(B, Type[B])

stdlib/asyncio/tasks.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -151,13 +151,13 @@ if sys.version_info >= (3, 10):
151151
@overload
152152
def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: Literal[False] = False) -> Future[list[_T]]: ... # type: ignore[overload-overlap]
153153
@overload
154-
def gather(coro_or_future1: _FutureLike[_T1], /, *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ... # type: ignore[overload-overlap]
154+
def gather(coro_or_future1: _FutureLike[_T1], /, *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ...
155155
@overload
156-
def gather( # type: ignore[overload-overlap]
156+
def gather(
157157
coro_or_future1: _FutureLike[_T1], coro_or_future2: _FutureLike[_T2], /, *, return_exceptions: bool
158158
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
159159
@overload
160-
def gather( # type: ignore[overload-overlap]
160+
def gather(
161161
coro_or_future1: _FutureLike[_T1],
162162
coro_or_future2: _FutureLike[_T2],
163163
coro_or_future3: _FutureLike[_T3],
@@ -166,7 +166,7 @@ if sys.version_info >= (3, 10):
166166
return_exceptions: bool,
167167
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
168168
@overload
169-
def gather( # type: ignore[overload-overlap]
169+
def gather(
170170
coro_or_future1: _FutureLike[_T1],
171171
coro_or_future2: _FutureLike[_T2],
172172
coro_or_future3: _FutureLike[_T3],
@@ -176,7 +176,7 @@ if sys.version_info >= (3, 10):
176176
return_exceptions: bool,
177177
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
178178
@overload
179-
def gather( # type: ignore[overload-overlap]
179+
def gather(
180180
coro_or_future1: _FutureLike[_T1],
181181
coro_or_future2: _FutureLike[_T2],
182182
coro_or_future3: _FutureLike[_T3],
@@ -189,7 +189,7 @@ if sys.version_info >= (3, 10):
189189
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
190190
]: ...
191191
@overload
192-
def gather( # type: ignore[overload-overlap]
192+
def gather(
193193
coro_or_future1: _FutureLike[_T1],
194194
coro_or_future2: _FutureLike[_T2],
195195
coro_or_future3: _FutureLike[_T3],

stdlib/asyncio/unix_events.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ if sys.platform != "win32":
159159

160160
class _UnixSelectorEventLoop(BaseSelectorEventLoop):
161161
if sys.version_info >= (3, 13):
162-
async def create_unix_server( # type: ignore[override]
162+
async def create_unix_server(
163163
self,
164164
protocol_factory: _ProtocolFactory,
165165
path: StrPath | None = None,

stdlib/builtins.pyi

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,17 +1744,16 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
17441744
# without creating many false-positive errors (see #7578).
17451745
# Instead, we special-case the most common examples of this: bool and literal integers.
17461746
@overload
1747-
def sum(iterable: Iterable[bool | _LiteralInteger], /, start: int = 0) -> int: ... # type: ignore[overload-overlap]
1747+
def sum(iterable: Iterable[bool | _LiteralInteger], /, start: int = 0) -> int: ...
17481748
@overload
17491749
def sum(iterable: Iterable[_SupportsSumNoDefaultT], /) -> _SupportsSumNoDefaultT | Literal[0]: ...
17501750
@overload
17511751
def sum(iterable: Iterable[_AddableT1], /, start: _AddableT2) -> _AddableT1 | _AddableT2: ...
17521752

17531753
# The argument to `vars()` has to have a `__dict__` attribute, so the second overload can't be annotated with `object`
17541754
# (A "SupportsDunderDict" protocol doesn't work)
1755-
# Use a type: ignore to make complaints about overlapping overloads go away
17561755
@overload
1757-
def vars(object: type, /) -> types.MappingProxyType[str, Any]: ... # type: ignore[overload-overlap]
1756+
def vars(object: type, /) -> types.MappingProxyType[str, Any]: ...
17581757
@overload
17591758
def vars(object: Any = ..., /) -> dict[str, Any]: ...
17601759

stdlib/importlib/metadata/__init__.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 12):
155155
@property
156156
def names(self) -> set[str]: ...
157157
@overload
158-
def select(self) -> Self: ... # type: ignore[misc]
158+
def select(self) -> Self: ...
159159
@overload
160160
def select(
161161
self,
@@ -277,7 +277,7 @@ if sys.version_info >= (3, 12):
277277

278278
elif sys.version_info >= (3, 10):
279279
@overload
280-
def entry_points() -> SelectableGroups: ... # type: ignore[overload-overlap]
280+
def entry_points() -> SelectableGroups: ...
281281
@overload
282282
def entry_points(
283283
*, name: str = ..., value: str = ..., group: str = ..., module: str = ..., attr: str = ..., extras: list[str] = ...

stdlib/lib2to3/fixes/fix_unicode.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from ..pytree import Node
66

77
class FixUnicode(fixer_base.BaseFix):
88
BM_compatible: ClassVar[Literal[True]]
9-
PATTERN: ClassVar[Literal["STRING | 'unicode' | 'unichr'"]] # type: ignore[name-defined] # Name "STRING" is not defined
9+
PATTERN: ClassVar[str]
1010
unicode_literals: bool
1111
def start_tree(self, tree: Node, filename: StrPath) -> None: ...
1212
def transform(self, node, results): ...

stdlib/multiprocessing/sharedctypes.pyi

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def copy(obj: _CT) -> _CT: ...
7373
@overload
7474
def synchronized(obj: _SimpleCData[_T], lock: _LockLike | None = None, ctx: Any | None = None) -> Synchronized[_T]: ...
7575
@overload
76-
def synchronized(obj: ctypes.Array[c_char], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedString: ... # type: ignore
76+
def synchronized(obj: ctypes.Array[c_char], lock: _LockLike | None = None, ctx: Any | None = None) -> SynchronizedString: ...
7777
@overload
7878
def synchronized(
7979
obj: ctypes.Array[_SimpleCData[_T]], lock: _LockLike | None = None, ctx: Any | None = None
@@ -115,12 +115,12 @@ class SynchronizedArray(SynchronizedBase[ctypes.Array[_SimpleCData[_T]]], Generi
115115
class SynchronizedString(SynchronizedArray[bytes]):
116116
@overload # type: ignore[override]
117117
def __getitem__(self, i: slice) -> bytes: ...
118-
@overload # type: ignore[override]
118+
@overload
119119
def __getitem__(self, i: int) -> bytes: ...
120120
@overload # type: ignore[override]
121121
def __setitem__(self, i: slice, value: bytes) -> None: ...
122-
@overload # type: ignore[override]
123-
def __setitem__(self, i: int, value: bytes) -> None: ... # type: ignore[override]
122+
@overload
123+
def __setitem__(self, i: int, value: bytes) -> None: ...
124124
def __getslice__(self, start: int, stop: int) -> bytes: ... # type: ignore[override]
125125
def __setslice__(self, start: int, stop: int, values: bytes) -> None: ... # type: ignore[override]
126126

0 commit comments

Comments
 (0)