Third-party stubs: remove unused type: ignores (#11063)

This commit is contained in:
Alex Waygood
2023-11-23 13:35:45 +00:00
committed by GitHub
parent b04e50d522
commit 1d2fe59e88
21 changed files with 41 additions and 44 deletions

View File

@@ -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

View File

@@ -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: ...

View File

@@ -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]

View File

@@ -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