mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-09 13:34:58 +08:00
stdlib: remove unused type: ignore comments (#11061)
This commit is contained in:
@@ -47,11 +47,11 @@ _StrToStrEncoding: TypeAlias = Literal["rot13", "rot_13"]
|
||||
@overload
|
||||
def encode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ...
|
||||
@overload
|
||||
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[misc]
|
||||
def encode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def encode(obj: str, encoding: str = "utf-8", errors: str = "strict") -> bytes: ...
|
||||
@overload
|
||||
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[misc]
|
||||
def decode(obj: ReadableBuffer, encoding: _BytesToBytesEncoding, errors: str = "strict") -> bytes: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def decode(obj: str, encoding: _StrToStrEncoding, errors: str = "strict") -> str: ...
|
||||
|
||||
|
||||
@@ -172,7 +172,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
) -> None: ...
|
||||
|
||||
@overload
|
||||
def parse_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ... # type: ignore[misc]
|
||||
def parse_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ...
|
||||
@overload
|
||||
def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
|
||||
@overload
|
||||
@@ -211,7 +211,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
def format_usage(self) -> str: ...
|
||||
def format_help(self) -> str: ...
|
||||
@overload
|
||||
def parse_known_args(self, args: Sequence[str] | None = None, namespace: None = None) -> tuple[Namespace, list[str]]: ... # type: ignore[misc]
|
||||
def parse_known_args(self, args: Sequence[str] | None = None, namespace: None = None) -> tuple[Namespace, list[str]]: ...
|
||||
@overload
|
||||
def parse_known_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]: ...
|
||||
@overload
|
||||
@@ -220,13 +220,15 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
|
||||
def exit(self, status: int = 0, message: str | None = None) -> NoReturn: ...
|
||||
def error(self, message: str) -> NoReturn: ...
|
||||
@overload
|
||||
def parse_intermixed_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ... # type: ignore[misc]
|
||||
def parse_intermixed_args(self, args: Sequence[str] | None = None, namespace: None = None) -> Namespace: ...
|
||||
@overload
|
||||
def parse_intermixed_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ...
|
||||
@overload
|
||||
def parse_intermixed_args(self, *, namespace: _N) -> _N: ...
|
||||
@overload
|
||||
def parse_known_intermixed_args(self, args: Sequence[str] | None = None, namespace: None = None) -> tuple[Namespace, list[str]]: ... # type: ignore[misc]
|
||||
def parse_known_intermixed_args(
|
||||
self, args: Sequence[str] | None = None, namespace: None = None
|
||||
) -> tuple[Namespace, list[str]]: ...
|
||||
@overload
|
||||
def parse_known_intermixed_args(self, args: Sequence[str] | None, namespace: _N) -> tuple[_N, list[str]]: ...
|
||||
@overload
|
||||
|
||||
@@ -86,7 +86,7 @@ else:
|
||||
) -> Iterator[Future[_T]]: ...
|
||||
|
||||
@overload
|
||||
def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = None) -> _FT: ... # type: ignore[misc]
|
||||
def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = None) -> _FT: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | None = None) -> Task[_T]: ...
|
||||
|
||||
@@ -95,17 +95,16 @@ def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | No
|
||||
# zip() because typing does not support variadic type variables. See
|
||||
# typing PR #1550 for discussion.
|
||||
#
|
||||
# The many type: ignores here are because the overloads overlap,
|
||||
# but having overlapping overloads is the only way to get acceptable type inference in all edge cases.
|
||||
# N.B. Having overlapping overloads is the only way to get acceptable type inference in all edge cases.
|
||||
if sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: Literal[False] = False) -> Future[tuple[_T1]]: ... # type: ignore[misc]
|
||||
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: Literal[False] = False) -> Future[tuple[_T1]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1], __coro_or_future2: _FutureLike[_T2], *, return_exceptions: Literal[False] = False
|
||||
) -> Future[tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -113,7 +112,7 @@ if sys.version_info >= (3, 10):
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -122,7 +121,7 @@ if sys.version_info >= (3, 10):
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -132,7 +131,7 @@ if sys.version_info >= (3, 10):
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -143,15 +142,15 @@ if sys.version_info >= (3, 10):
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
|
||||
@overload
|
||||
def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: Literal[False] = False) -> Future[list[_T]]: ... # type: ignore[misc]
|
||||
def gather(*coros_or_futures: _FutureLike[_T], return_exceptions: Literal[False] = False) -> Future[list[_T]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ... # type: ignore[misc]
|
||||
def gather(__coro_or_future1: _FutureLike[_T1], *, return_exceptions: bool) -> Future[tuple[_T1 | BaseException]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1], __coro_or_future2: _FutureLike[_T2], *, return_exceptions: bool
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -159,7 +158,7 @@ if sys.version_info >= (3, 10):
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -168,7 +167,7 @@ if sys.version_info >= (3, 10):
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -180,7 +179,7 @@ if sys.version_info >= (3, 10):
|
||||
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
|
||||
]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -204,11 +203,11 @@ if sys.version_info >= (3, 10):
|
||||
|
||||
else:
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = None, return_exceptions: Literal[False] = False
|
||||
) -> Future[tuple[_T1]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
*,
|
||||
@@ -216,7 +215,7 @@ else:
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -225,7 +224,7 @@ else:
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -235,7 +234,7 @@ else:
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -246,7 +245,7 @@ else:
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -258,15 +257,15 @@ else:
|
||||
return_exceptions: Literal[False] = False,
|
||||
) -> Future[tuple[_T1, _T2, _T3, _T4, _T5, _T6]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
*coros_or_futures: _FutureLike[_T], loop: AbstractEventLoop | None = None, return_exceptions: Literal[False] = False
|
||||
) -> Future[list[_T]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1], *, loop: AbstractEventLoop | None = None, return_exceptions: bool
|
||||
) -> Future[tuple[_T1 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
*,
|
||||
@@ -274,7 +273,7 @@ else:
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -283,7 +282,7 @@ else:
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -293,7 +292,7 @@ else:
|
||||
return_exceptions: bool,
|
||||
) -> Future[tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException]]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather( # type: ignore[overload-overlap]
|
||||
__coro_or_future1: _FutureLike[_T1],
|
||||
__coro_or_future2: _FutureLike[_T2],
|
||||
__coro_or_future3: _FutureLike[_T3],
|
||||
@@ -314,7 +313,7 @@ else:
|
||||
]
|
||||
]: ...
|
||||
@overload
|
||||
def gather( # type: ignore[misc]
|
||||
def gather(
|
||||
*coros_or_futures: _FutureLike[_T], loop: AbstractEventLoop | None = None, return_exceptions: bool
|
||||
) -> Future[list[_T | BaseException]]: ...
|
||||
|
||||
@@ -338,7 +337,9 @@ else:
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
@overload
|
||||
async def wait(fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED") -> tuple[set[_FT], set[_FT]]: ... # type: ignore[misc]
|
||||
async def wait(
|
||||
fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> tuple[set[_FT], set[_FT]]: ...
|
||||
@overload
|
||||
async def wait(
|
||||
fs: Iterable[Task[_T]], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
@@ -346,7 +347,9 @@ if sys.version_info >= (3, 11):
|
||||
|
||||
elif sys.version_info >= (3, 10):
|
||||
@overload
|
||||
async def wait(fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED") -> tuple[set[_FT], set[_FT]]: ... # type: ignore[misc]
|
||||
async def wait( # type: ignore[overload-overlap]
|
||||
fs: Iterable[_FT], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
) -> tuple[set[_FT], set[_FT]]: ...
|
||||
@overload
|
||||
async def wait(
|
||||
fs: Iterable[Awaitable[_T]], *, timeout: float | None = None, return_when: str = "ALL_COMPLETED"
|
||||
@@ -354,7 +357,7 @@ elif sys.version_info >= (3, 10):
|
||||
|
||||
else:
|
||||
@overload
|
||||
async def wait( # type: ignore[misc]
|
||||
async def wait( # type: ignore[overload-overlap]
|
||||
fs: Iterable[_FT],
|
||||
*,
|
||||
loop: AbstractEventLoop | None = None,
|
||||
|
||||
@@ -1795,11 +1795,11 @@ _SupportsSumNoDefaultT = TypeVar("_SupportsSumNoDefaultT", bound=_SupportsSumWit
|
||||
# Instead, we special-case the most common examples of this: bool and literal integers.
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = 0) -> int: ... # type: ignore[misc]
|
||||
def sum(__iterable: Iterable[bool | _LiteralInteger], start: int = 0) -> int: ... # type: ignore[overload-overlap]
|
||||
|
||||
else:
|
||||
@overload
|
||||
def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = 0) -> int: ... # type: ignore[misc]
|
||||
def sum(__iterable: Iterable[bool | _LiteralInteger], __start: int = 0) -> int: ... # type: ignore[overload-overlap]
|
||||
|
||||
@overload
|
||||
def sum(__iterable: Iterable[_SupportsSumNoDefaultT]) -> _SupportsSumNoDefaultT | Literal[0]: ...
|
||||
@@ -1816,7 +1816,7 @@ else:
|
||||
# (A "SupportsDunderDict" protocol doesn't work)
|
||||
# Use a type: ignore to make complaints about overlapping overloads go away
|
||||
@overload
|
||||
def vars(__object: type) -> types.MappingProxyType[str, Any]: ... # type: ignore[misc]
|
||||
def vars(__object: type) -> types.MappingProxyType[str, Any]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def vars(__object: Any = ...) -> dict[str, Any]: ...
|
||||
|
||||
|
||||
@@ -87,9 +87,9 @@ class UserDict(MutableMapping[_KT, _VT]):
|
||||
def __or__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
|
||||
@overload
|
||||
def __or__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ...
|
||||
@overload # type: ignore[misc]
|
||||
@overload
|
||||
def __ror__(self, other: UserDict[_KT, _VT] | dict[_KT, _VT]) -> Self: ...
|
||||
@overload # type: ignore[misc]
|
||||
@overload
|
||||
def __ror__(self, other: UserDict[_T1, _T2] | dict[_T1, _T2]) -> UserDict[_KT | _T1, _VT | _T2]: ...
|
||||
# UserDict.__ior__ should be kept roughly in line with MutableMapping.update()
|
||||
@overload # type: ignore[misc]
|
||||
|
||||
@@ -50,7 +50,7 @@ def copy_context() -> Context: ...
|
||||
class Context(Mapping[ContextVar[Any], Any]):
|
||||
def __init__(self) -> None: ...
|
||||
@overload
|
||||
def get(self, __key: ContextVar[_T], __default: None = None) -> _T | None: ... # type: ignore[misc] # overlapping overloads
|
||||
def get(self, __key: ContextVar[_T], __default: None = None) -> _T | None: ...
|
||||
@overload
|
||||
def get(self, __key: ContextVar[_T], __default: _T) -> _T: ...
|
||||
@overload
|
||||
|
||||
@@ -207,7 +207,7 @@ if sys.version_info >= (3, 12):
|
||||
|
||||
elif sys.version_info >= (3, 10):
|
||||
@overload
|
||||
def entry_points() -> SelectableGroups: ... # type: ignore[misc]
|
||||
def entry_points() -> SelectableGroups: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def entry_points(
|
||||
*, name: str = ..., value: str = ..., group: str = ..., module: str = ..., attr: str = ..., extras: list[str] = ...
|
||||
|
||||
@@ -94,7 +94,7 @@ class BufferedIOBase(IOBase):
|
||||
|
||||
class FileIO(RawIOBase, BinaryIO): # type: ignore[misc] # incompatible definitions of writelines in the base classes
|
||||
mode: str
|
||||
name: FileDescriptorOrPath # type: ignore[assignment]
|
||||
name: FileDescriptorOrPath
|
||||
def __init__(
|
||||
self, file: FileDescriptorOrPath, mode: str = ..., closefd: bool = ..., opener: _Opener | None = ...
|
||||
) -> None: ...
|
||||
|
||||
@@ -125,7 +125,7 @@ def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ...
|
||||
|
||||
if sys.version_info >= (3, 8):
|
||||
@overload
|
||||
def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = 1) -> int: ... # type: ignore[misc]
|
||||
def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = 1) -> int: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = 1) -> float: ...
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]):
|
||||
unsetenv: Callable[[AnyStr, AnyStr], object],
|
||||
) -> None: ...
|
||||
|
||||
def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... # type: ignore[override]
|
||||
def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ...
|
||||
def copy(self) -> dict[AnyStr, AnyStr]: ...
|
||||
def __delitem__(self, key: AnyStr) -> None: ...
|
||||
def __getitem__(self, key: AnyStr) -> AnyStr: ...
|
||||
|
||||
@@ -67,7 +67,7 @@ class Match(Generic[AnyStr]):
|
||||
@overload
|
||||
def expand(self: Match[str], template: str) -> str: ...
|
||||
@overload
|
||||
def expand(self: Match[bytes], template: ReadableBuffer) -> bytes: ... # type: ignore[misc]
|
||||
def expand(self: Match[bytes], template: ReadableBuffer) -> bytes: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def expand(self, template: AnyStr) -> AnyStr: ...
|
||||
# group() returns "AnyStr" or "AnyStr | None", depending on the pattern.
|
||||
@@ -117,19 +117,19 @@ class Pattern(Generic[AnyStr]):
|
||||
@overload
|
||||
def search(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Match[str] | None: ...
|
||||
@overload
|
||||
def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... # type: ignore[misc]
|
||||
def search(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def search(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
def match(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Match[str] | None: ...
|
||||
@overload
|
||||
def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... # type: ignore[misc]
|
||||
def match(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def match(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
def fullmatch(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Match[str] | None: ...
|
||||
@overload
|
||||
def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... # type: ignore[misc]
|
||||
def fullmatch(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Match[bytes] | None: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def fullmatch(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Match[AnyStr] | None: ...
|
||||
@overload
|
||||
@@ -148,13 +148,13 @@ class Pattern(Generic[AnyStr]):
|
||||
@overload
|
||||
def finditer(self: Pattern[str], string: str, pos: int = 0, endpos: int = sys.maxsize) -> Iterator[Match[str]]: ...
|
||||
@overload
|
||||
def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Iterator[Match[bytes]]: ... # type: ignore[misc]
|
||||
def finditer(self: Pattern[bytes], string: ReadableBuffer, pos: int = 0, endpos: int = sys.maxsize) -> Iterator[Match[bytes]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def finditer(self, string: AnyStr, pos: int = 0, endpos: int = sys.maxsize) -> Iterator[Match[AnyStr]]: ...
|
||||
@overload
|
||||
def sub(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> str: ...
|
||||
@overload
|
||||
def sub( # type: ignore[misc]
|
||||
def sub( # type: ignore[overload-overlap]
|
||||
self: Pattern[bytes],
|
||||
repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer],
|
||||
string: ReadableBuffer,
|
||||
@@ -165,7 +165,7 @@ class Pattern(Generic[AnyStr]):
|
||||
@overload
|
||||
def subn(self: Pattern[str], repl: str | Callable[[Match[str]], str], string: str, count: int = 0) -> tuple[str, int]: ...
|
||||
@overload
|
||||
def subn( # type: ignore[misc]
|
||||
def subn( # type: ignore[overload-overlap]
|
||||
self: Pattern[bytes],
|
||||
repl: ReadableBuffer | Callable[[Match[bytes]], ReadableBuffer],
|
||||
string: ReadableBuffer,
|
||||
|
||||
@@ -16,7 +16,7 @@ class Shelf(MutableMapping[str, _VT]):
|
||||
def __iter__(self) -> Iterator[str]: ...
|
||||
def __len__(self) -> int: ...
|
||||
@overload # type: ignore[override]
|
||||
def get(self, key: str, default: None = None) -> _VT | None: ... # type: ignore[misc] # overlapping overloads
|
||||
def get(self, key: str, default: None = None) -> _VT | None: ...
|
||||
@overload
|
||||
def get(self, key: str, default: _VT) -> _VT: ...
|
||||
@overload
|
||||
|
||||
@@ -629,7 +629,7 @@ class TemporaryDirectory(Generic[AnyStr]):
|
||||
|
||||
# The overloads overlap, but they should still work fine.
|
||||
@overload
|
||||
def mkstemp( # type: ignore[misc]
|
||||
def mkstemp( # type: ignore[overload-overlap]
|
||||
suffix: str | None = None, prefix: str | None = None, dir: StrPath | None = None, text: bool = False
|
||||
) -> tuple[int, str]: ...
|
||||
@overload
|
||||
@@ -639,7 +639,7 @@ def mkstemp(
|
||||
|
||||
# The overloads overlap, but they should still work fine.
|
||||
@overload
|
||||
def mkdtemp(suffix: str | None = None, prefix: str | None = None, dir: StrPath | None = None) -> str: ... # type: ignore[misc]
|
||||
def mkdtemp(suffix: str | None = None, prefix: str | None = None, dir: StrPath | None = None) -> str: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def mkdtemp(suffix: bytes | None = None, prefix: bytes | None = None, dir: BytesPath | None = None) -> bytes: ...
|
||||
def mktemp(suffix: str = "", prefix: str = "tmp", dir: StrPath | None = None) -> str: ...
|
||||
|
||||
@@ -1039,7 +1039,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
|
||||
@overload
|
||||
def heading(self, column: str | int, option: str) -> Any: ...
|
||||
@overload
|
||||
def heading(self, column: str | int, option: None = None) -> _TreeviewHeaderDict: ... # type: ignore[misc]
|
||||
def heading(self, column: str | int, option: None = None) -> _TreeviewHeaderDict: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def heading(
|
||||
self,
|
||||
@@ -1083,7 +1083,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView):
|
||||
@overload
|
||||
def item(self, item: str | int, option: str) -> Any: ...
|
||||
@overload
|
||||
def item(self, item: str | int, option: None = None) -> _TreeviewItemDict: ... # type: ignore[misc]
|
||||
def item(self, item: str | int, option: None = None) -> _TreeviewItemDict: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def item(
|
||||
self,
|
||||
|
||||
@@ -336,7 +336,7 @@ class TPen:
|
||||
def isvisible(self) -> bool: ...
|
||||
# Note: signatures 1 and 2 overlap unsafely when no arguments are provided
|
||||
@overload
|
||||
def pen(self) -> _PenState: ... # type: ignore[misc]
|
||||
def pen(self) -> _PenState: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def pen(
|
||||
self,
|
||||
@@ -382,7 +382,7 @@ class RawTurtle(TPen, TNavigator):
|
||||
def shape(self, name: str) -> None: ...
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapesize(self) -> tuple[float, float, float]: ... # type: ignore[misc]
|
||||
def shapesize(self) -> tuple[float, float, float]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def shapesize(
|
||||
self, stretch_wid: float | None = None, stretch_len: float | None = None, outline: float | None = None
|
||||
@@ -393,7 +393,7 @@ class RawTurtle(TPen, TNavigator):
|
||||
def shearfactor(self, shear: float) -> None: ...
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapetransform(self) -> tuple[float, float, float, float]: ... # type: ignore[misc]
|
||||
def shapetransform(self) -> tuple[float, float, float, float]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def shapetransform(
|
||||
self, t11: float | None = None, t12: float | None = None, t21: float | None = None, t22: float | None = None
|
||||
@@ -617,7 +617,7 @@ def isvisible() -> bool: ...
|
||||
|
||||
# Note: signatures 1 and 2 overlap unsafely when no arguments are provided
|
||||
@overload
|
||||
def pen() -> _PenState: ... # type: ignore[misc]
|
||||
def pen() -> _PenState: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def pen(
|
||||
pen: _PenState | None = None,
|
||||
@@ -656,7 +656,7 @@ if sys.version_info >= (3, 12):
|
||||
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapesize() -> tuple[float, float, float]: ... # type: ignore[misc]
|
||||
def shapesize() -> tuple[float, float, float]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def shapesize(stretch_wid: float | None = None, stretch_len: float | None = None, outline: float | None = None) -> None: ...
|
||||
@overload
|
||||
@@ -666,7 +666,7 @@ def shearfactor(shear: float) -> None: ...
|
||||
|
||||
# Unsafely overlaps when no arguments are provided
|
||||
@overload
|
||||
def shapetransform() -> tuple[float, float, float, float]: ... # type: ignore[misc]
|
||||
def shapetransform() -> tuple[float, float, float, float]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def shapetransform(
|
||||
t11: float | None = None, t12: float | None = None, t21: float | None = None, t22: float | None = None
|
||||
|
||||
@@ -593,9 +593,8 @@ _R = TypeVar("_R")
|
||||
_P = ParamSpec("_P")
|
||||
|
||||
# it's not really an Awaitable, but can be used in an await expression. Real type: Generator & Awaitable
|
||||
# The type: ignore is due to overlapping overloads, not the use of ParamSpec
|
||||
@overload
|
||||
def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Awaitable[_R]]: ... # type: ignore[misc]
|
||||
def coroutine(func: Callable[_P, Generator[Any, Any, _R]]) -> Callable[_P, Awaitable[_R]]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def coroutine(func: _Fn) -> _Fn: ...
|
||||
|
||||
|
||||
@@ -318,7 +318,7 @@ class _patcher:
|
||||
# Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock],
|
||||
# but that's impossible with the current type system.
|
||||
@overload
|
||||
def __call__( # type: ignore[misc]
|
||||
def __call__( # type: ignore[overload-overlap]
|
||||
self,
|
||||
target: str,
|
||||
new: _T,
|
||||
@@ -343,7 +343,7 @@ class _patcher:
|
||||
) -> _patch_default_new: ...
|
||||
@overload
|
||||
@staticmethod
|
||||
def object( # type: ignore[misc]
|
||||
def object(
|
||||
target: Any,
|
||||
attribute: str,
|
||||
new: _T,
|
||||
|
||||
@@ -75,7 +75,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override]
|
||||
def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ...
|
||||
def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ...
|
||||
def setdefault(self, key: _KT, default: _VT) -> _VT: ... # type: ignore[override]
|
||||
def setdefault(self, key: _KT, default: _VT) -> _VT: ...
|
||||
@overload
|
||||
def pop(self, key: _KT) -> _VT: ...
|
||||
@overload
|
||||
|
||||
@@ -82,6 +82,6 @@ class AttributesNSImpl(AttributesImpl):
|
||||
def __contains__(self, name: _NSName) -> bool: ... # type: ignore[override]
|
||||
@overload # type: ignore[override]
|
||||
def get(self, name: _NSName, alternative: None = None) -> str | None: ...
|
||||
@overload # type: ignore[override]
|
||||
@overload
|
||||
def get(self, name: _NSName, alternative: str) -> str: ...
|
||||
def items(self) -> list[tuple[_NSName, str]]: ... # type: ignore[override]
|
||||
|
||||
Reference in New Issue
Block a user