Normalise use of Never vs NoReturn (#8549)

This commit is contained in:
Alex Waygood
2022-08-17 22:53:40 +02:00
committed by GitHub
parent 0b28177268
commit 2c052651e9
4 changed files with 18 additions and 17 deletions

View File

@@ -18,7 +18,7 @@ from types import (
TracebackType,
WrapperDescriptorType,
)
from typing_extensions import ParamSpec as _ParamSpec, final as _final
from typing_extensions import Never as _Never, ParamSpec as _ParamSpec, final as _final
__all__ = [
"AbstractSet",
@@ -791,13 +791,13 @@ class _TypedDict(Mapping[str, object], metaclass=ABCMeta):
__required_keys__: ClassVar[frozenset[str]]
__optional_keys__: ClassVar[frozenset[str]]
def copy(self: _typeshed.Self) -> _typeshed.Self: ...
# Using NoReturn so that only calls using mypy plugin hook that specialize the signature
# Using Never so that only calls using mypy plugin hook that specialize the signature
# can go through.
def setdefault(self, k: NoReturn, default: object) -> object: ...
def setdefault(self, k: _Never, default: object) -> object: ...
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
def pop(self, k: _Never, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
def update(self: _T, __m: _T) -> None: ...
def __delitem__(self, k: NoReturn) -> None: ...
def __delitem__(self, k: _Never) -> None: ...
def items(self) -> dict_items[str, object]: ...
def keys(self) -> dict_keys[str, object]: ...
def values(self) -> dict_values[str, object]: ...