Skip to content

Commit 03b844d

Browse files
Sync typeshed (#20338)
Source commit: python/typeshed@ef2b90c
1 parent 985dc7f commit 03b844d

File tree

18 files changed

+60
-25
lines changed

18 files changed

+60
-25
lines changed

mypy/typeshed/stdlib/asyncio/runners.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import Unused
3-
from collections.abc import Callable, Coroutine
3+
from collections.abc import Awaitable, Callable, Coroutine
44
from contextvars import Context
55
from typing import Any, TypeVar, final
66
from typing_extensions import Self
@@ -22,7 +22,10 @@ if sys.version_info >= (3, 11):
2222
def __exit__(self, exc_type: Unused, exc_val: Unused, exc_tb: Unused) -> None: ...
2323
def close(self) -> None: ...
2424
def get_loop(self) -> AbstractEventLoop: ...
25-
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ...
25+
if sys.version_info >= (3, 14):
26+
def run(self, coro: Awaitable[_T], *, context: Context | None = None) -> _T: ...
27+
else:
28+
def run(self, coro: Coroutine[Any, Any, _T], *, context: Context | None = None) -> _T: ...
2629

2730
if sys.version_info >= (3, 12):
2831
def run(

mypy/typeshed/stdlib/asyncio/trsock.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class TransportSocket:
6262
def listen(self, backlog: int = ..., /) -> None: ...
6363
@deprecated("Removed in Python 3.11")
6464
def makefile(self) -> BinaryIO: ...
65-
@deprecated("Rmoved in Python 3.11")
65+
@deprecated("Removed in Python 3.11")
6666
def sendfile(self, file: BinaryIO, offset: int = 0, count: int | None = None) -> int: ...
6767
@deprecated("Removed in Python 3.11")
6868
def close(self) -> None: ...

mypy/typeshed/stdlib/calendar.pyi

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ if sys.version_info >= (3, 12):
5656

5757
_LocaleType: TypeAlias = tuple[str | None, str | None]
5858

59-
class IllegalMonthError(ValueError):
59+
class IllegalMonthError(ValueError, IndexError):
60+
month: int
6061
def __init__(self, month: int) -> None: ...
6162

6263
class IllegalWeekdayError(ValueError):
64+
weekday: int
6365
def __init__(self, weekday: int) -> None: ...
6466

6567
def isleap(year: int) -> bool: ...

mypy/typeshed/stdlib/ipaddress.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class _BaseNetwork(_IPAddressBase, Generic[_A]):
7373
@property
7474
def broadcast_address(self) -> _A: ...
7575
def compare_networks(self, other: Self) -> int: ...
76-
def hosts(self) -> Iterator[_A] | list[_A]: ...
76+
def hosts(self) -> Iterator[_A]: ...
7777
@property
7878
def is_global(self) -> bool: ...
7979
@property

mypy/typeshed/stdlib/mimetypes.pyi

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import sys
22
from _typeshed import StrPath
3-
from collections.abc import Sequence
3+
from collections.abc import Iterable
44
from typing import IO
55

66
__all__ = [
@@ -25,15 +25,15 @@ if sys.version_info >= (3, 13):
2525
def guess_type(url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
2626
def guess_all_extensions(type: str, strict: bool = True) -> list[str]: ...
2727
def guess_extension(type: str, strict: bool = True) -> str | None: ...
28-
def init(files: Sequence[str] | None = None) -> None: ...
29-
def read_mime_types(file: str) -> dict[str, str] | None: ...
28+
def init(files: Iterable[StrPath] | None = None) -> None: ...
29+
def read_mime_types(file: StrPath) -> dict[str, str] | None: ...
3030
def add_type(type: str, ext: str, strict: bool = True) -> None: ...
3131

3232
if sys.version_info >= (3, 13):
3333
def guess_file_type(path: StrPath, *, strict: bool = True) -> tuple[str | None, str | None]: ...
3434

3535
inited: bool
36-
knownfiles: list[str]
36+
knownfiles: list[StrPath]
3737
suffix_map: dict[str, str]
3838
encodings_map: dict[str, str]
3939
types_map: dict[str, str]
@@ -44,12 +44,12 @@ class MimeTypes:
4444
encodings_map: dict[str, str]
4545
types_map: tuple[dict[str, str], dict[str, str]]
4646
types_map_inv: tuple[dict[str, str], dict[str, str]]
47-
def __init__(self, filenames: tuple[str, ...] = (), strict: bool = True) -> None: ...
47+
def __init__(self, filenames: Iterable[StrPath] = (), strict: bool = True) -> None: ...
4848
def add_type(self, type: str, ext: str, strict: bool = True) -> None: ...
4949
def guess_extension(self, type: str, strict: bool = True) -> str | None: ...
5050
def guess_type(self, url: StrPath, strict: bool = True) -> tuple[str | None, str | None]: ...
5151
def guess_all_extensions(self, type: str, strict: bool = True) -> list[str]: ...
52-
def read(self, filename: str, strict: bool = True) -> None: ...
52+
def read(self, filename: StrPath, strict: bool = True) -> None: ...
5353
def readfp(self, fp: IO[str], strict: bool = True) -> None: ...
5454
def read_windows_registry(self, strict: bool = True) -> None: ...
5555
if sys.version_info >= (3, 13):

mypy/typeshed/stdlib/multiprocessing/managers.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@ class BaseListProxy(BaseProxy, MutableSequence[_T]):
192192
def count(self, value: _T, /) -> int: ...
193193
def insert(self, index: SupportsIndex, object: _T, /) -> None: ...
194194
def remove(self, value: _T, /) -> None: ...
195+
if sys.version_info >= (3, 14):
196+
def copy(self) -> list[_T]: ...
195197
# Use BaseListProxy[SupportsRichComparisonT] for the first overload rather than [SupportsRichComparison]
196198
# to work around invariance
197199
@overload
@@ -326,8 +328,9 @@ class SyncManager(BaseManager):
326328
def dict(self, iterable: Iterable[list[str]], /) -> DictProxy[str, str]: ...
327329
@overload
328330
def dict(self, iterable: Iterable[list[bytes]], /) -> DictProxy[bytes, bytes]: ...
331+
# Overloads are copied from builtins.list.__init__
329332
@overload
330-
def list(self, sequence: Sequence[_T], /) -> ListProxy[_T]: ...
333+
def list(self, iterable: Iterable[_T], /) -> ListProxy[_T]: ...
331334
@overload
332335
def list(self) -> ListProxy[Any]: ...
333336
if sys.version_info >= (3, 14):

mypy/typeshed/stdlib/multiprocessing/process.pyi

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
from collections.abc import Callable, Iterable, Mapping
23
from typing import Any
34

@@ -20,6 +21,9 @@ class BaseProcess:
2021
) -> None: ...
2122
def run(self) -> None: ...
2223
def start(self) -> None: ...
24+
if sys.version_info >= (3, 14):
25+
def interrupt(self) -> None: ...
26+
2327
def terminate(self) -> None: ...
2428
def kill(self) -> None: ...
2529
def close(self) -> None: ...

mypy/typeshed/stdlib/multiprocessing/synchronize.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import sys
12
import threading
23
from collections.abc import Callable
34
from multiprocessing.context import BaseContext
@@ -45,6 +46,8 @@ class SemLock:
4546
# These methods are copied from the wrapped _multiprocessing.SemLock object
4647
def acquire(self, block: bool = True, timeout: float | None = None) -> bool: ...
4748
def release(self) -> None: ...
49+
if sys.version_info >= (3, 14):
50+
def locked(self) -> bool: ...
4851

4952
class Lock(SemLock):
5053
def __init__(self, *, ctx: BaseContext) -> None: ...

mypy/typeshed/stdlib/sqlite3/__init__.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ _AdaptedInputData: TypeAlias = _SqliteData | Any
222222
_Parameters: TypeAlias = SupportsLenAndGetItem[_AdaptedInputData] | Mapping[str, _AdaptedInputData]
223223
# Controls the legacy transaction handling mode of sqlite3.
224224
_IsolationLevel: TypeAlias = Literal["DEFERRED", "EXCLUSIVE", "IMMEDIATE"] | None
225+
_RowFactoryOptions: TypeAlias = type[Row] | Callable[[Cursor, Row], object] | None
225226

226227
@type_check_only
227228
class _AnyParamWindowAggregateClass(Protocol):
@@ -300,7 +301,7 @@ class Connection:
300301
def autocommit(self) -> int: ...
301302
@autocommit.setter
302303
def autocommit(self, val: int) -> None: ...
303-
row_factory: Any
304+
row_factory: _RowFactoryOptions
304305
text_factory: Any
305306
if sys.version_info >= (3, 12):
306307
def __init__(
@@ -416,7 +417,7 @@ class Cursor(Iterator[Any]):
416417
def description(self) -> tuple[tuple[str, None, None, None, None, None, None], ...] | MaybeNone: ...
417418
@property
418419
def lastrowid(self) -> int | None: ...
419-
row_factory: Callable[[Cursor, Row], object] | None
420+
row_factory: _RowFactoryOptions
420421
@property
421422
def rowcount(self) -> int: ...
422423
def __init__(self, cursor: Connection, /) -> None: ...

mypy/typeshed/stdlib/subprocess.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,6 @@ elif sys.version_info >= (3, 10):
497497
) -> CompletedProcess[Any]: ...
498498

499499
else:
500-
# 3.9 adds arguments "user", "group", "extra_groups" and "umask"
501500
@overload
502501
def run(
503502
args: _CMD,

0 commit comments

Comments
 (0)