mirror of
https://github.com/astral-sh/ruff.git
synced 2025-07-07 13:15:06 +00:00
[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:
parent
9be8276616
commit
b6edfbc70f
11 changed files with 30 additions and 13 deletions
|
@ -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
|
||||
|
|
|
@ -1 +1 @@
|
|||
3f727b0cd6620b7fca45318dd34542b1e1c7dbfb
|
||||
f64707592dd3c32f756ddeebd012acb2b072aa0d
|
||||
|
|
|
@ -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: ...
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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: ...
|
||||
|
|
|
@ -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: ...
|
||||
|
|
|
@ -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: ...
|
||||
|
|
|
@ -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]: ...
|
||||
|
|
|
@ -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]: ...
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue