Skip to content

Commit 0255e2c

Browse files
authored
Merge branch 'main' into check-exlude-list-order
2 parents c33c1d5 + 6731a33 commit 0255e2c

File tree

81 files changed

+796
-376
lines changed

Some content is hidden

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

81 files changed

+796
-376
lines changed

lib/ts_utils/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def close(self: TemporaryFileWrapper[str]) -> None:
233233
@functools.cache
234234
def get_gitignore_spec() -> pathspec.PathSpec:
235235
with GITIGNORE_PATH.open(encoding="UTF-8") as f:
236-
return pathspec.GitIgnoreSpec.from_lines(f) # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
236+
return pathspec.GitIgnoreSpec.from_lines(f)
237237

238238

239239
def spec_matches_path(spec: pathspec.PathSpec, path: Path) -> bool:

requirements-tests.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ aiohttp==3.13.3
88
grpcio-tools>=1.76.0 # For grpc_tools.protoc
99
mypy-protobuf==4.0.0
1010
packaging==25.0
11-
pathspec>=1.0.0
11+
pathspec>=1.0.3
1212
pre-commit
1313
# Required by create_baseline_stubs.py. Must match .pre-commit-config.yaml.
1414
ruff==0.14.10

stdlib/@tests/test_cases/check_functools.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from functools import cached_property, wraps
3+
from functools import cache, cached_property, wraps
44
from typing import Callable, TypeVar
55
from typing_extensions import ParamSpec, assert_type
66

@@ -96,3 +96,15 @@ class Y(X):
9696
@cached_property
9797
def some(self) -> Child: # safe override
9898
return Child()
99+
100+
101+
class CachedParent:
102+
@cache
103+
def method(self) -> Parent:
104+
return Parent()
105+
106+
107+
class CachedChild(CachedParent):
108+
@cache
109+
def method(self) -> Child:
110+
return Child()
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from __future__ import annotations
2+
3+
import sys
4+
from typing_extensions import assert_type
5+
6+
if sys.version_info >= (3, 13):
7+
from itertools import batched
8+
9+
assert_type(batched([0], 1, strict=True), batched[tuple[int]])
10+
assert_type(batched([0, 0], 2, strict=True), batched[tuple[int, int]])
11+
assert_type(batched([0, 0, 0], 3, strict=True), batched[tuple[int, int, int]])
12+
assert_type(batched([0, 0, 0, 0], 4, strict=True), batched[tuple[int, int, int, int]])
13+
assert_type(batched([0, 0, 0, 0, 0], 5, strict=True), batched[tuple[int, int, int, int, int]])
14+
15+
assert_type(batched([0], 2), batched[tuple[int, ...]])
16+
assert_type(batched([0], 2, strict=False), batched[tuple[int, ...]])
17+
18+
def f() -> int:
19+
return 3
20+
21+
assert_type(batched([0, 0, 0], f(), strict=True), batched[tuple[int, ...]])

stdlib/builtins.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1176,9 +1176,9 @@ class dict(MutableMapping[_KT, _VT]):
11761176
# __init__ should be kept roughly in line with `collections.UserDict.__init__`, which has similar semantics
11771177
# Also multiprocessing.managers.SyncManager.dict()
11781178
@overload
1179-
def __init__(self) -> None: ...
1179+
def __init__(self, /) -> None: ...
11801180
@overload
1181-
def __init__(self: dict[str, _VT], **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
1181+
def __init__(self: dict[str, _VT], /, **kwargs: _VT) -> None: ... # pyright: ignore[reportInvalidTypeVarUse] #11780
11821182
@overload
11831183
def __init__(self, map: SupportsKeysAndGetItem[_KT, _VT], /) -> None: ...
11841184
@overload
@@ -1203,7 +1203,7 @@ class dict(MutableMapping[_KT, _VT]):
12031203
def __init__(self: dict[str, str], iterable: Iterable[list[str]], /) -> None: ...
12041204
@overload
12051205
def __init__(self: dict[bytes, bytes], iterable: Iterable[list[bytes]], /) -> None: ...
1206-
def __new__(cls, *args: Any, **kwargs: Any) -> Self: ...
1206+
def __new__(cls, /, *args: Any, **kwargs: Any) -> Self: ...
12071207
def copy(self) -> dict[_KT, _VT]: ...
12081208
def keys(self) -> dict_keys[_KT, _VT]: ...
12091209
def values(self) -> dict_values[_KT, _VT]: ...

stdlib/cmath.pyi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ nan: Final[float]
99
nanj: Final[complex]
1010
tau: Final[float]
1111

12+
_F: TypeAlias = SupportsFloat | SupportsIndex
1213
_C: TypeAlias = SupportsFloat | SupportsComplex | SupportsIndex | complex
1314

1415
def acos(z: _C, /) -> complex: ...
@@ -27,7 +28,7 @@ def log(z: _C, base: _C = ..., /) -> complex: ...
2728
def log10(z: _C, /) -> complex: ...
2829
def phase(z: _C, /) -> float: ...
2930
def polar(z: _C, /) -> tuple[float, float]: ...
30-
def rect(r: float, phi: float, /) -> complex: ...
31+
def rect(r: _F, phi: _F, /) -> complex: ...
3132
def sin(z: _C, /) -> complex: ...
3233
def sinh(z: _C, /) -> complex: ...
3334
def sqrt(z: _C, /) -> complex: ...

stdlib/ctypes/__init__.pyi

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,12 @@ def create_unicode_buffer(init: int | str, size: int | None = None) -> Array[c_w
169169
if sys.version_info >= (3, 13):
170170
@deprecated("Deprecated since Python 3.13; will be removed in Python 3.15.")
171171
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
172+
@deprecated("Soft deprecated since Python 3.13. Use multiplication instead.")
173+
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ...
172174

173175
else:
174176
def SetPointerType(pointer: type[_Pointer[Any]], cls: _CTypeBaseType) -> None: ...
175-
176-
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ... # Soft Deprecated, no plans to remove
177+
def ARRAY(typ: _CT, len: int) -> Array[_CT]: ...
177178

178179
if sys.platform == "win32":
179180
def DllCanUnloadNow() -> int: ...

stdlib/email/utils.pyi

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,16 +44,7 @@ def parsedate(data: str) -> tuple[int, int, int, int, int, int, int, int, int] |
4444
def parsedate_tz(data: None) -> None: ...
4545
@overload
4646
def parsedate_tz(data: str) -> _PDTZ | None: ...
47-
48-
if sys.version_info >= (3, 10):
49-
@overload
50-
def parsedate_to_datetime(data: None) -> None: ...
51-
@overload
52-
def parsedate_to_datetime(data: str) -> datetime.datetime: ...
53-
54-
else:
55-
def parsedate_to_datetime(data: str) -> datetime.datetime: ...
56-
47+
def parsedate_to_datetime(data: str) -> datetime.datetime: ...
5748
def mktime_tz(data: _PDTZ) -> int: ...
5849
def formatdate(timeval: float | None = None, localtime: bool = False, usegmt: bool = False) -> str: ...
5950
def format_datetime(dt: datetime.datetime, usegmt: bool = False) -> str: ...

stdlib/faulthandler.pyi

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,23 @@ from _typeshed import FileDescriptorLike
33

44
def cancel_dump_traceback_later() -> None: ...
55
def disable() -> None: ...
6-
def dump_traceback(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None: ...
6+
def dump_traceback(file: FileDescriptorLike = sys.stderr, all_threads: bool = True) -> None: ...
77

88
if sys.version_info >= (3, 14):
9-
def dump_c_stack(file: FileDescriptorLike = ...) -> None: ...
9+
def dump_c_stack(file: FileDescriptorLike = sys.stderr) -> None: ...
1010

11-
def dump_traceback_later(timeout: float, repeat: bool = ..., file: FileDescriptorLike = ..., exit: bool = ...) -> None: ...
11+
def dump_traceback_later(
12+
timeout: float, repeat: bool = False, file: FileDescriptorLike = sys.stderr, exit: bool = False
13+
) -> None: ...
1214

1315
if sys.version_info >= (3, 14):
14-
def enable(file: FileDescriptorLike = ..., all_threads: bool = ..., c_stack: bool = True) -> None: ...
16+
def enable(file: FileDescriptorLike = sys.stderr, all_threads: bool = True, c_stack: bool = True) -> None: ...
1517

1618
else:
17-
def enable(file: FileDescriptorLike = ..., all_threads: bool = ...) -> None: ...
19+
def enable(file: FileDescriptorLike = sys.stderr, all_threads: bool = True) -> None: ...
1820

1921
def is_enabled() -> bool: ...
2022

2123
if sys.platform != "win32":
22-
def register(signum: int, file: FileDescriptorLike = ..., all_threads: bool = ..., chain: bool = ...) -> None: ...
24+
def register(signum: int, file: FileDescriptorLike = sys.stderr, all_threads: bool = True, chain: bool = False) -> None: ...
2325
def unregister(signum: int, /) -> None: ...

stdlib/fileinput.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ from _typeshed import AnyStr_co, StrOrBytesPath
33
from collections.abc import Callable, Iterable
44
from types import GenericAlias, TracebackType
55
from typing import IO, Any, AnyStr, Generic, Literal, Protocol, overload, type_check_only
6-
from typing_extensions import Self, TypeAlias
6+
from typing_extensions import Self, TypeAlias, deprecated
77

88
__all__ = [
99
"input",
@@ -207,4 +207,9 @@ if sys.version_info >= (3, 10):
207207
else:
208208
def hook_compressed(filename: StrOrBytesPath, mode: str) -> IO[Any]: ...
209209

210-
def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...
210+
if sys.version_info >= (3, 10):
211+
@deprecated("Deprecated since Python 3.10. Use `fileinput.input` or `fileinput.FileInput` instead.")
212+
def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...
213+
214+
else:
215+
def hook_encoded(encoding: str, errors: str | None = None) -> Callable[[StrOrBytesPath, str], IO[Any]]: ...

0 commit comments

Comments
 (0)