mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 04:54:47 +08:00
Third-party stubs: remove unused type: ignores (#11063)
This commit is contained in:
@@ -6,7 +6,7 @@ from typing_extensions import Self
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@overload
|
||||
def ord_(dta: str) -> int: ... # type: ignore[misc]
|
||||
def ord_(dta: str) -> int: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def ord_(dta: _T) -> _T: ...
|
||||
def make_string(seq: str | list[int]) -> str: ...
|
||||
|
||||
@@ -55,7 +55,7 @@ def get_app_kwarg_dict(appInstance: flask.Flask | None = None) -> _Options: ...
|
||||
def flexible_str(obj: object) -> str | None: ...
|
||||
def serialize_option(options_dict: _Options, key: str, upper: bool = False) -> None: ...
|
||||
@overload
|
||||
def ensure_iterable(inst: str) -> list[str]: ... # type: ignore[misc]
|
||||
def ensure_iterable(inst: str) -> list[str]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def ensure_iterable(inst: _IterableT) -> _IterableT: ...
|
||||
@overload
|
||||
|
||||
@@ -37,7 +37,7 @@ class MultiDict(MutableMapping[_KT, _VT]):
|
||||
def clear(self) -> None: ...
|
||||
def copy(self) -> Self: ...
|
||||
@overload
|
||||
def setdefault(self, key: _KT, default: None = None) -> _VT | None: ... # type:ignore[misc]
|
||||
def setdefault(self, key: _KT, default: None = None) -> _VT | None: ...
|
||||
@overload
|
||||
def setdefault(self, key: _KT, default: _VT) -> _VT: ...
|
||||
@overload
|
||||
|
||||
@@ -562,7 +562,7 @@ class FPDF(GraphicsStateMixin):
|
||||
width: int | None = None,
|
||||
) -> _GeneratorContextManager[Table]: ...
|
||||
@overload
|
||||
def output( # type: ignore[misc]
|
||||
def output( # type: ignore[overload-overlap]
|
||||
self,
|
||||
name: Literal[""] | None = "",
|
||||
dest: Unused = "",
|
||||
|
||||
@@ -227,7 +227,7 @@ class _patcher:
|
||||
TEST_PREFIX: str
|
||||
dict: type[_patch_dict]
|
||||
@overload
|
||||
def __call__( # type: ignore[misc]
|
||||
def __call__(
|
||||
self,
|
||||
target: Any,
|
||||
*,
|
||||
@@ -257,7 +257,7 @@ class _patcher:
|
||||
**kwargs: Any,
|
||||
) -> _patch[_T]: ...
|
||||
@overload
|
||||
def object( # type: ignore[misc]
|
||||
def object(
|
||||
self,
|
||||
target: Any,
|
||||
attribute: str,
|
||||
|
||||
@@ -265,9 +265,7 @@ class Bool(Convertible[bool, _N]):
|
||||
def __init__(self: Bool[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ...
|
||||
@overload
|
||||
def __init__(self: Bool[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ...
|
||||
def __set__( # type:ignore[override] # Different restrictions
|
||||
self, instance: Serialisable | Strict, value: _ConvertibleToBool
|
||||
) -> None: ...
|
||||
def __set__(self, instance: Serialisable | Strict, value: _ConvertibleToBool) -> None: ...
|
||||
|
||||
class String(Typed[str, _N]):
|
||||
allow_none: _N
|
||||
|
||||
@@ -131,10 +131,10 @@ class NestedText(NestedValue[_T, _N]):
|
||||
@overload
|
||||
def __get__(self: NestedText[_T, Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> _T: ...
|
||||
# NOTE: It is currently impossible to make a generic based on the parameter type of another generic
|
||||
# So we implement explicitely the types used internally
|
||||
# So we implement explicitly the types used internally
|
||||
# str
|
||||
@overload
|
||||
def __set__( # type: ignore[misc] # Incompatible return type because of NoReturn
|
||||
def __set__( # type: ignore[overload-overlap]
|
||||
self: NestedText[str, _N], instance: Serialisable | Strict, value: object # Not[None] when _N = False
|
||||
) -> None: ...
|
||||
# int
|
||||
@@ -176,12 +176,10 @@ class NestedBool(NestedValue[bool, _N], Bool[_N]): # type: ignore[misc]
|
||||
def __init__(self: NestedBool[Literal[True]], name: str | None = None, *, allow_none: Literal[True]) -> None: ...
|
||||
@overload
|
||||
def __init__(self: NestedBool[Literal[False]], name: str | None = None, *, allow_none: Literal[False] = False) -> None: ...
|
||||
def __set__( # type:ignore[override] # Different restrictions
|
||||
self, instance: Serialisable | Strict, value: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool
|
||||
) -> None: ...
|
||||
def from_tree(self, node: _HasGet[bool]) -> bool: ... # type: ignore[override] # Actual overriden return type
|
||||
def __set__(self, instance: Serialisable | Strict, value: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool) -> None: ...
|
||||
def from_tree(self, node: _HasGet[bool]) -> bool: ...
|
||||
|
||||
class NestedNoneSet(Nested[_T | None], NoneSet[_T]): # type: ignore[misc]
|
||||
class NestedNoneSet(Nested[_T | None], NoneSet[_T]):
|
||||
def __init__(self, name: str | None = None, *, values: Iterable[_T | None]) -> None: ...
|
||||
def __set__(self, instance: Serialisable | Strict, value: _NestedNoneSetParam[_T]) -> None: ...
|
||||
|
||||
@@ -264,8 +262,6 @@ class EmptyTag(Nested[bool], Bool[_N]): # type: ignore[misc]
|
||||
def __get__(self: EmptyTag[Literal[True]], instance: Serialisable | Strict, cls: type | None = None) -> bool | None: ...
|
||||
@overload
|
||||
def __get__(self: EmptyTag[Literal[False]], instance: Serialisable | Strict, cls: type | None = None) -> bool: ...
|
||||
def __set__( # type:ignore[override] # Different restrictions
|
||||
self, instance: Serialisable | Strict, value: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool
|
||||
) -> None: ...
|
||||
def from_tree(self, node: Unused) -> Literal[True]: ... # type: ignore[override] # Actual overriden return type
|
||||
def __set__(self, instance: Serialisable | Strict, value: _HasTagAndGet[_ConvertibleToBool] | _ConvertibleToBool) -> None: ...
|
||||
def from_tree(self, node: Unused) -> Literal[True]: ...
|
||||
def to_tree(self, tagname: str | None = None, value: Incomplete | None = None, namespace: str | None = None) -> Element: ...
|
||||
|
||||
@@ -69,7 +69,7 @@ _RuleType: TypeAlias = Literal[
|
||||
|
||||
class ValueDescriptor(Float[Incomplete]):
|
||||
expected_type: type[Incomplete]
|
||||
def __set__(self, instance: Serialisable | Strict, value) -> None: ... # type: ignore[override]
|
||||
def __set__(self, instance: Serialisable | Strict, value) -> None: ...
|
||||
|
||||
class FormatObject(Serialisable):
|
||||
tagname: ClassVar[str]
|
||||
|
||||
@@ -77,7 +77,7 @@ def fromstring(text: str | ReadableBuffer, parser: XMLParser | None = None) -> E
|
||||
# from lxml.etree import fromstring
|
||||
# But made partial, removing parser arg
|
||||
@overload
|
||||
def fromstring(text: str | bytes, *, base_url: str | bytes = ...) -> _lxml_Element: ... # type: ignore[misc] # Overlap with incompatible return types
|
||||
def fromstring(text: str | bytes, *, base_url: str | bytes = ...) -> _lxml_Element: ... # type: ignore[overload-overlap]
|
||||
|
||||
# from defusedxml.ElementTree import fromstring
|
||||
@overload
|
||||
|
||||
@@ -27,7 +27,7 @@ class RSAKey(PKey):
|
||||
def get_name(self) -> str: ...
|
||||
def get_bits(self) -> int: ...
|
||||
def can_sign(self) -> bool: ...
|
||||
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ... # type: ignore[override]
|
||||
def sign_ssh_data(self, data: bytes, algorithm: str | None = None) -> Message: ...
|
||||
def verify_ssh_sig(self, data: bytes, msg: Message) -> bool: ...
|
||||
def write_private_key_file(self, filename: str, password: str | None = None) -> None: ...
|
||||
def write_private_key(self, file_obj: IO[str], password: str | None = None) -> None: ...
|
||||
|
||||
@@ -44,7 +44,9 @@ class RuleVisitor(NodeVisitor[tuple[OrderedDict[str, Expression], Expression | N
|
||||
def visit_regex(self, node: Node, regex: collections.abc.Sequence[Any]) -> Regex: ...
|
||||
def visit_spaceless_literal(self, spaceless_literal: Node, visited_children: collections.abc.Sequence[Any]) -> Literal: ...
|
||||
def visit_literal(self, node: Node, literal: collections.abc.Sequence[Any]) -> Literal: ...
|
||||
def generic_visit(self, node: Node, visited_children: collections.abc.Sequence[Any]) -> collections.abc.Sequence[Any] | Node: ... # type: ignore[override]
|
||||
def generic_visit(
|
||||
self, node: Node, visited_children: collections.abc.Sequence[Any]
|
||||
) -> collections.abc.Sequence[Any] | Node: ...
|
||||
def visit_rules(
|
||||
self, node: Node, rules_list: collections.abc.Sequence[Any]
|
||||
) -> tuple[OrderedDict[str, Expression], Expression | None]: ...
|
||||
|
||||
@@ -6,11 +6,14 @@ from typing import Generic, NamedTuple, TypeVar
|
||||
|
||||
import pika.connection
|
||||
from pika.adapters.utils import nbio_interface
|
||||
from twisted.internet.base import DelayedCall # type: ignore[import] # pyright: ignore[reportMissingImports]
|
||||
from twisted.internet.defer import Deferred, DeferredQueue # type: ignore[import] # pyright: ignore[reportMissingImports]
|
||||
from twisted.internet.interfaces import ITransport # type: ignore[import] # pyright: ignore[reportMissingImports]
|
||||
from twisted.internet.protocol import Protocol # type: ignore[import] # pyright: ignore[reportMissingImports]
|
||||
from twisted.python.failure import Failure # type: ignore[import] # pyright: ignore[reportMissingImports]
|
||||
from twisted.internet.base import DelayedCall # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
|
||||
from twisted.internet.defer import ( # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
|
||||
Deferred,
|
||||
DeferredQueue,
|
||||
)
|
||||
from twisted.internet.interfaces import ITransport # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
|
||||
from twisted.internet.protocol import Protocol # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
|
||||
from twisted.python.failure import Failure # type: ignore[import-not-found] # pyright: ignore[reportMissingImports]
|
||||
|
||||
_T = TypeVar("_T")
|
||||
|
||||
@@ -20,8 +23,8 @@ class ClosableDeferredQueue(DeferredQueue[_T], Generic[_T]): # pyright: ignore[
|
||||
closed: Failure | BaseException | None
|
||||
def __init__(self, size: Incomplete | None = ..., backlog: Incomplete | None = ...) -> None: ...
|
||||
# Returns a Deferred with an error if fails. None if success
|
||||
def put(self, obj: _T) -> Deferred[Failure | BaseException] | None: ... # type: ignore[override]
|
||||
def get(self) -> Deferred[Failure | BaseException | _T]: ... # type: ignore[override]
|
||||
def put(self, obj: _T) -> Deferred[Failure | BaseException] | None: ... # type: ignore[override] # ignore is not needed for mypy, but is for stubtest
|
||||
def get(self) -> Deferred[Failure | BaseException | _T]: ... # type: ignore[override] # ignore is not needed for mypy, but is for stubtest
|
||||
pending: Incomplete
|
||||
def close(self, reason: BaseException | None) -> None: ...
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ class NoneAdapter:
|
||||
def getquoted(self, _null: bytes = b"NULL") -> bytes: ...
|
||||
|
||||
@overload
|
||||
def make_dsn(dsn: bytes) -> bytes: ... # type: ignore[misc]
|
||||
def make_dsn(dsn: bytes) -> bytes: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def make_dsn(dsn: None = None) -> str: ...
|
||||
@overload
|
||||
|
||||
@@ -22,7 +22,7 @@ def merge(rleObjs: list[_EncodedRLE], intersect: int = ...) -> _EncodedRLE: ...
|
||||
|
||||
# ignore an "overlapping overloads" error due to _NDArrayInt32 being an alias for `Incomplete` for now
|
||||
@overload
|
||||
def frPyObjects(pyobj: _NDArrayUInt32 | list[list[int]] | list[_EncodedRLE], h: int, w: int) -> list[_EncodedRLE]: ... # type: ignore[misc]
|
||||
def frPyObjects(pyobj: _NDArrayUInt32 | list[list[int]] | list[_EncodedRLE], h: int, w: int) -> list[_EncodedRLE]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def frPyObjects(pyobj: list[int] | _EncodedRLE, h: int, w: int) -> _EncodedRLE: ...
|
||||
def encode(bimask: _NDArrayUInt8) -> _EncodedRLE: ...
|
||||
|
||||
@@ -39,11 +39,11 @@ _OmitType: TypeAlias = str | tuple[str, ...] | None
|
||||
|
||||
def iter_child_nodes(node: ast.AST, omit: _OmitType = None, _fields_order: _FieldsOrder = ...) -> Iterator[ast.AST]: ...
|
||||
@overload
|
||||
def convert_to_value(item: ast.Str) -> str: ... # type: ignore[misc]
|
||||
def convert_to_value(item: ast.Str) -> str: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def convert_to_value(item: ast.Bytes) -> bytes: ... # type: ignore[misc]
|
||||
def convert_to_value(item: ast.Bytes) -> bytes: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def convert_to_value(item: ast.Tuple) -> tuple[Any, ...]: ... # type: ignore[misc]
|
||||
def convert_to_value(item: ast.Tuple) -> tuple[Any, ...]: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def convert_to_value(item: ast.Name | ast.NameConstant) -> Any: ...
|
||||
@overload
|
||||
|
||||
@@ -52,7 +52,7 @@ _HideConsole: TypeAlias = Literal["hide-early", "minimize-early", "hide-late", "
|
||||
class PYZ(Target):
|
||||
name: str
|
||||
cipher: _PyiBlockCipher
|
||||
dependencies: list[_TOCTuple] # type: ignore[assignment]
|
||||
dependencies: list[_TOCTuple]
|
||||
toc: list[_TOCTuple]
|
||||
code_dict: dict[str, CodeType]
|
||||
def __init__(self, *tocs: Iterable[_TOCTuple], name: str | None = None, cipher: _PyiBlockCipher = None) -> None: ...
|
||||
|
||||
@@ -38,7 +38,7 @@ _SeabornPaletteName: TypeAlias = Literal[
|
||||
]
|
||||
|
||||
@overload
|
||||
def color_palette( # type: ignore[misc]
|
||||
def color_palette( # type: ignore[overload-overlap]
|
||||
palette: _SeabornPaletteName | None = None, n_colors: int | None = None, desat: float | None = None, *, as_cmap: Literal[True]
|
||||
) -> list[str]: ... # this might be a bug in seaborn because we expect the return type to be a Colormap instance
|
||||
@overload
|
||||
|
||||
@@ -72,7 +72,7 @@ def locator_to_legend_entries(
|
||||
locator: Locator, limits: Iterable[float], dtype: Incomplete
|
||||
) -> tuple[list[Incomplete], list[str]]: ...
|
||||
@overload
|
||||
def relative_luminance(color: ColorType) -> float: ... # type: ignore[misc]
|
||||
def relative_luminance(color: ColorType) -> float: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def relative_luminance(color: Sequence[ColorType]) -> NDArray[np.float64]: ...
|
||||
@overload
|
||||
|
||||
@@ -11,7 +11,7 @@ class upload_docs(upload):
|
||||
boolean_options: ClassVar[list[str]]
|
||||
def has_sphinx(self): ...
|
||||
# The callable parameter is self: Self, but using Self still trips up mypy
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Self], bool] | None]]] # type: ignore[misc, assignment]
|
||||
sub_commands: ClassVar[list[tuple[str, Callable[[Self], bool] | None]]] # type: ignore[assignment]
|
||||
upload_dir: Any
|
||||
target_dir: Any
|
||||
def initialize_options(self) -> None: ...
|
||||
|
||||
@@ -13,9 +13,7 @@ def logging_redirect_tqdm(
|
||||
) -> _GeneratorContextManager[None]: ...
|
||||
|
||||
# TODO type *args, **kwargs here more precisely
|
||||
# The type ignore is because mypy complains that the second overload will never be matched
|
||||
# (I'm not sure that's true)
|
||||
@overload
|
||||
def tqdm_logging_redirect(*args, tqdm_class: Callable[..., _TqdmT], **kwargs) -> _GeneratorContextManager[_TqdmT]: ...
|
||||
@overload
|
||||
def tqdm_logging_redirect(*args, **kwargs) -> _GeneratorContextManager[std_tqdm[Incomplete]]: ... # type: ignore[misc]
|
||||
def tqdm_logging_redirect(*args, **kwargs) -> _GeneratorContextManager[std_tqdm[Incomplete]]: ...
|
||||
|
||||
@@ -87,7 +87,7 @@ def cache_update(
|
||||
def queue_get(__index: int) -> bytes | None: ...
|
||||
def queue_set(__index: int, __message: str | bytes | ReadOnlyBuffer) -> _TrueOrNone: ...
|
||||
@overload
|
||||
def queue_last(__num: Literal[0] = 0) -> bytes | None: ... # type:ignore[misc]
|
||||
def queue_last(__num: Literal[0] = 0) -> bytes | None: ... # type: ignore[overload-overlap]
|
||||
@overload
|
||||
def queue_last(__num: int) -> list[bytes | None]: ...
|
||||
def queue_push(__message: str | bytes | ReadOnlyBuffer) -> _TrueOrNone: ...
|
||||
|
||||
Reference in New Issue
Block a user