Skip to content

Commit cf9683d

Browse files
authored
Merge branch 'main' into patch-2
2 parents 4bc7b21 + 050ec19 commit cf9683d

23 files changed

+299
-79
lines changed

stdlib/@tests/stubtest_allowlists/py314.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# ====================================================================
44

55
multiprocessing.managers.BaseListProxy.clear
6+
# inspect.signature gives the wrong signature
67
multiprocessing.managers.BaseListProxy.copy
78
multiprocessing.managers.DictProxy.__ior__
89
multiprocessing.managers._BaseDictProxy.__ior__
910
multiprocessing.managers._BaseDictProxy.__or__
1011
multiprocessing.managers._BaseDictProxy.__reversed__
1112
multiprocessing.managers._BaseDictProxy.__ror__
1213
multiprocessing.managers._BaseDictProxy.fromkeys
13-
multiprocessing.synchronize.SemLock.locked
1414

1515

1616
# =========================
@@ -39,6 +39,9 @@ concurrent.interpreters._queues.UNBOUND_REMOVE
3939

4040
importlib.util.Loader.exec_module # See Lib/importlib/_abc.py. Might be defined for backwards compatibility
4141

42+
# Condition functions are exported in __init__
43+
threading.Condition.locked
44+
multiprocessing.dummy.Condition.locked
4245

4346
# ====================================
4447
# Pre-existing errors from Python 3.13

stdlib/mimetypes.pyi

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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: Sequence[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: tuple[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):

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):

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: ...

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:
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: ...

stdlib/threading.pyi

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ class Condition:
144144
) -> None: ...
145145
def acquire(self, blocking: bool = True, timeout: float = -1) -> bool: ...
146146
def release(self) -> None: ...
147+
if sys.version_info >= (3, 14):
148+
def locked(self) -> bool: ...
149+
147150
def wait(self, timeout: float | None = None) -> bool: ...
148151
def wait_for(self, predicate: Callable[[], _T], timeout: float | None = None) -> _T: ...
149152
def notify(self, n: int = 1) -> None: ...

stdlib/unittest/mock.pyi

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ class NonCallableMock(Base, Any):
199199
call_count: int
200200
call_args: _Call | MaybeNone
201201
call_args_list: _CallList
202+
method_calls: _CallList
202203
mock_calls: _CallList
203204
def _format_mock_call_signature(self, args: Any, kwargs: Any) -> str: ...
204205
def _call_matcher(self, _call: tuple[_Call, ...]) -> _Call: ...

stubs/docker/docker/api/daemon.pyi

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
from _typeshed import Incomplete
21
from datetime import datetime
3-
from typing import Any
2+
from typing import Any, Literal, overload
43

54
from docker.types.daemon import CancellableStream
65

76
class DaemonApiMixin:
87
def df(self) -> dict[str, Any]: ...
8+
@overload
99
def events(
1010
self,
1111
since: datetime | int | None = None,
1212
until: datetime | int | None = None,
1313
filters: dict[str, Any] | None = None,
14-
decode: bool | None = None,
15-
) -> CancellableStream[Incomplete]: ...
14+
decode: Literal[False] | None = None,
15+
) -> CancellableStream[str]: ...
16+
@overload
17+
def events(
18+
self,
19+
since: datetime | int | None = None,
20+
until: datetime | int | None = None,
21+
filters: dict[str, Any] | None = None,
22+
decode: Literal[True] = ...,
23+
) -> CancellableStream[dict[str, Any]]: ...
1624
def info(self) -> dict[str, Any]: ...
1725
def login(
1826
self,

stubs/docker/docker/client.pyi

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from collections.abc import Iterable
2-
from typing import NoReturn, Protocol, type_check_only
2+
from typing import Any, Literal, NoReturn, Protocol, overload, type_check_only
33

44
from docker import APIClient
55
from docker.models.configs import ConfigCollection
@@ -12,6 +12,7 @@ from docker.models.secrets import SecretCollection
1212
from docker.models.services import ServiceCollection
1313
from docker.models.swarm import Swarm
1414
from docker.models.volumes import VolumeCollection
15+
from docker.types import CancellableStream
1516

1617
@type_check_only
1718
class _Environ(Protocol):
@@ -51,13 +52,16 @@ class DockerClient:
5152
def swarm(self) -> Swarm: ...
5253
@property
5354
def volumes(self) -> VolumeCollection: ...
54-
def events(self, *args, **kwargs): ...
55-
def df(self): ...
56-
def info(self, *args, **kwargs): ...
57-
def login(self, *args, **kwargs): ...
58-
def ping(self, *args, **kwargs): ...
59-
def version(self, *args, **kwargs): ...
60-
def close(self): ...
55+
@overload
56+
def events(self, *args, decode: Literal[False] | None = None, **kwargs) -> CancellableStream[str]: ...
57+
@overload
58+
def events(self, *args, decode: Literal[True] = ..., **kwargs) -> CancellableStream[dict[str, Any]]: ...
59+
def df(self) -> dict[str, Any]: ...
60+
def info(self, *args, **kwargs) -> dict[str, Any]: ...
61+
def login(self, *args, **kwargs) -> dict[str, Any]: ...
62+
def ping(self, *args, **kwargs) -> bool: ...
63+
def version(self, *args, **kwargs) -> dict[str, Any]: ...
64+
def close(self) -> None: ...
6165
def __getattr__(self, name: str) -> NoReturn: ...
6266

6367
from_env = DockerClient.from_env

stubs/docker/docker/models/images.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Image(Model):
2626
def tags(self) -> list[str]: ...
2727
def history(self) -> list[Any]: ...
2828
def remove(self, force: bool = False, noprune: bool = False) -> dict[str, Any]: ...
29-
def save(self, chunk_size: int = 2097152, named: bool = False) -> Iterator[Any]: ...
29+
def save(self, chunk_size: int = 2097152, named: str | bool = False) -> Iterator[Any]: ...
3030
def tag(self, repository: str, tag: str | None = None, **kwargs) -> bool: ...
3131

3232
class RegistryData(Model):

0 commit comments

Comments
 (0)