Check for unused pyright: ignore and differentiate from mypy ignores (#9397)

This commit is contained in:
Avasam
2022-12-28 05:44:29 -05:00
committed by GitHub
parent 07f587dc70
commit 23ac9bff19
17 changed files with 44 additions and 21 deletions

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any, ClassVar
from ..sql.traversals import HasCacheKey
@@ -100,7 +101,7 @@ class AbstractEntityRegistry(PathRegistry):
class SlotsEntityRegistry(AbstractEntityRegistry):
inherit_cache: bool
class CachingEntityRegistry(AbstractEntityRegistry, dict): # type: ignore[misc]
class CachingEntityRegistry(AbstractEntityRegistry, dict[Incomplete, Incomplete]): # type: ignore[misc]
inherit_cache: bool
def __getitem__(self, entity): ...
def __missing__(self, key): ...

View File

@@ -85,13 +85,13 @@ class OrderedSet(set[_T], Generic[_T]):
def update(self: Self, iterable: Iterable[_T]) -> Self: ... # type: ignore[override]
__ior__ = update # type: ignore[assignment]
def union(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ... # type: ignore[override]
__or__ = union # type: ignore[assignment]
__or__ = union # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues]
def intersection(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override]
__and__ = intersection # type: ignore[assignment]
__and__ = intersection # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues]
def symmetric_difference(self, other: Iterable[_S]) -> OrderedSet[_S | _T]: ...
__xor__ = symmetric_difference # type: ignore[assignment]
__xor__ = symmetric_difference # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues]
def difference(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override]
__sub__ = difference # type: ignore[assignment]
__sub__ = difference # type: ignore[assignment] # pyright: ignore[reportGeneralTypeIssues]
def intersection_update(self: Self, other: Iterable[Any]) -> Self: ... # type: ignore[override]
__iand__ = intersection_update # type: ignore[assignment]
def symmetric_difference_update(self: Self, other: Iterable[_T]) -> Self: ... # type: ignore[override]

View File

@@ -1,4 +1,4 @@
from _typeshed import Self
from _typeshed import Incomplete, Self
from collections.abc import Callable, Iterable
from typing import Any, Generic, TypeVar, overload
from typing_extensions import ParamSpec
@@ -48,7 +48,7 @@ class Task(Generic[_P, _R_co]):
) -> None: ...
@property
def name(self): ...
def __eq__(self, other: Task) -> bool: ... # type: ignore[override]
def __eq__(self, other: Task[Incomplete, Incomplete]) -> bool: ... # type: ignore[override]
def __hash__(self) -> int: ...
def __call__(self, *args: _P.args, **kwargs: _P.kwargs) -> _R_co: ...
@property

View File

@@ -27,7 +27,7 @@ class Theme:
junction_color: str = ...,
) -> None: ...
# The following method is broken in upstream code.
def format_code(s: str) -> str: ... # type: ignore[misc]
def format_code(s: str) -> str: ... # type: ignore[misc] # pyright: ignore[reportGeneralTypeIssues]
class Themes:
DEFAULT: ClassVar[Theme]

View File

@@ -14,7 +14,8 @@ class DebugDocumentProvider(gateways.DebugDocumentProvider):
def GetDocument(self): ...
# error: Cannot determine consistent method resolution order (MRO) for "DebugDocumentText"
class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc]
# pyright doesn't have a specific error code for MRO error!
class DebugDocumentText(gateways.DebugDocumentInfo, gateways.DebugDocumentText, gateways.DebugDocument): # type: ignore[misc] # pyright: ignore
codeContainer: Incomplete
def __init__(self, codeContainer) -> None: ...
def GetName(self, dnt): ...

View File

@@ -23,7 +23,6 @@ _StrType = TypeVar("_StrType", bound=str | bytes)
_VT = TypeVar("_VT")
_T = TypeVar("_T")
_ScoreCastFuncReturn = TypeVar("_ScoreCastFuncReturn")
# Keyword arguments that are passed to Redis.parse_response().
_ParseResponseOptions: TypeAlias = Any
@@ -568,7 +567,6 @@ class Pipeline(Redis[_StrType], Generic[_StrType]):
def sscan_iter(self, name: _Key, match: _Key | None = ..., count: int | None = ...) -> Iterator[Any]: ...
def hscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
def hscan_iter(self, name, match: _Key | None = ..., count: int | None = ...) -> Iterator[Any]: ...
def zscan(self, name: _Key, cursor: int = ..., match: _Key | None = ..., count: int | None = ..., score_cast_func: Callable[[_StrType], _ScoreCastFuncReturn] = ...) -> Pipeline[_StrType]: ... # type: ignore[override]
def zscan_iter(
self, name: _Key, match: _Key | None = ..., count: int | None = ..., score_cast_func: Callable[[_StrType], Any] = ...
) -> Iterator[Any]: ...

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
from ...client import Pipeline as ClientPipeline
@@ -11,4 +12,4 @@ class JSON(JSONCommands):
def __init__(self, client, version: Any | None = ..., decoder=..., encoder=...) -> None: ...
def pipeline(self, transaction: bool = ..., shard_hint: Any | None = ...) -> Pipeline: ...
class Pipeline(JSONCommands, ClientPipeline): ... # type: ignore[misc]
class Pipeline(JSONCommands, ClientPipeline[Incomplete]): ... # type: ignore[misc]

View File

@@ -1,3 +1,4 @@
from _typeshed import Incomplete
from typing import Any
from ...client import Pipeline as ClientPipeline
@@ -10,4 +11,4 @@ class TimeSeries(TimeSeriesCommands):
def __init__(self, client: Any | None = ..., **kwargs) -> None: ...
def pipeline(self, transaction: bool = ..., shard_hint: Any | None = ...) -> Pipeline: ...
class Pipeline(TimeSeriesCommands, ClientPipeline): ... # type: ignore[misc]
class Pipeline(TimeSeriesCommands, ClientPipeline[Incomplete]): ... # type: ignore[misc]