Skip to content

Commit 6ba28ae

Browse files
authored
Remove unused type: ignore comments (#9801)
1 parent 06755e1 commit 6ba28ae

20 files changed

Lines changed: 39 additions & 40 deletions

File tree

stdlib/asyncio/base_subprocess.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BaseSubprocessTransport(transports.SubprocessTransport):
4646
def get_pid(self) -> int | None: ... # type: ignore[override]
4747
def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override]
4848
def _check_proc(self) -> None: ... # undocumented
49-
def send_signal(self, signal: int) -> None: ... # type: ignore[override]
49+
def send_signal(self, signal: int) -> None: ...
5050
async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented
5151
def _call(self, cb: Callable[..., object], *data: Any) -> None: ... # undocumented
5252
def _pipe_connection_lost(self, fd: int, exc: BaseException | None) -> None: ... # undocumented

stdlib/asyncio/tasks.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ if sys.version_info >= (3, 10):
140140
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
141141
]: ...
142142
@overload
143-
def gather(*coros_or_futures: _FutureLike[Any], return_exceptions: bool = False) -> Future[list[Any]]: ... # type: ignore[misc]
143+
def gather(*coros_or_futures: _FutureLike[Any], return_exceptions: bool = False) -> Future[list[Any]]: ...
144144

145145
else:
146146
@overload
@@ -230,7 +230,7 @@ else:
230230
tuple[_T1 | BaseException, _T2 | BaseException, _T3 | BaseException, _T4 | BaseException, _T5 | BaseException]
231231
]: ...
232232
@overload
233-
def gather( # type: ignore[misc]
233+
def gather(
234234
*coros_or_futures: _FutureLike[Any], loop: AbstractEventLoop | None = None, return_exceptions: bool = False
235235
) -> Future[list[Any]]: ...
236236

stdlib/builtins.pyi

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ class str(Sequence[str]):
447447
@overload
448448
def format(self: LiteralString, *args: LiteralString, **kwargs: LiteralString) -> LiteralString: ...
449449
@overload
450-
def format(self, *args: object, **kwargs: object) -> str: ... # type: ignore[misc]
450+
def format(self, *args: object, **kwargs: object) -> str: ...
451451
def format_map(self, map: _FormatMapMapping) -> str: ...
452452
def index(self, __sub: str, __start: SupportsIndex | None = ..., __end: SupportsIndex | None = ...) -> int: ...
453453
def isalnum(self) -> bool: ...
@@ -577,7 +577,7 @@ class str(Sequence[str]):
577577
@overload
578578
def __mod__(self: LiteralString, __x: LiteralString | tuple[LiteralString, ...]) -> LiteralString: ...
579579
@overload
580-
def __mod__(self, __x: Any) -> str: ... # type: ignore[misc]
580+
def __mod__(self, __x: Any) -> str: ...
581581
@overload
582582
def __mul__(self: LiteralString, __n: SupportsIndex) -> LiteralString: ...
583583
@overload
@@ -1192,7 +1192,7 @@ class property:
11921192
def __delete__(self, __instance: Any) -> None: ...
11931193

11941194
@final
1195-
class _NotImplementedType(Any): # type: ignore[misc]
1195+
class _NotImplementedType(Any):
11961196
# A little weird, but typing the __call__ as NotImplemented makes the error message
11971197
# for NotImplemented() much better
11981198
__call__: NotImplemented # type: ignore[valid-type] # pyright: ignore[reportGeneralTypeIssues]
@@ -1613,11 +1613,11 @@ if sys.version_info >= (3, 8):
16131613
@overload
16141614
def pow(base: int, exp: int, mod: int) -> int: ...
16151615
@overload
1616-
def pow(base: int, exp: Literal[0], mod: None = None) -> Literal[1]: ... # type: ignore[misc]
1616+
def pow(base: int, exp: Literal[0], mod: None = None) -> Literal[1]: ...
16171617
@overload
1618-
def pow(base: int, exp: _PositiveInteger, mod: None = None) -> int: ... # type: ignore[misc]
1618+
def pow(base: int, exp: _PositiveInteger, mod: None = None) -> int: ...
16191619
@overload
1620-
def pow(base: int, exp: _NegativeInteger, mod: None = None) -> float: ... # type: ignore[misc]
1620+
def pow(base: int, exp: _NegativeInteger, mod: None = None) -> float: ...
16211621
# int base & positive-int exp -> int; int base & negative-int exp -> float
16221622
# return type must be Any as `int | float` causes too many false-positive errors
16231623
@overload
@@ -1650,11 +1650,11 @@ else:
16501650
@overload
16511651
def pow(__base: int, __exp: int, __mod: int) -> int: ...
16521652
@overload
1653-
def pow(__base: int, __exp: Literal[0], __mod: None = None) -> Literal[1]: ... # type: ignore[misc]
1653+
def pow(__base: int, __exp: Literal[0], __mod: None = None) -> Literal[1]: ...
16541654
@overload
1655-
def pow(__base: int, __exp: _PositiveInteger, __mod: None = None) -> int: ... # type: ignore[misc]
1655+
def pow(__base: int, __exp: _PositiveInteger, __mod: None = None) -> int: ...
16561656
@overload
1657-
def pow(__base: int, __exp: _NegativeInteger, __mod: None = None) -> float: ... # type: ignore[misc]
1657+
def pow(__base: int, __exp: _NegativeInteger, __mod: None = None) -> float: ...
16581658
@overload
16591659
def pow(__base: int, __exp: int, __mod: None = None) -> Any: ...
16601660
@overload

stdlib/difflib.pyi

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ class SequenceMatcher(Generic[_T]):
5757
if sys.version_info >= (3, 9):
5858
def __class_getitem__(cls, item: Any) -> GenericAlias: ...
5959

60-
# mypy thinks the signatures of the overloads overlap, but the types still work fine
6160
@overload
62-
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = 3, cutoff: float = 0.6) -> list[AnyStr]: ... # type: ignore[misc]
61+
def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = 3, cutoff: float = 0.6) -> list[AnyStr]: ...
6362
@overload
6463
def get_close_matches(
6564
word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = 3, cutoff: float = 0.6

stdlib/encodings/utf_8_sig.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ from _typeshed import ReadableBuffer
44
class IncrementalEncoder(codecs.IncrementalEncoder):
55
def __init__(self, errors: str = "strict") -> None: ...
66
def encode(self, input: str, final: bool = False) -> bytes: ...
7-
def getstate(self) -> int: ... # type: ignore[override]
7+
def getstate(self) -> int: ...
88
def setstate(self, state: int) -> None: ... # type: ignore[override]
99

1010
class IncrementalDecoder(codecs.BufferedIncrementalDecoder):

stdlib/enum.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ class EnumMeta(ABCMeta):
114114
def __bool__(self) -> Literal[True]: ...
115115
def __dir__(self) -> list[str]: ...
116116
# Simple value lookup
117-
@overload # type: ignore[override]
117+
@overload
118118
def __call__(cls: type[_EnumMemberT], value: Any, names: None = None) -> _EnumMemberT: ...
119119
# Functional Enum API
120120
if sys.version_info >= (3, 11):

stdlib/gettext.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ class GNUTranslations(NullTranslations):
5757
CONTEXT: str
5858
VERSIONS: Sequence[int]
5959

60-
@overload # ignores incompatible overloads
61-
def find( # type: ignore[misc]
60+
@overload
61+
def find(
6262
domain: str, localedir: StrPath | None = None, languages: Iterable[str] | None = None, all: Literal[False] = False
6363
) -> str | None: ...
6464
@overload

stdlib/http/client.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ class HTTPConnection:
174174

175175
class HTTPSConnection(HTTPConnection):
176176
# Can be `None` if `.connect()` was not called:
177-
sock: ssl.SSLSocket | Any # type: ignore[override]
177+
sock: ssl.SSLSocket | Any
178178
def __init__(
179179
self,
180180
host: str,

stdlib/importlib/abc.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ if sys.version_info >= (3, 9):
191191
class TraversableResources(ResourceReader):
192192
@abstractmethod
193193
def files(self) -> Traversable: ...
194-
def open_resource(self, resource: str) -> BufferedReader: ... # type: ignore[override]
194+
def open_resource(self, resource: str) -> BufferedReader: ...
195195
def resource_path(self, resource: Any) -> NoReturn: ...
196196
def is_resource(self, path: str) -> bool: ...
197197
def contents(self) -> Iterator[str]: ...

stdlib/socket.pyi

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ class socket(_socket.socket):
664664
# Note that the makefile's documented windows-specific behavior is not represented
665665
# mode strings with duplicates are intentionally excluded
666666
@overload
667-
def makefile( # type: ignore[misc]
667+
def makefile(
668668
self,
669669
mode: Literal["b", "rb", "br", "wb", "bw", "rwb", "rbw", "wrb", "wbr", "brw", "bwr"],
670670
buffering: Literal[0],
@@ -725,9 +725,9 @@ class socket(_socket.socket):
725725
) -> TextIOWrapper: ...
726726
def sendfile(self, file: _SendableFile, offset: int = 0, count: int | None = None) -> int: ...
727727
@property
728-
def family(self) -> AddressFamily: ... # type: ignore[override]
728+
def family(self) -> AddressFamily: ...
729729
@property
730-
def type(self) -> SocketKind: ... # type: ignore[override]
730+
def type(self) -> SocketKind: ...
731731
def get_inheritable(self) -> bool: ...
732732
def set_inheritable(self, inheritable: bool) -> None: ...
733733

0 commit comments

Comments
 (0)