diff --git a/pyrightconfig.json b/pyrightconfig.json index 891165fedfdb..923f815ebae3 100644 --- a/pyrightconfig.json +++ b/pyrightconfig.json @@ -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", } diff --git a/pyrightconfig.stricter.json b/pyrightconfig.stricter.json index d12235cd5bdb..5c7831a05f2a 100644 --- a/pyrightconfig.stricter.json +++ b/pyrightconfig.stricter.json @@ -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", } diff --git a/stdlib/builtins.pyi b/stdlib/builtins.pyi index d63f7855c247..8782cb3ea6ea 100644 --- a/stdlib/builtins.pyi +++ b/stdlib/builtins.pyi @@ -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. diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index 00b2be01dc86..386c6a20cf3a 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -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]): ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 4d89f68a7b28..562402671480 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -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 diff --git a/stdlib/importlib/metadata/__init__.pyi b/stdlib/importlib/metadata/__init__.pyi index e6bf1fa25ede..99fecb41497d 100644 --- a/stdlib/importlib/metadata/__init__.pyi +++ b/stdlib/importlib/metadata/__init__.pyi @@ -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: ... diff --git a/stdlib/subprocess.pyi b/stdlib/subprocess.pyi index 380c3e6b3d03..fded3f74928e 100644 --- a/stdlib/subprocess.pyi +++ b/stdlib/subprocess.pyi @@ -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: ... diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 41cd6b3eaf34..e6d28338d621 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -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]: ... diff --git a/stdlib/typing_extensions.pyi b/stdlib/typing_extensions.pyi index fab5900128a5..50eb5bb8368a 100644 --- a/stdlib/typing_extensions.pyi +++ b/stdlib/typing_extensions.pyi @@ -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]: ... diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index 03dd89c8e210..af960391e85d 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -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]): diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi index e68dcdfdf032..e75307ef9ac2 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/enumerated.pyi @@ -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: ... diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi index fecd364f683c..3086e6379617 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/mysql/types.pyi @@ -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): diff --git a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi index a2b167315ae9..88de9ce3526b 100644 --- a/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi +++ b/stubs/SQLAlchemy/sqlalchemy/dialects/postgresql/base.pyi @@ -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: ... diff --git a/stubs/mypy-extensions/mypy_extensions.pyi b/stubs/mypy-extensions/mypy_extensions.pyi index bf8d72ba8393..85c828e8a8a8 100644 --- a/stubs/mypy-extensions/mypy_extensions.pyi +++ b/stubs/mypy-extensions/mypy_extensions.pyi @@ -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]: ... diff --git a/stubs/passlib/passlib/handlers/argon2.pyi b/stubs/passlib/passlib/handlers/argon2.pyi index 252812e21ef2..69f7dd96c85e 100644 --- a/stubs/passlib/passlib/handlers/argon2.pyi +++ b/stubs/passlib/passlib/handlers/argon2.pyi @@ -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 diff --git a/stubs/passlib/passlib/totp.pyi b/stubs/passlib/passlib/totp.pyi index f44e3e383904..0f9160282f95 100644 --- a/stubs/passlib/passlib/totp.pyi +++ b/stubs/passlib/passlib/totp.pyi @@ -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): ... diff --git a/stubs/prettytable/prettytable/colortable.pyi b/stubs/prettytable/prettytable/colortable.pyi index d4f7b788fecd..1cb3fc8bb60d 100644 --- a/stubs/prettytable/prettytable/colortable.pyi +++ b/stubs/prettytable/prettytable/colortable.pyi @@ -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]