mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-16 00:37:10 +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:
@@ -38,7 +38,6 @@
|
||||
"reportUnboundVariable": "error",
|
||||
"reportInvalidStubStatement": "error",
|
||||
"reportInvalidTypeVarUse": "error",
|
||||
"reportSelfClsParameterName": "error",
|
||||
"reportUnsupportedDunderAll": "error",
|
||||
"reportInconsistentConstructor": "error",
|
||||
"reportTypeCommentUsage": "error",
|
||||
@@ -52,4 +51,6 @@
|
||||
// (which is stricter than mypy's; see mypy issue #10143 and #10157)
|
||||
// would cause many false positives and catch few bugs.
|
||||
"reportOverlappingOverload": "none",
|
||||
// The name of the self/cls parameter is out of typeshed's control.
|
||||
"reportSelfClsParameterName": "none",
|
||||
}
|
||||
|
||||
@@ -113,7 +113,6 @@
|
||||
"reportUnboundVariable": "error",
|
||||
"reportInvalidStubStatement": "error",
|
||||
"reportInvalidTypeVarUse": "error",
|
||||
"reportSelfClsParameterName": "error",
|
||||
"reportUnsupportedDunderAll": "error",
|
||||
"reportInconsistentConstructor": "error",
|
||||
"reportTypeCommentUsage": "error",
|
||||
@@ -127,4 +126,6 @@
|
||||
// (which is stricter than mypy's; see mypy issue #10143 and #10157)
|
||||
// would cause many false positives and catch few bugs.
|
||||
"reportOverlappingOverload": "none",
|
||||
// The name of the self/cls parameter is out of typeshed's control.
|
||||
"reportSelfClsParameterName": "none",
|
||||
}
|
||||
|
||||
@@ -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]):
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import Any
|
||||
from ...sql import sqltypes
|
||||
from .types import _StringType
|
||||
|
||||
class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum, _StringType): # type: ignore # incompatible with base class
|
||||
class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum, _StringType): # type: ignore[misc] # incompatible with base class
|
||||
__visit_name__: str
|
||||
native_enum: bool
|
||||
def __init__(self, *enums, **kw) -> None: ...
|
||||
|
||||
@@ -32,7 +32,7 @@ class _StringType(sqltypes.String):
|
||||
**kw,
|
||||
) -> None: ...
|
||||
|
||||
class _MatchType(sqltypes.Float, sqltypes.MatchType): # type: ignore # incompatible with base class
|
||||
class _MatchType(sqltypes.Float, sqltypes.MatchType): # type: ignore[misc] # incompatible with base class
|
||||
def __init__(self, **kw) -> None: ...
|
||||
|
||||
class NUMERIC(_NumericType, sqltypes.NUMERIC):
|
||||
|
||||
@@ -96,7 +96,7 @@ PGUuid = UUID
|
||||
class TSVECTOR(sqltypes.TypeEngine):
|
||||
__visit_name__: str
|
||||
|
||||
class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum): # type: ignore # base classes incompatible
|
||||
class ENUM(sqltypes.NativeForEmulated, sqltypes.Enum): # type: ignore[misc] # base classes incompatible
|
||||
native_enum: bool
|
||||
create_type: Any
|
||||
def __init__(self, *enums, **kw) -> None: ...
|
||||
|
||||
@@ -13,7 +13,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: Self, __m: Self) -> None: ...
|
||||
def items(self) -> ItemsView[str, object]: ...
|
||||
def keys(self) -> KeysView[str]: ...
|
||||
|
||||
@@ -27,7 +27,7 @@ class _Argon2Common( # type: ignore[misc]
|
||||
min_memory_cost: ClassVar[int]
|
||||
max_threads: ClassVar[int]
|
||||
pure_use_threads: ClassVar[bool]
|
||||
def type_values(cls): ... # type: ignore
|
||||
def type_values(cls): ...
|
||||
type: str
|
||||
parallelism: int
|
||||
version: int
|
||||
|
||||
@@ -78,7 +78,7 @@ class TOTP:
|
||||
def pretty_key(self, format: str = ..., sep: str = ...): ...
|
||||
@classmethod
|
||||
def normalize_time(cls, time): ...
|
||||
def normalize_token(self_or_cls, token): ... # type: ignore
|
||||
def normalize_token(self_or_cls, token): ...
|
||||
def generate(self, time: Any | None = ...): ...
|
||||
@classmethod
|
||||
def verify(cls, token, source, **kwds): ...
|
||||
|
||||
@@ -26,7 +26,8 @@ class Theme:
|
||||
junction_char: str = ...,
|
||||
junction_color: str = ...,
|
||||
) -> None: ...
|
||||
def format_code(s: str) -> str: ... # type: ignore
|
||||
# The following method is broken in upstream code.
|
||||
def format_code(s: str) -> str: ... # type: ignore[misc]
|
||||
|
||||
class Themes:
|
||||
DEFAULT: ClassVar[Theme]
|
||||
|
||||
Reference in New Issue
Block a user