mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 04:34:28 +08:00
Eliminated the use of "bare" TypeVars in stdlib stubs (#5041)
Eliminated the use of "bare" TypeVars (i.e. a TypeVar that appears only once) within generic methods. While not considered an error in PEP 484, these are a common source of bugs in code, and some type checkers (including pytype and pyright) flag them as errors. Co-authored-by: Eric Traut <erictr@microsoft.com>
This commit is contained in:
@@ -12,7 +12,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
# can go through.
|
||||
def setdefault(self, k: NoReturn, default: object) -> object: ...
|
||||
# Mypy plugin hook for 'pop' expects that 'default' has a type variable type.
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ...
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # type: ignore
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
if sys.version_info < (3, 0):
|
||||
def has_key(self, k: str) -> bool: ...
|
||||
@@ -25,7 +25,7 @@ class _TypedDict(Mapping[str, object], metaclass=abc.ABCMeta):
|
||||
def values(self) -> ValuesView[object]: ...
|
||||
def __delitem__(self, k: NoReturn) -> None: ...
|
||||
|
||||
def TypedDict(typename: str, fields: Dict[str, Type[_T]], total: bool = ...) -> Type[Dict[str, Any]]: ...
|
||||
def TypedDict(typename: str, fields: Dict[str, Type[Any]], total: bool = ...) -> Type[Dict[str, Any]]: ...
|
||||
def Arg(type: _T = ..., name: Optional[str] = ...) -> _T: ...
|
||||
def DefaultArg(type: _T = ..., name: Optional[str] = ...) -> _T: ...
|
||||
def NamedArg(type: _T = ..., name: Optional[str] = ...) -> _T: ...
|
||||
|
||||
Reference in New Issue
Block a user