[ty] Sync vendored typeshed stubs (#19174)

Close and reopen this PR to trigger CI

---------

Co-authored-by: typeshedbot <>
Co-authored-by: David Peter <mail@david-peter.de>
This commit is contained in:
github-actions[bot] 2025-07-07 12:00:09 +02:00 committed by GitHub
parent 9be8276616
commit b6edfbc70f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 30 additions and 13 deletions

View file

@ -792,13 +792,13 @@ f(**kwargs<CURSOR>)
assert_snapshot!(test.goto_type_definition(), @r"
info[goto-type-definition]: Type definition
--> stdlib/types.pyi:689:11
--> stdlib/types.pyi:691:11
|
687 | if sys.version_info >= (3, 10):
688 | @final
689 | class NoneType:
689 | if sys.version_info >= (3, 10):
690 | @final
691 | class NoneType:
| ^^^^^^^^
690 | def __bool__(self) -> Literal[False]: ...
692 | def __bool__(self) -> Literal[False]: ...
|
info: Source
--> main.py:3:17

View file

@ -1 +1 @@
3f727b0cd6620b7fca45318dd34542b1e1c7dbfb
f64707592dd3c32f756ddeebd012acb2b072aa0d

View file

@ -1797,7 +1797,7 @@ if sys.version_info >= (3, 13):
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
optimize: Literal[-1, 0, 1, 2] = -1,
) -> AST: ...
) -> mod: ...
else:
@overload
@ -1868,7 +1868,7 @@ else:
*,
type_comments: bool = False,
feature_version: None | int | tuple[int, int] = None,
) -> AST: ...
) -> mod: ...
def literal_eval(node_or_string: str | AST) -> Any: ...

View file

@ -1,4 +1,4 @@
# ruff: noqa: PLR5501 # This condition is so big, it's clearer to keep to platform condition in two blocks
# This condition is so big, it's clearer to keep to platform condition in two blocks
# Can't NOQA on a specific line: https://github.com/plinss/flake8-noqa/issues/22
import sys
from collections.abc import Awaitable, Coroutine, Generator

View file

@ -707,7 +707,7 @@ class bytes(Sequence[int]):
def strip(self, bytes: ReadableBuffer | None = None, /) -> bytes: ...
def swapcase(self) -> bytes: ...
def title(self) -> bytes: ...
def translate(self, table: ReadableBuffer | None, /, delete: bytes = b"") -> bytes: ...
def translate(self, table: ReadableBuffer | None, /, delete: ReadableBuffer = b"") -> bytes: ...
def upper(self) -> bytes: ...
def zfill(self, width: SupportsIndex, /) -> bytes: ...
@classmethod

View file

@ -108,6 +108,8 @@ class UserDict(MutableMapping[_KT, _VT]):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload
def get(self, key: _KT, default: _T) -> _VT | _T: ...
class UserList(MutableSequence[_T]):
@ -452,6 +454,8 @@ class ChainMap(MutableMapping[_KT, _VT]):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload
def get(self, key: _KT, default: _T) -> _VT | _T: ...
def __missing__(self, key: _KT) -> _VT: ... # undocumented
def __bool__(self) -> bool: ...

View file

@ -140,6 +140,8 @@ if sys.version_info >= (3, 10) and sys.version_info < (3, 12):
@overload
def get(self, name: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, name: _KT, default: _VT) -> _VT: ...
@overload
def get(self, name: _KT, default: _T) -> _VT | _T: ...
def __iter__(self) -> Iterator[_KT]: ...
def __contains__(self, *args: object) -> bool: ...

View file

@ -345,6 +345,10 @@ else:
def _current_frames() -> dict[int, FrameType]: ...
def _getframe(depth: int = 0, /) -> FrameType: ...
if sys.version_info >= (3, 12):
def _getframemodulename(depth: int = 0) -> str | None: ...
def _debugmallocstats() -> None: ...
def __displayhook__(object: object, /) -> None: ...
def __excepthook__(exctype: type[BaseException], value: BaseException, traceback: TracebackType | None, /) -> None: ...

View file

@ -323,7 +323,9 @@ class MappingProxyType(Mapping[_KT, _VT_co]):
@overload
def get(self, key: _KT, /) -> _VT_co | None: ...
@overload
def get(self, key: _KT, default: _VT_co | _T2, /) -> _VT_co | _T2: ...
def get(self, key: _KT, default: _VT_co, /) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
@overload
def get(self, key: _KT, default: _T2, /) -> _VT_co | _T2: ...
def __class_getitem__(cls, item: Any, /) -> GenericAlias: ...
def __reversed__(self) -> Iterator[_KT]: ...
def __or__(self, value: Mapping[_T1, _T2], /) -> dict[_KT | _T1, _VT_co | _T2]: ...

View file

@ -1,5 +1,4 @@
# Since this module defines "overload" it is not recognized by Ruff as typing.overload
# ruff: noqa: F811
# TODO: The collections import is required, otherwise mypy crashes.
# https://github.com/python/mypy/issues/16744
import collections # noqa: F401 # pyright: ignore[reportUnusedImport]
@ -746,7 +745,9 @@ class Mapping(Collection[_KT], Generic[_KT, _VT_co]):
@overload
def get(self, key: _KT, /) -> _VT_co | None: ...
@overload
def get(self, key: _KT, /, default: _VT_co | _T) -> _VT_co | _T: ...
def get(self, key: _KT, /, default: _VT_co) -> _VT_co: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues] # Covariant type as parameter
@overload
def get(self, key: _KT, /, default: _T) -> _VT_co | _T: ...
def items(self) -> ItemsView[_KT, _VT_co]: ...
def keys(self) -> KeysView[_KT]: ...
def values(self) -> ValuesView[_VT_co]: ...

View file

@ -99,6 +99,8 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload
def get(self, key: _KT, default: _T) -> _VT | _T: ...
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore[override]
@ -149,6 +151,8 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]):
@overload
def get(self, key: _KT, default: None = None) -> _VT | None: ...
@overload
def get(self, key: _KT, default: _VT) -> _VT: ...
@overload
def get(self, key: _KT, default: _T) -> _VT | _T: ...
# These are incompatible with Mapping
def keys(self) -> Iterator[_KT]: ... # type: ignore[override]