mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 13:02:22 +08:00
Use error codes for type ignores (#8280)
Disable reportSelfClsParameterName for pytype as this is out of typeshed's control Closes: #7497
This commit is contained in:
@@ -85,7 +85,7 @@ class object:
|
||||
def __class__(self: Self) -> type[Self]: ...
|
||||
# Ignore errors about type mismatch between property getter and setter
|
||||
@__class__.setter
|
||||
def __class__(self, __type: type[object]) -> None: ... # type: ignore # noqa: F811
|
||||
def __class__(self, __type: type[object]) -> None: ... # noqa: F811
|
||||
def __init__(self) -> None: ...
|
||||
def __new__(cls: type[Self]) -> Self: ...
|
||||
# N.B. `object.__setattr__` and `object.__delattr__` are heavily special-cased by type checkers.
|
||||
|
||||
@@ -192,7 +192,7 @@ class _SimpleCData(Generic[_T], _CData):
|
||||
value: _T
|
||||
# The TypeVar can be unsolved here,
|
||||
# but we can't use overloads without creating many, many mypy false-positive errors
|
||||
def __init__(self, value: _T = ...) -> None: ... # type: ignore
|
||||
def __init__(self, value: _T = ...) -> None: ... # pyright: ignore[reportInvalidTypeVarUse]
|
||||
|
||||
class c_byte(_SimpleCData[int]): ...
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ class _EnumDict(dict[str, Any]):
|
||||
class EnumMeta(ABCMeta):
|
||||
if sys.version_info >= (3, 11):
|
||||
def __new__(
|
||||
metacls: type[Self], # type: ignore
|
||||
metacls: type[Self],
|
||||
cls: str,
|
||||
bases: tuple[type, ...],
|
||||
classdict: _EnumDict,
|
||||
@@ -90,9 +90,9 @@ class EnumMeta(ABCMeta):
|
||||
**kwds: Any,
|
||||
) -> Self: ...
|
||||
elif sys.version_info >= (3, 9):
|
||||
def __new__(metacls: type[Self], cls: str, bases: tuple[type, ...], classdict: _EnumDict, **kwds: Any) -> Self: ... # type: ignore
|
||||
def __new__(metacls: type[Self], cls: str, bases: tuple[type, ...], classdict: _EnumDict, **kwds: Any) -> Self: ...
|
||||
else:
|
||||
def __new__(metacls: type[Self], cls: str, bases: tuple[type, ...], classdict: _EnumDict) -> Self: ... # type: ignore
|
||||
def __new__(metacls: type[Self], cls: str, bases: tuple[type, ...], classdict: _EnumDict) -> Self: ...
|
||||
|
||||
if sys.version_info >= (3, 9):
|
||||
@classmethod
|
||||
|
||||
@@ -170,7 +170,7 @@ class MetadataPathFinder(DistributionFinder):
|
||||
def find_distributions(cls, context: DistributionFinder.Context = ...) -> Iterable[PathDistribution]: ...
|
||||
if sys.version_info >= (3, 10):
|
||||
# Yes, this is an instance method that has argumend named "cls"
|
||||
def invalidate_caches(cls) -> None: ... # type: ignore
|
||||
def invalidate_caches(cls) -> None: ...
|
||||
|
||||
class PathDistribution(Distribution):
|
||||
def __init__(self, path: Path) -> None: ...
|
||||
|
||||
@@ -91,8 +91,14 @@ class CompletedProcess(Generic[_T]):
|
||||
# and writing all the overloads would be horrific.
|
||||
stdout: _T
|
||||
stderr: _T
|
||||
# type ignore on __init__ because the TypeVar can technically be unsolved, but see comment above
|
||||
def __init__(self, args: _CMD, returncode: int, stdout: _T | None = ..., stderr: _T | None = ...) -> None: ... # type: ignore
|
||||
# pyright ignore on __init__ because the TypeVar can technically be unsolved, but see comment above
|
||||
def __init__(
|
||||
self,
|
||||
args: _CMD,
|
||||
returncode: int,
|
||||
stdout: _T | None = ..., # pyright: ignore[reportInvalidTypeVarUse]
|
||||
stderr: _T | None = ..., # pyright: ignore[reportInvalidTypeVarUse]
|
||||
) -> None: ...
|
||||
def check_returncode(self) -> None: ...
|
||||
if sys.version_info >= (3, 9):
|
||||
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
|
||||
|
||||
@@ -906,7 +906,7 @@ class _TypedDict(Mapping[str, object], metaclass=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: ... # type: ignore
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
def __delitem__(self, k: NoReturn) -> None: ...
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
|
||||
@@ -126,7 +126,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: ... # type: ignore
|
||||
def pop(self, k: NoReturn, default: _T = ...) -> object: ... # pyright: ignore[reportInvalidTypeVarUse]
|
||||
def update(self: _T, __m: _T) -> None: ...
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
def keys(self) -> KeysView[str]: ...
|
||||
|
||||
@@ -88,7 +88,7 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]):
|
||||
class KeyedRef(ref[_T], Generic[_KT, _T]):
|
||||
key: _KT
|
||||
# This __new__ method uses a non-standard name for the "cls" parameter
|
||||
def __new__(type: type[Self], ob: _T, callback: Callable[[_T], Any], key: _KT) -> Self: ... # type: ignore
|
||||
def __new__(type: type[Self], ob: _T, callback: Callable[[_T], Any], key: _KT) -> Self: ...
|
||||
def __init__(self, ob: _T, callback: Callable[[_T], Any], key: _KT) -> None: ...
|
||||
|
||||
class WeakKeyDictionary(MutableMapping[_KT, _VT]):
|
||||
|
||||
Reference in New Issue
Block a user