mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-02-12 13:11:42 +08:00
Forbid extremely long line lengths in non-autogenerated stubs (#12537)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
@@ -33,7 +33,8 @@ from collections.abc import Awaitable, Callable, Iterable, Iterator, MutableSet,
|
||||
from io import BufferedRandom, BufferedReader, BufferedWriter, FileIO, TextIOWrapper
|
||||
from types import CellType, CodeType, TracebackType
|
||||
|
||||
# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping} are imported from collections.abc in builtins.pyi
|
||||
# mypy crashes if any of {ByteString, Sequence, MutableSequence, Mapping, MutableMapping}
|
||||
# are imported from collections.abc in builtins.pyi
|
||||
from typing import ( # noqa: Y022
|
||||
IO,
|
||||
Any,
|
||||
@@ -1084,7 +1085,8 @@ class dict(MutableMapping[_KT, _VT]):
|
||||
def keys(self) -> dict_keys[_KT, _VT]: ...
|
||||
def values(self) -> dict_values[_KT, _VT]: ...
|
||||
def items(self) -> dict_items[_KT, _VT]: ...
|
||||
# Signature of `dict.fromkeys` should be kept identical to `fromkeys` methods of `OrderedDict`/`ChainMap`/`UserDict` in `collections`
|
||||
# Signature of `dict.fromkeys` should be kept identical to
|
||||
# `fromkeys` methods of `OrderedDict`/`ChainMap`/`UserDict` in `collections`
|
||||
# TODO: the true signature of `dict.fromkeys` is not expressible in the current type system.
|
||||
# See #3800 & https://github.com/python/typing/issues/548#issuecomment-683336963.
|
||||
@classmethod
|
||||
|
||||
@@ -475,7 +475,8 @@ class ChainMap(MutableMapping[_KT, _VT]):
|
||||
def pop(self, key: _KT, default: _T) -> _VT | _T: ...
|
||||
def copy(self) -> Self: ...
|
||||
__copy__ = copy
|
||||
# All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime, so the signature should be kept in line with `dict.fromkeys`.
|
||||
# All arguments to `fromkeys` are passed to `dict.fromkeys` at runtime,
|
||||
# so the signature should be kept in line with `dict.fromkeys`.
|
||||
@classmethod
|
||||
@overload
|
||||
def fromkeys(cls, iterable: Iterable[_T]) -> ChainMap[_T, Any | None]: ...
|
||||
|
||||
@@ -50,7 +50,8 @@ class Message(Generic[_HeaderT, _HeaderParamT]):
|
||||
def get_payload(self, i: None = None, *, decode: Literal[True]) -> _EncodedPayloadType | Any: ...
|
||||
@overload # not multipart, IDEM but w/o kwarg
|
||||
def get_payload(self, i: None, decode: Literal[True]) -> _EncodedPayloadType | Any: ...
|
||||
# If `charset=None` and payload supports both `encode` AND `decode`, then an invalid payload could be passed, but this is unlikely
|
||||
# If `charset=None` and payload supports both `encode` AND `decode`,
|
||||
# then an invalid payload could be passed, but this is unlikely
|
||||
# Not[_SupportsEncodeToPayload]
|
||||
@overload
|
||||
def set_payload(
|
||||
|
||||
@@ -86,7 +86,7 @@ class FTP:
|
||||
def makeport(self) -> socket: ...
|
||||
def makepasv(self) -> tuple[str, int]: ...
|
||||
def login(self, user: str = "", passwd: str = "", acct: str = "") -> str: ...
|
||||
# In practice, `rest` rest can actually be anything whose str() is an integer sequence, so to make it simple we allow integers.
|
||||
# In practice, `rest` can actually be anything whose str() is an integer sequence, so to make it simple we allow integers
|
||||
def ntransfercmd(self, cmd: str, rest: int | str | None = None) -> tuple[socket, int | None]: ...
|
||||
def transfercmd(self, cmd: str, rest: int | str | None = None) -> socket: ...
|
||||
def retrbinary(
|
||||
|
||||
@@ -365,7 +365,9 @@ class stat_result(structseq[float], tuple[int, int, int, int, int, int, int, flo
|
||||
if sys.version_info >= (3, 12) and sys.platform == "win32":
|
||||
@property
|
||||
@deprecated(
|
||||
"Use st_birthtime instead to retrieve the file creation time. In the future, this property will contain the last metadata change time."
|
||||
"""\
|
||||
Use st_birthtime instead to retrieve the file creation time. \
|
||||
In the future, this property will contain the last metadata change time."""
|
||||
)
|
||||
def st_ctime(self) -> float: ...
|
||||
else:
|
||||
|
||||
@@ -67,5 +67,6 @@ class POP3_SSL(POP3):
|
||||
timeout: float = ...,
|
||||
context: ssl.SSLContext | None = None,
|
||||
) -> None: ...
|
||||
# "context" is actually the last argument, but that breaks LSP and it doesn't really matter because all the arguments are ignored
|
||||
# "context" is actually the last argument,
|
||||
# but that breaks LSP and it doesn't really matter because all the arguments are ignored
|
||||
def stls(self, context: Any = None, keyfile: Any = None, certfile: Any = None) -> NoReturn: ...
|
||||
|
||||
@@ -556,7 +556,9 @@ class Notebook(Widget):
|
||||
sticky: str = ..., # consists of letters 'n', 's', 'w', 'e', no repeats, may be empty
|
||||
padding: _Padding = ...,
|
||||
text: str = ...,
|
||||
image=..., # Sequence of an image name, followed by zero or more (sequences of one or more state names followed by an image name)
|
||||
# `image` is a sequence of an image name, followed by zero or more
|
||||
# (sequences of one or more state names followed by an image name)
|
||||
image=...,
|
||||
compound: tkinter._Compound = ...,
|
||||
underline: int = ...,
|
||||
) -> None: ...
|
||||
|
||||
Reference in New Issue
Block a user