From a5bc1e037fa9fb541d81de92ad27fa8543c65be4 Mon Sep 17 00:00:00 2001 From: Akuli Date: Fri, 26 Nov 2021 08:07:56 +0200 Subject: [PATCH] Add mypy error codes to '# type: ignore' comments (#6379) --- stdlib/_msi.pyi | 16 +++++------ stdlib/argparse.pyi | 4 +-- stdlib/ast.pyi | 2 +- stdlib/asyncio/base_subprocess.pyi | 6 ++-- stdlib/asyncio/tasks.pyi | 8 ++++-- stdlib/bz2.pyi | 2 +- stdlib/codecs.pyi | 4 +-- stdlib/collections/__init__.pyi | 14 +++++----- stdlib/configparser.pyi | 13 +++++++-- stdlib/contextlib.pyi | 4 +-- stdlib/ctypes/__init__.pyi | 4 +-- stdlib/datetime.pyi | 8 +++--- stdlib/dbm/gnu.pyi | 4 +-- stdlib/dbm/ndbm.pyi | 4 +-- stdlib/difflib.pyi | 4 +-- stdlib/distutils/command/check.pyi | 2 +- stdlib/email/_header_value_parser.pyi | 2 +- stdlib/email/policy.pyi | 2 +- stdlib/enum.pyi | 2 +- stdlib/http/client.pyi | 2 +- stdlib/http/cookies.pyi | 2 +- stdlib/importlib/util.pyi | 6 ++-- stdlib/inspect.pyi | 4 +-- stdlib/io.pyi | 28 +++++++++---------- stdlib/logging/handlers.pyi | 2 +- stdlib/math.pyi | 2 +- stdlib/os/__init__.pyi | 4 +-- stdlib/smtpd.pyi | 10 ++----- stdlib/socket.pyi | 6 ++-- stdlib/tkinter/__init__.pyi | 14 +++++----- stdlib/tkinter/tix.pyi | 2 +- stdlib/tkinter/ttk.pyi | 28 +++++++++---------- stdlib/turtle.pyi | 12 ++++---- stdlib/types.pyi | 10 +++---- stdlib/typing.pyi | 2 +- stdlib/unittest/case.pyi | 12 ++++---- stdlib/unittest/mock.pyi | 18 ++++++------ stdlib/unittest/signals.pyi | 2 +- stdlib/weakref.pyi | 12 ++++---- stdlib/xml/dom/minicompat.pyi | 2 +- stdlib/xml/dom/xmlbuilder.pyi | 4 +-- stdlib/xmlrpc/client.pyi | 2 +- stdlib/xmlrpc/server.pyi | 11 +++++++- stdlib/zipfile.pyi | 4 +-- stubs/Flask/flask/wrappers.pyi | 2 +- stubs/Jinja2/jinja2/utils.pyi | 6 ++-- stubs/Markdown/markdown/inlinepatterns.pyi | 2 +- stubs/MarkupSafe/markupsafe/__init__.pyi | 10 +++---- stubs/Pillow/PIL/ImageQt.pyi | 2 +- stubs/PyMySQL/pymysql/cursors.pyi | 8 +++--- stubs/Pygments/pygments/lexer.pyi | 4 ++- stubs/Pygments/pygments/token.pyi | 2 +- stubs/Werkzeug/werkzeug/datastructures.pyi | 20 ++++++------- stubs/fpdf2/fpdf/template.pyi | 2 +- stubs/httplib2/httplib2/__init__.pyi | 4 +-- stubs/humanfriendly/humanfriendly/case.pyi | 2 +- stubs/itsdangerous/itsdangerous.pyi | 2 +- stubs/mock/mock/mock.pyi | 6 ++-- stubs/paramiko/paramiko/hostkeys.pyi | 6 ++-- stubs/python-nmap/nmap/nmap.pyi | 4 +-- stubs/redis/redis/commands/json/__init__.pyi | 2 +- .../redis/commands/timeseries/__init__.pyi | 2 +- stubs/redis/redis/utils.pyi | 2 +- stubs/requests/requests/structures.pyi | 2 +- .../common/actions/pointer_input.pyi | 2 +- .../setuptools/setuptools/command/develop.pyi | 2 +- stubs/setuptools/setuptools/command/test.pyi | 2 +- .../setuptools/command/upload_docs.pyi | 2 +- stubs/setuptools/setuptools/lib2to3_ex.pyi | 2 +- stubs/ttkthemes/ttkthemes/themed_style.pyi | 4 +-- stubs/ttkthemes/ttkthemes/themed_tk.pyi | 4 +-- stubs/vobject/vobject/icalendar.pyi | 2 +- stubs/vobject/vobject/vcard.pyi | 2 +- stubs/waitress/waitress/wasyncore.pyi | 2 +- 74 files changed, 218 insertions(+), 202 deletions(-) diff --git a/stdlib/_msi.pyi b/stdlib/_msi.pyi index 754febe68..b7e852f38 100644 --- a/stdlib/_msi.pyi +++ b/stdlib/_msi.pyi @@ -10,8 +10,8 @@ if sys.platform == "win32": def Modify(self, mode: int, record: _Record) -> None: ... def Close(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] # Actual typename Summary, not exposed by the implementation class _Summary: def GetProperty(self, propid: int) -> str | bytes | None: ... @@ -19,8 +19,8 @@ if sys.platform == "win32": def SetProperty(self, propid: int, value: str | bytes) -> None: ... def Persist(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] # Actual typename Database, not exposed by the implementation class _Database: def OpenView(self, sql: str) -> _View: ... @@ -28,8 +28,8 @@ if sys.platform == "win32": def GetSummaryInformation(self, updateCount: int) -> _Summary: ... def Close(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] # Actual typename Record, not exposed by the implementation class _Record: def GetFieldCount(self) -> int: ... @@ -40,8 +40,8 @@ if sys.platform == "win32": def SetInteger(self, field: int, int: int) -> None: ... def ClearData(self) -> None: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] def UuidCreate() -> str: ... def FCICreate(cabname: str, files: list[str]) -> None: ... def OpenDatabase(name: str, flags: int) -> _Database: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index b9a09f56a..206037ed7 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -143,11 +143,11 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer): @overload def parse_args(self, args: Sequence[str] | None = ...) -> Namespace: ... @overload - def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore + def parse_args(self, args: Sequence[str] | None, namespace: None) -> Namespace: ... # type: ignore[misc] @overload def parse_args(self, args: Sequence[str] | None, namespace: _N) -> _N: ... @overload - def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore + def parse_args(self, *, namespace: None) -> Namespace: ... # type: ignore[misc] @overload def parse_args(self, *, namespace: _N) -> _N: ... if sys.version_info >= (3, 7): diff --git a/stdlib/ast.pyi b/stdlib/ast.pyi index 00c62c30c..8f9865679 100644 --- a/stdlib/ast.pyi +++ b/stdlib/ast.pyi @@ -8,7 +8,7 @@ # sys. import sys import typing as _typing -from _ast import * # type: ignore +from _ast import * from typing import Any, Iterator, TypeVar, overload from typing_extensions import Literal diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index 23034790a..096bce60f 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -46,11 +46,11 @@ class BaseSubprocessTransport(transports.SubprocessTransport): def get_protocol(self) -> protocols.BaseProtocol: ... def is_closing(self) -> bool: ... def close(self) -> None: ... - def get_pid(self) -> int | None: ... # type: ignore + def get_pid(self) -> int | None: ... # type: ignore[override] def get_returncode(self) -> int | None: ... - def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore + def get_pipe_transport(self, fd: int) -> _File: ... # type: ignore[override] def _check_proc(self) -> None: ... # undocumented - def send_signal(self, signal: int) -> None: ... # type: ignore + def send_signal(self, signal: int) -> None: ... # type: ignore[override] def terminate(self) -> None: ... def kill(self) -> None: ... async def _connect_pipes(self, waiter: futures.Future[Any] | None) -> None: ... # undocumented diff --git a/stdlib/asyncio/tasks.pyi b/stdlib/asyncio/tasks.pyi index 15c12909f..a81e59e94 100644 --- a/stdlib/asyncio/tasks.pyi +++ b/stdlib/asyncio/tasks.pyi @@ -34,7 +34,7 @@ else: ) -> Iterator[Future[_T]]: ... @overload -def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = ...) -> _FT: ... # type: ignore +def ensure_future(coro_or_future: _FT, *, loop: AbstractEventLoop | None = ...) -> _FT: ... # type: ignore[misc] @overload def ensure_future(coro_or_future: Awaitable[_T], *, loop: AbstractEventLoop | None = ...) -> Task[_T]: ... @@ -232,7 +232,7 @@ if sys.version_info >= (3, 10): def shield(arg: _FutureT[_T]) -> Future[_T]: ... def sleep(delay: float, result: _T = ...) -> Future[_T]: ... @overload - def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore + def wait(fs: Iterable[_FT], *, timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore[misc] @overload def wait( fs: Iterable[Awaitable[_T]], *, timeout: float | None = ..., return_when: str = ... @@ -243,7 +243,9 @@ else: def shield(arg: _FutureT[_T], *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... def sleep(delay: float, result: _T = ..., *, loop: AbstractEventLoop | None = ...) -> Future[_T]: ... @overload - def wait(fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ...) -> Future[tuple[set[_FT], set[_FT]]]: ... # type: ignore + def wait( # type: ignore[misc] + fs: Iterable[_FT], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ... + ) -> Future[tuple[set[_FT], set[_FT]]]: ... @overload def wait( fs: Iterable[Awaitable[_T]], *, loop: AbstractEventLoop | None = ..., timeout: float | None = ..., return_when: str = ... diff --git a/stdlib/bz2.pyi b/stdlib/bz2.pyi index c49832759..c26698d88 100644 --- a/stdlib/bz2.pyi +++ b/stdlib/bz2.pyi @@ -111,7 +111,7 @@ class BZ2File(BaseStream, IO[bytes]): ) -> None: ... def read(self, size: int | None = ...) -> bytes: ... def read1(self, size: int = ...) -> bytes: ... - def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore + def readline(self, size: SupportsIndex = ...) -> bytes: ... # type: ignore[override] def readinto(self, b: WriteableBuffer) -> int: ... def readlines(self, size: SupportsIndex = ...) -> list[bytes]: ... def seek(self, offset: int, whence: int = ...) -> int: ... diff --git a/stdlib/codecs.pyi b/stdlib/codecs.pyi index ebd6911c3..01e5903a5 100644 --- a/stdlib/codecs.pyi +++ b/stdlib/codecs.pyi @@ -53,11 +53,11 @@ _BytesToBytesEncodingT = Literal[ @overload def encode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... @overload -def encode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... # type: ignore +def encode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... # type: ignore[misc] @overload def encode(obj: str, encoding: str = ..., errors: str = ...) -> bytes: ... @overload -def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... # type: ignore +def decode(obj: bytes, encoding: _BytesToBytesEncodingT, errors: str = ...) -> bytes: ... # type: ignore[misc] @overload def decode(obj: str, encoding: Literal["rot13", "rot_13"] = ..., errors: str = ...) -> str: ... @overload diff --git a/stdlib/collections/__init__.pyi b/stdlib/collections/__init__.pyi index 66a76941b..4a65cfe97 100644 --- a/stdlib/collections/__init__.pyi +++ b/stdlib/collections/__init__.pyi @@ -95,9 +95,9 @@ class UserString(Sequence[str]): def __contains__(self, char: object) -> bool: ... def __len__(self) -> int: ... # It should return a str to implement Sequence correctly, but it doesn't. - def __getitem__(self: _UserStringT, i: int | slice) -> _UserStringT: ... # type: ignore - def __iter__(self: _UserStringT) -> Iterator[_UserStringT]: ... # type: ignore - def __reversed__(self: _UserStringT) -> Iterator[_UserStringT]: ... # type: ignore + def __getitem__(self: _UserStringT, i: int | slice) -> _UserStringT: ... # type: ignore[override] + def __iter__(self: _UserStringT) -> Iterator[_UserStringT]: ... # type: ignore[override] + def __reversed__(self: _UserStringT) -> Iterator[_UserStringT]: ... # type: ignore[override] def __add__(self: _UserStringT, other: object) -> _UserStringT: ... def __mul__(self: _UserStringT, n: int) -> _UserStringT: ... def __mod__(self: _UserStringT, args: Any) -> _UserStringT: ... @@ -170,7 +170,7 @@ class deque(MutableSequence[_T], Generic[_T]): def extendleft(self, __iterable: Iterable[_T]) -> None: ... def insert(self, __i: int, __x: _T) -> None: ... def index(self, __x: _T, __start: int = ..., __stop: int = ...) -> int: ... - def pop(self) -> _T: ... # type: ignore + def pop(self) -> _T: ... # type: ignore[override] def popleft(self) -> _T: ... def remove(self, __value: _T) -> None: ... def reverse(self) -> None: ... @@ -212,7 +212,7 @@ class Counter(Dict[_T, int], Generic[_T]): def elements(self) -> Iterator[_T]: ... def most_common(self, n: int | None = ...) -> list[tuple[_T, int]]: ... @classmethod - def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore + def fromkeys(cls, iterable: Any, v: int | None = ...) -> NoReturn: ... # type: ignore[override] @overload def subtract(self, __iterable: None = ...) -> None: ... @overload @@ -233,13 +233,13 @@ class Counter(Dict[_T, int], Generic[_T]): def __add__(self, other: Counter[_T]) -> Counter[_T]: ... def __sub__(self, other: Counter[_T]) -> Counter[_T]: ... def __and__(self, other: Counter[_T]) -> Counter[_T]: ... - def __or__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore + def __or__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore[override] def __pos__(self) -> Counter[_T]: ... def __neg__(self) -> Counter[_T]: ... def __iadd__(self, other: Counter[_T]) -> Counter[_T]: ... def __isub__(self, other: Counter[_T]) -> Counter[_T]: ... def __iand__(self, other: Counter[_T]) -> Counter[_T]: ... - def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore + def __ior__(self, other: Counter[_T]) -> Counter[_T]: ... # type: ignore[override] @final class _OrderedDictKeysView(dict_keys[_KT_co, _VT_co], Reversible[_KT_co]): # type: ignore[misc] diff --git a/stdlib/configparser.pyi b/stdlib/configparser.pyi index 2d7c1c915..83d9d9690 100644 --- a/stdlib/configparser.pyi +++ b/stdlib/configparser.pyi @@ -122,7 +122,7 @@ class RawConfigParser(_parser): fallback: _T = ..., ) -> _T: ... # This is incompatible with MutableMapping so we ignore the type - @overload # type: ignore + @overload # type: ignore[override] def get(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ...) -> str: ... @overload def get(self, section: str, option: str, *, raw: bool = ..., vars: _section | None = ..., fallback: _T) -> str | _T: ... @@ -153,7 +153,16 @@ class SectionProxy(MutableMapping[str, str]): def parser(self) -> RawConfigParser: ... @property def name(self) -> str: ... - def get(self, option: str, fallback: str | None = ..., *, raw: bool = ..., vars: _section | None = ..., _impl: Any | None = ..., **kwargs: Any) -> str: ... # type: ignore + def get( # type: ignore[override] + self, + option: str, + fallback: str | None = ..., + *, + raw: bool = ..., + vars: _section | None = ..., + _impl: Any | None = ..., + **kwargs: Any, + ) -> str: ... # These are partially-applied version of the methods with the same names in # RawConfigParser; the stubs should be kept updated together @overload diff --git a/stdlib/contextlib.pyi b/stdlib/contextlib.pyi index 9d968e092..876a3647f 100644 --- a/stdlib/contextlib.pyi +++ b/stdlib/contextlib.pyi @@ -36,10 +36,10 @@ class _GeneratorContextManager(AbstractContextManager[_T_co]): def __call__(self, func: _F) -> _F: ... # type ignore to deal with incomplete ParamSpec support in mypy -def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, _GeneratorContextManager[_T]]: ... # type: ignore +def contextmanager(func: Callable[_P, Iterator[_T]]) -> Callable[_P, _GeneratorContextManager[_T]]: ... # type: ignore[misc] if sys.version_info >= (3, 7): - def asynccontextmanager(func: Callable[_P, AsyncIterator[_T]]) -> Callable[_P, AbstractAsyncContextManager[_T]]: ... # type: ignore + def asynccontextmanager(func: Callable[_P, AsyncIterator[_T]]) -> Callable[_P, AbstractAsyncContextManager[_T]]: ... # type: ignore[misc] class _SupportsClose(Protocol): def close(self) -> object: ... diff --git a/stdlib/ctypes/__init__.pyi b/stdlib/ctypes/__init__.pyi index bbe083f5d..cb9ea0097 100644 --- a/stdlib/ctypes/__init__.pyi +++ b/stdlib/ctypes/__init__.pyi @@ -76,8 +76,8 @@ class _CDataMeta(type): # By default mypy complains about the following two methods, because strictly speaking cls # might not be a Type[_CT]. However this can never actually happen, because the only class that # uses _CDataMeta as its metaclass is _CData. So it's safe to ignore the errors here. - def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore - def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore + def __mul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore[misc] + def __rmul__(cls: Type[_CT], other: int) -> Type[Array[_CT]]: ... # type: ignore[misc] class _CData(metaclass=_CDataMeta): _b_base: int diff --git a/stdlib/datetime.pyi b/stdlib/datetime.pyi index bd4d47e05..c58a03db7 100644 --- a/stdlib/datetime.pyi +++ b/stdlib/datetime.pyi @@ -276,10 +276,10 @@ class datetime(date): def utcoffset(self) -> timedelta | None: ... def tzname(self) -> str | None: ... def dst(self) -> timedelta | None: ... - def __le__(self, __other: datetime) -> bool: ... # type: ignore - def __lt__(self, __other: datetime) -> bool: ... # type: ignore - def __ge__(self, __other: datetime) -> bool: ... # type: ignore - def __gt__(self, __other: datetime) -> bool: ... # type: ignore + def __le__(self, __other: datetime) -> bool: ... # type: ignore[override] + def __lt__(self, __other: datetime) -> bool: ... # type: ignore[override] + def __ge__(self, __other: datetime) -> bool: ... # type: ignore[override] + def __gt__(self, __other: datetime) -> bool: ... # type: ignore[override] if sys.version_info >= (3, 8): @overload # type: ignore[override] def __sub__(self: _D, __other: timedelta) -> _D: ... diff --git a/stdlib/dbm/gnu.pyi b/stdlib/dbm/gnu.pyi index 7cec827e8..850c32ac0 100644 --- a/stdlib/dbm/gnu.pyi +++ b/stdlib/dbm/gnu.pyi @@ -31,7 +31,7 @@ class _gdbm: def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _gdbm: ... diff --git a/stdlib/dbm/ndbm.pyi b/stdlib/dbm/ndbm.pyi index a4b35a309..7b04c5385 100644 --- a/stdlib/dbm/ndbm.pyi +++ b/stdlib/dbm/ndbm.pyi @@ -29,7 +29,7 @@ class _dbm: def keys(self) -> list[bytes]: ... def setdefault(self, k: _KeyType, default: _ValueType = ...) -> bytes: ... # Don't exist at runtime - __new__: None # type: ignore - __init__: None # type: ignore + __new__: None # type: ignore[assignment] + __init__: None # type: ignore[assignment] def open(__filename: str, __flags: str = ..., __mode: int = ...) -> _dbm: ... diff --git a/stdlib/difflib.pyi b/stdlib/difflib.pyi index 7c4ae8e2f..944a63966 100644 --- a/stdlib/difflib.pyi +++ b/stdlib/difflib.pyi @@ -34,9 +34,7 @@ class SequenceMatcher(Generic[_T]): # mypy thinks the signatures of the overloads overlap, but the types still work fine @overload -def get_close_matches( # type: ignore - word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ... -) -> list[AnyStr]: ... +def get_close_matches(word: AnyStr, possibilities: Iterable[AnyStr], n: int = ..., cutoff: float = ...) -> list[AnyStr]: ... # type: ignore[misc] @overload def get_close_matches( word: Sequence[_T], possibilities: Iterable[Sequence[_T]], n: int = ..., cutoff: float = ... diff --git a/stdlib/distutils/command/check.pyi b/stdlib/distutils/command/check.pyi index 9149b540f..36895d2c1 100644 --- a/stdlib/distutils/command/check.pyi +++ b/stdlib/distutils/command/check.pyi @@ -5,7 +5,7 @@ from ..cmd import Command _Reporter = Any # really docutils.utils.Reporter # Only defined if docutils is installed. -class SilentReporter(_Reporter): # type: ignore +class SilentReporter(_Reporter): messages: Any def __init__( self, diff --git a/stdlib/email/_header_value_parser.pyi b/stdlib/email/_header_value_parser.pyi index f1b08b5d5..a14f5a2d2 100644 --- a/stdlib/email/_header_value_parser.pyi +++ b/stdlib/email/_header_value_parser.pyi @@ -334,7 +334,7 @@ class Terminal(str): def pop_trailing_ws(self) -> None: ... @property def comments(self) -> list[str]: ... - def __getnewargs__(self) -> tuple[str, str]: ... # type: ignore + def __getnewargs__(self) -> tuple[str, str]: ... # type: ignore[override] class WhiteSpaceTerminal(Terminal): @property diff --git a/stdlib/email/policy.pyi b/stdlib/email/policy.pyi index 72a54bcfb..1c813cb96 100644 --- a/stdlib/email/policy.pyi +++ b/stdlib/email/policy.pyi @@ -30,7 +30,7 @@ class Policy: class Compat32(Policy): def header_source_parse(self, sourcelines: list[str]) -> tuple[str, str]: ... def header_store_parse(self, name: str, value: str) -> tuple[str, str]: ... - def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore + def header_fetch_parse(self, name: str, value: str) -> str | Header: ... # type: ignore[override] def fold(self, name: str, value: str) -> str: ... def fold_binary(self, name: str, value: str) -> bytes: ... diff --git a/stdlib/enum.pyi b/stdlib/enum.pyi index 07fea104c..e30ff42a9 100644 --- a/stdlib/enum.pyi +++ b/stdlib/enum.pyi @@ -59,7 +59,7 @@ class auto(IntFlag): def __new__(cls: Type[_T]) -> _T: ... class Flag(Enum): - name: str | None # type: ignore + name: str | None # type: ignore[assignment] value: int def __contains__(self: _T, other: _T) -> bool: ... def __repr__(self) -> str: ... diff --git a/stdlib/http/client.pyi b/stdlib/http/client.pyi index c450db587..1558f6ff4 100644 --- a/stdlib/http/client.pyi +++ b/stdlib/http/client.pyi @@ -96,7 +96,7 @@ class HTTPResponse(io.BufferedIOBase, BinaryIO): def read(self, amt: int | None = ...) -> bytes: ... def read1(self, n: int = ...) -> bytes: ... def readinto(self, b: WriteableBuffer) -> int: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore + def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override] @overload def getheader(self, name: str) -> str | None: ... @overload diff --git a/stdlib/http/cookies.pyi b/stdlib/http/cookies.pyi index 7e9513adb..4244c0c6a 100644 --- a/stdlib/http/cookies.pyi +++ b/stdlib/http/cookies.pyi @@ -29,7 +29,7 @@ class Morsel(Dict[str, Any], Generic[_T]): def set(self, key: str, val: str, coded_val: _T, LegalChars: str = ...) -> None: ... def setdefault(self, key: str, val: str | None = ...) -> str: ... # The dict update can also get a keywords argument so this is incompatible - @overload # type: ignore + @overload # type: ignore[override] def update(self, values: Mapping[str, str]) -> None: ... @overload def update(self, values: Iterable[tuple[str, str]]) -> None: ... diff --git a/stdlib/importlib/util.pyi b/stdlib/importlib/util.pyi index 30b8765fa..d6c410c84 100644 --- a/stdlib/importlib/util.pyi +++ b/stdlib/importlib/util.pyi @@ -7,9 +7,9 @@ from typing_extensions import ParamSpec _P = ParamSpec("_P") -def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore -def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore -def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore +def module_for_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore[misc] +def set_loader(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore[misc] +def set_package(fxn: Callable[_P, types.ModuleType]) -> Callable[_P, types.ModuleType]: ... # type: ignore[misc] def resolve_name(name: str, package: str | None) -> str: ... MAGIC_NUMBER: bytes diff --git a/stdlib/inspect.pyi b/stdlib/inspect.pyi index 61a004381..511944160 100644 --- a/stdlib/inspect.pyi +++ b/stdlib/inspect.pyi @@ -331,7 +331,7 @@ class Traceback(NamedTuple): lineno: int function: str code_context: list[str] | None - index: int | None # type: ignore + index: int | None # type: ignore[assignment] class FrameInfo(NamedTuple): frame: FrameType @@ -339,7 +339,7 @@ class FrameInfo(NamedTuple): lineno: int function: str code_context: list[str] | None - index: int | None # type: ignore + index: int | None # type: ignore[assignment] def getframeinfo(frame: FrameType | TracebackType, context: int = ...) -> Traceback: ... def getouterframes(frame: Any, context: int = ...) -> list[FrameInfo]: ... diff --git a/stdlib/io.pyi b/stdlib/io.pyi index 634290700..29c42ed9d 100644 --- a/stdlib/io.pyi +++ b/stdlib/io.pyi @@ -65,7 +65,7 @@ class BufferedIOBase(IOBase): class FileIO(RawIOBase, BinaryIO): mode: str - name: StrOrBytesPath | int # type: ignore + name: StrOrBytesPath | int # type: ignore[assignment] def __init__( self, file: StrOrBytesPath | int, mode: str = ..., closefd: bool = ..., opener: _Opener | None = ... ) -> None: ... @@ -87,7 +87,7 @@ class BytesIO(BufferedIOBase, BinaryIO): if sys.version_info >= (3, 7): def read1(self, __size: int | None = ...) -> bytes: ... else: - def read1(self, __size: int | None) -> bytes: ... # type: ignore + def read1(self, __size: int | None) -> bytes: ... # type: ignore[override] class BufferedReader(BufferedIOBase, BinaryIO): def __enter__(self: Self) -> Self: ... @@ -96,7 +96,7 @@ class BufferedReader(BufferedIOBase, BinaryIO): if sys.version_info >= (3, 7): def read1(self, __size: int = ...) -> bytes: ... else: - def read1(self, __size: int) -> bytes: ... # type: ignore + def read1(self, __size: int) -> bytes: ... # type: ignore[override] class BufferedWriter(BufferedIOBase, BinaryIO): def __enter__(self: Self) -> Self: ... @@ -110,7 +110,7 @@ class BufferedRandom(BufferedReader, BufferedWriter): if sys.version_info >= (3, 7): def read1(self, __size: int = ...) -> bytes: ... else: - def read1(self, __size: int) -> bytes: ... # type: ignore + def read1(self, __size: int) -> bytes: ... # type: ignore[override] class BufferedRWPair(BufferedIOBase): def __init__(self, reader: RawIOBase, writer: RawIOBase, buffer_size: int = ...) -> None: ... @@ -120,13 +120,13 @@ class TextIOBase(IOBase): encoding: str errors: str | None newlines: str | Tuple[str, ...] | None - def __iter__(self) -> Iterator[str]: ... # type: ignore - def __next__(self) -> str: ... # type: ignore + def __iter__(self) -> Iterator[str]: ... # type: ignore[override] + def __next__(self) -> str: ... # type: ignore[override] def detach(self) -> BinaryIO: ... def write(self, __s: str) -> int: ... - def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore - def readline(self, __size: int = ...) -> str: ... # type: ignore - def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore + def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override] + def readline(self, __size: int = ...) -> str: ... # type: ignore[override] + def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore[override] def read(self, __size: int | None = ...) -> str: ... def tell(self) -> int: ... @@ -160,11 +160,11 @@ class TextIOWrapper(TextIOBase, TextIO): ) -> None: ... # These are inherited from TextIOBase, but must exist in the stub to satisfy mypy. def __enter__(self: Self) -> Self: ... - def __iter__(self) -> Iterator[str]: ... # type: ignore - def __next__(self) -> str: ... # type: ignore - def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore - def readline(self, __size: int = ...) -> str: ... # type: ignore - def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore + def __iter__(self) -> Iterator[str]: ... # type: ignore[override] + def __next__(self) -> str: ... # type: ignore[override] + def writelines(self, __lines: Iterable[str]) -> None: ... # type: ignore[override] + def readline(self, __size: int = ...) -> str: ... # type: ignore[override] + def readlines(self, __hint: int = ...) -> list[str]: ... # type: ignore[override] def seek(self, __cookie: int, __whence: int = ...) -> int: ... class StringIO(TextIOWrapper): diff --git a/stdlib/logging/handlers.pyi b/stdlib/logging/handlers.pyi index 5be624872..50d6d0583 100644 --- a/stdlib/logging/handlers.pyi +++ b/stdlib/logging/handlers.pyi @@ -128,7 +128,7 @@ class SocketHandler(Handler): def createSocket(self) -> None: ... class DatagramHandler(SocketHandler): - def makeSocket(self) -> socket: ... # type: ignore + def makeSocket(self) -> socket: ... # type: ignore[override] class SysLogHandler(Handler): LOG_EMERG: int diff --git a/stdlib/math.pyi b/stdlib/math.pyi index e3ac0e990..d5e6f99df 100644 --- a/stdlib/math.pyi +++ b/stdlib/math.pyi @@ -103,7 +103,7 @@ def pow(__x: _SupportsFloatOrIndex, __y: _SupportsFloatOrIndex) -> float: ... if sys.version_info >= (3, 8): @overload - def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = ...) -> int: ... # type: ignore + def prod(__iterable: Iterable[SupportsIndex], *, start: SupportsIndex = ...) -> int: ... # type: ignore[misc] @overload def prod(__iterable: Iterable[_SupportsFloatOrIndex], *, start: _SupportsFloatOrIndex = ...) -> float: ... diff --git a/stdlib/os/__init__.pyi b/stdlib/os/__init__.pyi index 843d72874..ebbb8a14c 100644 --- a/stdlib/os/__init__.pyi +++ b/stdlib/os/__init__.pyi @@ -210,7 +210,7 @@ class _Environ(MutableMapping[AnyStr, AnyStr], Generic[AnyStr]): putenv: Callable[[AnyStr, AnyStr], None], unsetenv: Callable[[AnyStr, AnyStr], None], ) -> None: ... - def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... # type: ignore + def setdefault(self, key: AnyStr, value: AnyStr) -> AnyStr: ... # type: ignore[override] def copy(self) -> dict[AnyStr, AnyStr]: ... def __delitem__(self, key: AnyStr) -> None: ... def __getitem__(self, key: AnyStr) -> AnyStr: ... @@ -773,7 +773,7 @@ if sys.platform != "win32": class _wrap_close(_TextIOWrapper): def __init__(self, stream: _TextIOWrapper, proc: Popen[str]) -> None: ... - def close(self) -> int | None: ... # type: ignore + def close(self) -> int | None: ... # type: ignore[override] def popen(cmd: str, mode: str = ..., buffering: int = ...) -> _wrap_close: ... def spawnl(mode: int, file: StrOrBytesPath, arg0: StrOrBytesPath, *args: StrOrBytesPath) -> int: ... diff --git a/stdlib/smtpd.pyi b/stdlib/smtpd.pyi index 2b6020524..ef0ada2c7 100644 --- a/stdlib/smtpd.pyi +++ b/stdlib/smtpd.pyi @@ -40,7 +40,7 @@ class SMTPChannel(asynchat.async_chat): decode_data: bool = ..., ) -> None: ... # base asynchat.async_chat.push() accepts bytes - def push(self, msg: str) -> None: ... # type: ignore + def push(self, msg: str) -> None: ... # type: ignore[override] def collect_incoming_data(self, data: bytes) -> None: ... def found_terminator(self) -> None: ... def smtp_HELO(self, arg: str) -> None: ... @@ -77,11 +77,7 @@ class SMTPServer(asyncore.dispatcher): class DebuggingServer(SMTPServer): ... class PureProxy(SMTPServer): - def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str - ) -> str | None: ... + def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override] class MailmanProxy(PureProxy): - def process_message( # type: ignore - self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str - ) -> str | None: ... + def process_message(self, peer: _Address, mailfrom: str, rcpttos: list[str], data: bytes | str) -> str | None: ... # type: ignore[override] diff --git a/stdlib/socket.pyi b/stdlib/socket.pyi index 1f5ae6eb7..430fef4ff 100644 --- a/stdlib/socket.pyi +++ b/stdlib/socket.pyi @@ -570,9 +570,9 @@ class socket(_socket.socket): ) -> BinaryIO: ... def sendfile(self, file: BinaryIO, offset: int = ..., count: int | None = ...) -> int: ... @property - def family(self) -> AddressFamily: ... # type: ignore + def family(self) -> AddressFamily: ... # type: ignore[override] @property - def type(self) -> SocketKind: ... # type: ignore + def type(self) -> SocketKind: ... # type: ignore[override] def get_inheritable(self) -> bool: ... def set_inheritable(self, inheritable: bool) -> None: ... @@ -593,7 +593,7 @@ if sys.platform == "win32": def socketpair(family: int = ..., type: int = ..., proto: int = ...) -> tuple[socket, socket]: ... else: - def socketpair( # type: ignore + def socketpair( family: int | AddressFamily | None = ..., type: SocketType | int = ..., proto: int = ... ) -> tuple[socket, socket]: ... diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 114a031d9..07fa31b80 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -1136,7 +1136,7 @@ class Canvas(Widget, XView, YView): # Canvas.bbox() args are `str | _CanvasItemId`, but mypy rejects that # description because it's incompatible with Misc.bbox(), an alias for # Misc.grid_bbox(). Yes it is, but there's not much we can do about it. - def bbox(self, *args: str | _CanvasItemId) -> tuple[int, int, int, int]: ... # type: ignore + def bbox(self, *args: str | _CanvasItemId) -> tuple[int, int, int, int]: ... # type: ignore[override] @overload def tag_bind( self, @@ -1506,10 +1506,10 @@ class Canvas(Widget, XView, YView): # # But mypy doesn't like aliasing here (maybe because Misc defines the same names) def tag_lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... - def lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore + def lower(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override] def tag_raise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... - def tkraise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore - def lift(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore + def tkraise(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override] + def lift(self, __first: str | _CanvasItemId, __second: str | _CanvasItemId | None = ...) -> None: ... # type: ignore[override] def scale(self, *args): ... def scan_mark(self, x, y): ... def scan_dragto(self, x, y, gain: int = ...): ... @@ -1738,7 +1738,7 @@ class Entry(Widget, XView): def scan_mark(self, x): ... def scan_dragto(self, x): ... def selection_adjust(self, index: _EntryIndex) -> None: ... - def selection_clear(self) -> None: ... # type: ignore + def selection_clear(self) -> None: ... # type: ignore[override] def selection_from(self, index: _EntryIndex) -> None: ... def selection_present(self) -> bool: ... def selection_range(self, start: _EntryIndex, end: _EntryIndex) -> None: ... @@ -1984,7 +1984,7 @@ class Listbox(Widget, XView, YView): def see(self, index): ... def selection_anchor(self, index): ... select_anchor: Any - def selection_clear(self, first, last: Any | None = ...): ... # type: ignore + def selection_clear(self, first, last: Any | None = ...): ... # type: ignore[override] select_clear: Any def selection_includes(self, index): ... select_includes: Any @@ -2794,7 +2794,7 @@ class Text(Widget, XView, YView): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, index: _TextIndex) -> tuple[int, int, int, int] | None: ... # type: ignore + def bbox(self, index: _TextIndex) -> tuple[int, int, int, int] | None: ... # type: ignore[override] def compare(self, index1: _TextIndex, op: Literal["<", "<=", "==", ">=", ">", "!="], index2: _TextIndex) -> bool: ... def count(self, index1, index2, *args): ... # TODO @overload diff --git a/stdlib/tkinter/tix.pyi b/stdlib/tkinter/tix.pyi index 3037212c0..4914234c4 100644 --- a/stdlib/tkinter/tix.pyi +++ b/stdlib/tkinter/tix.pyi @@ -266,7 +266,7 @@ class PanedWindow(TixWidget): def __init__(self, master: tkinter.Widget | None, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def add(self, name: str, cnf: dict[str, Any] = ..., **kw: Any) -> None: ... def delete(self, name: str) -> None: ... - def forget(self, name: str) -> None: ... # type: ignore + def forget(self, name: str) -> None: ... # type: ignore[override] def panecget(self, entry: str, opt: Any) -> Any: ... def paneconfigure(self, entry: str, cnf: dict[str, Any] = ..., **kw: Any) -> Any | None: ... def panes(self) -> list[tkinter.Widget]: ... diff --git a/stdlib/tkinter/ttk.pyi b/stdlib/tkinter/ttk.pyi index be0713ec2..0cb806fdd 100644 --- a/stdlib/tkinter/ttk.pyi +++ b/stdlib/tkinter/ttk.pyi @@ -158,7 +158,7 @@ class Entry(Widget, tkinter.Entry): width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -183,7 +183,7 @@ class Entry(Widget, tkinter.Entry): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Entry().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -238,7 +238,7 @@ class Combobox(Entry): width: int = ..., xscrollcommand: tkinter._XYScrollCommand = ..., # undocumented ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -266,7 +266,7 @@ class Combobox(Entry): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Combobox().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -547,7 +547,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): width: int = ..., ) -> None: ... def add(self, child: tkinter.Widget, *, weight: int = ..., **kw) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -561,7 +561,7 @@ class Panedwindow(Widget, tkinter.PanedWindow): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Panedwindow().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -688,7 +688,7 @@ class Scale(Widget, tkinter.Scale): value: float = ..., variable: tkinter.IntVar | tkinter.DoubleVar = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -708,7 +708,7 @@ class Scale(Widget, tkinter.Scale): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Scale().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -742,7 +742,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): style: str = ..., takefocus: tkinter._TakeFocusValue = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -756,7 +756,7 @@ class Scrollbar(Widget, tkinter.Scrollbar): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... # config must be copy/pasted, otherwise ttk.Scrollbar().config is mypy error (don't know why) - @overload # type: ignore + @overload # type: ignore[override] def config( self, cnf: dict[str, Any] | None = ..., @@ -852,7 +852,7 @@ if sys.version_info >= (3, 7): wrap: bool = ..., xscrollcommand: tkinter._XYScrollCommand = ..., ) -> None: ... - @overload # type: ignore + @overload # type: ignore[override] def configure( self, cnf: dict[str, Any] | None = ..., @@ -883,7 +883,7 @@ if sys.version_info >= (3, 7): ) -> dict[str, tuple[str, str, str, Any, Any]] | None: ... @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... - config = configure # type: ignore + config = configure # type: ignore[assignment] def set(self, value: Any) -> None: ... class _TreeviewItemDict(TypedDict): @@ -959,7 +959,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): @overload def configure(self, cnf: str) -> tuple[str, str, str, Any, Any]: ... config = configure - def bbox(self, item, column: _TreeviewColumnId | None = ...) -> tuple[int, int, int, int] | Literal[""]: ... # type: ignore + def bbox(self, item, column: _TreeviewColumnId | None = ...) -> tuple[int, int, int, int] | Literal[""]: ... # type: ignore[override] def get_children(self, item: str | None = ...) -> Tuple[str, ...]: ... def set_children(self, item: str, *newchildren: str) -> None: ... @overload @@ -987,7 +987,7 @@ class Treeview(Widget, tkinter.XView, tkinter.YView): def delete(self, *items: str) -> None: ... def detach(self, *items: str) -> None: ... def exists(self, item: str) -> bool: ... - @overload # type: ignore + @overload # type: ignore[override] def focus(self, item: None = ...) -> str: ... # can return empty string @overload def focus(self, item: str) -> Literal[""]: ... diff --git a/stdlib/turtle.pyi b/stdlib/turtle.pyi index 9371f2a7a..dd3dd9ecb 100644 --- a/stdlib/turtle.pyi +++ b/stdlib/turtle.pyi @@ -178,7 +178,7 @@ class TPen(object): def isvisible(self) -> bool: ... # Note: signatures 1 and 2 overlap unsafely when no arguments are provided @overload - def pen(self) -> _PenState: ... # type: ignore + def pen(self) -> _PenState: ... # type: ignore[misc] @overload def pen( self, @@ -220,7 +220,7 @@ class RawTurtle(TPen, TNavigator): def shape(self, name: str) -> None: ... # Unsafely overlaps when no arguments are provided @overload - def shapesize(self) -> tuple[float, float, float]: ... # type: ignore + def shapesize(self) -> tuple[float, float, float]: ... # type: ignore[misc] @overload def shapesize( self, stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ... @@ -231,7 +231,7 @@ class RawTurtle(TPen, TNavigator): def shearfactor(self, shear: float) -> None: ... # Unsafely overlaps when no arguments are provided @overload - def shapetransform(self) -> tuple[float, float, float, float]: ... # type: ignore + def shapetransform(self) -> tuple[float, float, float, float]: ... # type: ignore[misc] @overload def shapetransform( self, t11: float | None = ..., t12: float | None = ..., t21: float | None = ..., t22: float | None = ... @@ -449,7 +449,7 @@ def isvisible() -> bool: ... # Note: signatures 1 and 2 overlap unsafely when no arguments are provided @overload -def pen() -> _PenState: ... # type: ignore +def pen() -> _PenState: ... # type: ignore[misc] @overload def pen( pen: _PenState | None = ..., @@ -485,7 +485,7 @@ def shape(name: str) -> None: ... # Unsafely overlaps when no arguments are provided @overload -def shapesize() -> tuple[float, float, float]: ... # type: ignore +def shapesize() -> tuple[float, float, float]: ... # type: ignore[misc] @overload def shapesize(stretch_wid: float | None = ..., stretch_len: float | None = ..., outline: float | None = ...) -> None: ... @overload @@ -495,7 +495,7 @@ def shearfactor(shear: float) -> None: ... # Unsafely overlaps when no arguments are provided @overload -def shapetransform() -> tuple[float, float, float, float]: ... # type: ignore +def shapetransform() -> tuple[float, float, float, float]: ... # type: ignore[misc] @overload def shapetransform( t11: float | None = ..., t12: float | None = ..., t21: float | None = ..., t22: float | None = ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index 899024f2d..65262ece0 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -36,7 +36,7 @@ _V_co = TypeVar("_V_co", covariant=True) @final class _Cell: - __hash__: None # type: ignore + __hash__: None # type: ignore[assignment] cell_contents: Any @final @@ -149,7 +149,7 @@ class CodeType: @final class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]): - __hash__: None # type: ignore + __hash__: None # type: ignore[assignment] def __init__(self, mapping: Mapping[_KT, _VT_co]) -> None: ... def __getitem__(self, k: _KT) -> _VT_co: ... def __iter__(self) -> Iterator[_KT]: ... @@ -165,7 +165,7 @@ class MappingProxyType(Mapping[_KT, _VT_co], Generic[_KT, _VT_co]): def __ror__(self, __value: Mapping[_T1, _T2]) -> dict[_KT | _T1, _VT_co | _T2]: ... class SimpleNamespace: - __hash__: None # type: ignore + __hash__: None # type: ignore[assignment] def __init__(self, **kwargs: Any) -> None: ... def __getattribute__(self, name: str) -> Any: ... def __setattr__(self, name: str, value: Any) -> None: ... @@ -382,9 +382,9 @@ _P = ParamSpec("_P") # it's not really an Awaitable, but can be used in an await expression. Real type: Generator & Awaitable @overload -def coroutine(func: Callable[_P, Generator[_R, Any, Any]]) -> Callable[_P, Awaitable[_R]]: ... # type: ignore +def coroutine(func: Callable[_P, Generator[_R, Any, Any]]) -> Callable[_P, Awaitable[_R]]: ... # type: ignore[misc] @overload -def coroutine(func: _Fn) -> _Fn: ... # type: ignore +def coroutine(func: _Fn) -> _Fn: ... # type: ignore[misc] if sys.version_info >= (3, 8): CellType = _Cell diff --git a/stdlib/typing.pyi b/stdlib/typing.pyi index 4656add7e..f0124d8b9 100644 --- a/stdlib/typing.pyi +++ b/stdlib/typing.pyi @@ -96,7 +96,7 @@ _T_contra = TypeVar("_T_contra", contravariant=True) # Ditto contravariant. _TC = TypeVar("_TC", bound=Type[object]) def no_type_check(arg: _F) -> _F: ... -def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore +def no_type_check_decorator(decorator: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore[misc] # Type aliases and type constructors diff --git a/stdlib/unittest/case.pyi b/stdlib/unittest/case.pyi index e8e047744..dd7d90397 100644 --- a/stdlib/unittest/case.pyi +++ b/stdlib/unittest/case.pyi @@ -81,7 +81,7 @@ class TestCase: def assertLess(self, a: Any, b: Any, msg: Any = ...) -> None: ... def assertLessEqual(self, a: Any, b: Any, msg: Any = ...) -> None: ... @overload - def assertRaises( # type: ignore + def assertRaises( # type: ignore[misc] self, expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...], callable: Callable[..., Any], @@ -91,7 +91,7 @@ class TestCase: @overload def assertRaises(self, expected_exception: Type[_E] | Tuple[Type[_E], ...], msg: Any = ...) -> _AssertRaisesContext[_E]: ... @overload - def assertRaisesRegex( # type: ignore + def assertRaisesRegex( # type: ignore[misc] self, expected_exception: Type[BaseException] | Tuple[Type[BaseException], ...], expected_regex: str | bytes | Pattern[str] | Pattern[bytes], @@ -107,13 +107,13 @@ class TestCase: msg: Any = ..., ) -> _AssertRaisesContext[_E]: ... @overload - def assertWarns( # type: ignore + def assertWarns( # type: ignore[misc] self, expected_warning: Type[Warning] | Tuple[Type[Warning], ...], callable: Callable[..., Any], *args: Any, **kwargs: Any ) -> None: ... @overload def assertWarns(self, expected_warning: Type[Warning] | Tuple[Type[Warning], ...], msg: Any = ...) -> _AssertWarnsContext: ... @overload - def assertWarnsRegex( # type: ignore + def assertWarnsRegex( # type: ignore[misc] self, expected_warning: Type[Warning] | Tuple[Type[Warning], ...], expected_regex: str | bytes | Pattern[str] | Pattern[bytes], @@ -195,7 +195,7 @@ class TestCase: def assert_(self, expr: bool, msg: Any = ...) -> None: ... def failIf(self, expr: bool, msg: Any = ...) -> None: ... @overload - def failUnlessRaises( # type: ignore + def failUnlessRaises( # type: ignore[misc] self, exception: Type[BaseException] | Tuple[Type[BaseException], ...], callable: Callable[..., Any] = ..., @@ -215,7 +215,7 @@ class TestCase: def assertRegexpMatches(self, text: AnyStr, regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... def assertNotRegexpMatches(self, text: AnyStr, regex: AnyStr | Pattern[AnyStr], msg: Any = ...) -> None: ... @overload - def assertRaisesRegexp( # type: ignore + def assertRaisesRegexp( # type: ignore[misc] self, exception: Type[BaseException] | Tuple[Type[BaseException], ...], expected_regex: str | bytes | Pattern[str] | Pattern[bytes], diff --git a/stdlib/unittest/mock.pyi b/stdlib/unittest/mock.pyi index 567ce346f..381011352 100644 --- a/stdlib/unittest/mock.pyi +++ b/stdlib/unittest/mock.pyi @@ -71,7 +71,7 @@ class _MockIter: class Base: def __init__(self, *args: Any, **kwargs: Any) -> None: ... -class NonCallableMock(Base, Any): # type: ignore +class NonCallableMock(Base, Any): def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ... def __init__( self, @@ -210,7 +210,7 @@ class _patcher: # Ideally we'd be able to add an overload for it so that the return type is _patch[MagicMock], # but that's impossible with the current type system. @overload - def __call__( # type: ignore + def __call__( # type: ignore[misc] self, target: Any, new: _T, @@ -222,7 +222,7 @@ class _patcher: **kwargs: Any, ) -> _patch[_T]: ... @overload - def __call__( # type: ignore + def __call__( self, target: Any, *, @@ -235,7 +235,7 @@ class _patcher: ) -> _patch[MagicMock | AsyncMock]: ... else: @overload - def __call__( # type: ignore + def __call__( # type: ignore[misc] self, target: Any, new: _T, @@ -247,7 +247,7 @@ class _patcher: **kwargs: Any, ) -> _patch[_T]: ... @overload - def __call__( # type: ignore + def __call__( self, target: Any, *, @@ -260,7 +260,7 @@ class _patcher: ) -> _patch[MagicMock]: ... if sys.version_info >= (3, 8): @overload - def object( # type: ignore + def object( # type: ignore[misc] self, target: Any, attribute: str, @@ -273,7 +273,7 @@ class _patcher: **kwargs: Any, ) -> _patch[_T]: ... @overload - def object( # type: ignore + def object( self, target: Any, attribute: str, @@ -287,7 +287,7 @@ class _patcher: ) -> _patch[MagicMock | AsyncMock]: ... else: @overload - def object( # type: ignore + def object( # type: ignore[misc] self, target: Any, attribute: str, @@ -300,7 +300,7 @@ class _patcher: **kwargs: Any, ) -> _patch[_T]: ... @overload - def object( # type: ignore + def object( self, target: Any, attribute: str, diff --git a/stdlib/unittest/signals.pyi b/stdlib/unittest/signals.pyi index 375b7d736..453bc9caf 100644 --- a/stdlib/unittest/signals.pyi +++ b/stdlib/unittest/signals.pyi @@ -11,4 +11,4 @@ def removeResult(result: unittest.result.TestResult) -> bool: ... @overload def removeHandler(method: None = ...) -> None: ... @overload -def removeHandler(method: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore +def removeHandler(method: Callable[_P, _T]) -> Callable[_P, _T]: ... # type: ignore[misc] diff --git a/stdlib/weakref.pyi b/stdlib/weakref.pyi index dbb6b49f2..16ebba39e 100644 --- a/stdlib/weakref.pyi +++ b/stdlib/weakref.pyi @@ -37,9 +37,9 @@ class WeakValueDictionary(MutableMapping[_KT, _VT]): def __str__(self) -> str: ... def copy(self) -> WeakValueDictionary[_KT, _VT]: ... # These are incompatible with Mapping - def keys(self) -> Iterator[_KT]: ... # type: ignore - def values(self) -> Iterator[_VT]: ... # type: ignore - def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore + def keys(self) -> Iterator[_KT]: ... # type: ignore[override] + def values(self) -> Iterator[_VT]: ... # type: ignore[override] + def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def itervaluerefs(self) -> Iterator[KeyedRef[_KT, _VT]]: ... def valuerefs(self) -> list[KeyedRef[_KT, _VT]]: ... def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... @@ -68,9 +68,9 @@ class WeakKeyDictionary(MutableMapping[_KT, _VT]): def __str__(self) -> str: ... def copy(self) -> WeakKeyDictionary[_KT, _VT]: ... # These are incompatible with Mapping - def keys(self) -> Iterator[_KT]: ... # type: ignore - def values(self) -> Iterator[_VT]: ... # type: ignore - def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore + def keys(self) -> Iterator[_KT]: ... # type: ignore[override] + def values(self) -> Iterator[_VT]: ... # type: ignore[override] + def items(self) -> Iterator[tuple[_KT, _VT]]: ... # type: ignore[override] def keyrefs(self) -> list[ref[_KT]]: ... def setdefault(self, key: _KT, default: _VT = ...) -> _VT: ... @overload diff --git a/stdlib/xml/dom/minicompat.pyi b/stdlib/xml/dom/minicompat.pyi index 4bc60f7ab..46d55c666 100644 --- a/stdlib/xml/dom/minicompat.pyi +++ b/stdlib/xml/dom/minicompat.pyi @@ -11,7 +11,7 @@ class NodeList(List[_T]): class EmptyNodeList(Tuple[Any, ...]): length: int def item(self, index: int) -> None: ... - def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore + def __add__(self, other: Iterable[_T]) -> NodeList[_T]: ... # type: ignore[override] def __radd__(self, other: Iterable[_T]) -> NodeList[_T]: ... def defproperty(klass: Type[Any], name: str, doc: str) -> None: ... diff --git a/stdlib/xml/dom/xmlbuilder.pyi b/stdlib/xml/dom/xmlbuilder.pyi index d8936bdc2..a77c99790 100644 --- a/stdlib/xml/dom/xmlbuilder.pyi +++ b/stdlib/xml/dom/xmlbuilder.pyi @@ -2,5 +2,5 @@ from typing import Any def __getattr__(name: str) -> Any: ... # incomplete -class DocumentLS(Any): ... # type: ignore -class DOMImplementationLS(Any): ... # type: ignore +class DocumentLS(Any): ... +class DOMImplementationLS(Any): ... diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 061df849e..b715e8b29 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -68,7 +68,7 @@ class DateTime: def __le__(self, other: _DateTimeComparable) -> bool: ... def __gt__(self, other: _DateTimeComparable) -> bool: ... def __ge__(self, other: _DateTimeComparable) -> bool: ... - def __eq__(self, other: _DateTimeComparable) -> bool: ... # type: ignore + def __eq__(self, other: _DateTimeComparable) -> bool: ... # type: ignore[override] def make_comparable(self, other: _DateTimeComparable) -> tuple[str, str]: ... # undocumented def timetuple(self) -> time.struct_time: ... # undocumented def decode(self, data: Any) -> None: ... diff --git a/stdlib/xmlrpc/server.pyi b/stdlib/xmlrpc/server.pyi index bf5611fba..f84253cef 100644 --- a/stdlib/xmlrpc/server.pyi +++ b/stdlib/xmlrpc/server.pyi @@ -120,7 +120,16 @@ class CGIXMLRPCRequestHandler(SimpleXMLRPCDispatcher): def handle_request(self, request_text: str | None = ...) -> None: ... class ServerHTMLDoc(pydoc.HTMLDoc): # undocumented - def docroutine(self, object: object, name: str, mod: str | None = ..., funcs: Mapping[str, str] = ..., classes: Mapping[str, str] = ..., methods: Mapping[str, str] = ..., cl: type | None = ...) -> str: ... # type: ignore + def docroutine( # type: ignore[override] + self, + object: object, + name: str, + mod: str | None = ..., + funcs: Mapping[str, str] = ..., + classes: Mapping[str, str] = ..., + methods: Mapping[str, str] = ..., + cl: type | None = ..., + ) -> str: ... def docserver(self, server_name: str, package_documentation: str, methods: dict[str, str]) -> str: ... class XMLRPCDocGenerator: # undocumented diff --git a/stdlib/zipfile.pyi b/stdlib/zipfile.pyi index 233542854..710b9b237 100644 --- a/stdlib/zipfile.pyi +++ b/stdlib/zipfile.pyi @@ -97,10 +97,10 @@ class ZipExtFile(io.BufferedIOBase): close_fileobj: Literal[False] = ..., ) -> None: ... def read(self, n: int | None = ...) -> bytes: ... - def readline(self, limit: int = ...) -> bytes: ... # type: ignore + def readline(self, limit: int = ...) -> bytes: ... # type: ignore[override] def __repr__(self) -> str: ... def peek(self, n: int = ...) -> bytes: ... - def read1(self, n: int | None) -> bytes: ... # type: ignore + def read1(self, n: int | None) -> bytes: ... # type: ignore[override] if sys.version_info >= (3, 7): def seek(self, offset: int, whence: int = ...) -> int: ... diff --git a/stubs/Flask/flask/wrappers.pyi b/stubs/Flask/flask/wrappers.pyi index e5a428655..e603b6090 100644 --- a/stubs/Flask/flask/wrappers.pyi +++ b/stubs/Flask/flask/wrappers.pyi @@ -20,7 +20,7 @@ class Request(RequestBase, JSONMixin): # case in its supertype. # We would require something like https://github.com/python/typing/issues/241 @property - def max_content_length(self) -> int | None: ... # type: ignore + def max_content_length(self) -> int | None: ... # type: ignore[override] @property def endpoint(self) -> str | None: ... @property diff --git a/stubs/Jinja2/jinja2/utils.pyi b/stubs/Jinja2/jinja2/utils.pyi index 41488c041..ff7f92b44 100644 --- a/stubs/Jinja2/jinja2/utils.pyi +++ b/stubs/Jinja2/jinja2/utils.pyi @@ -10,15 +10,15 @@ concat: Any _CallableT = TypeVar("_CallableT", bound=Callable[..., Any]) -class _ContextFunction(Protocol[_CallableT]): # type: ignore +class _ContextFunction(Protocol[_CallableT]): contextfunction: Literal[True] __call__: _CallableT -class _EvalContextFunction(Protocol[_CallableT]): # type: ignore +class _EvalContextFunction(Protocol[_CallableT]): evalcontextfunction: Literal[True] __call__: _CallableT -class _EnvironmentFunction(Protocol[_CallableT]): # type: ignore +class _EnvironmentFunction(Protocol[_CallableT]): environmentfunction: Literal[True] __call__: _CallableT diff --git a/stubs/Markdown/markdown/inlinepatterns.pyi b/stubs/Markdown/markdown/inlinepatterns.pyi index 04e140af5..f534661dc 100644 --- a/stubs/Markdown/markdown/inlinepatterns.pyi +++ b/stubs/Markdown/markdown/inlinepatterns.pyi @@ -48,7 +48,7 @@ class Pattern: class InlineProcessor(Pattern): safe_mode: bool = ... def __init__(self, pattern, md: Any | None = ...) -> None: ... - def handleMatch(self, m: Match[str], data) -> tuple[Element, int, int] | tuple[None, None, None]: ... # type: ignore + def handleMatch(self, m: Match[str], data) -> tuple[Element, int, int] | tuple[None, None, None]: ... # type: ignore[override] class SimpleTextPattern(Pattern): ... class SimpleTextInlineProcessor(InlineProcessor): ... diff --git a/stubs/MarkupSafe/markupsafe/__init__.pyi b/stubs/MarkupSafe/markupsafe/__init__.pyi index adc329a26..b265433ed 100644 --- a/stubs/MarkupSafe/markupsafe/__init__.pyi +++ b/stubs/MarkupSafe/markupsafe/__init__.pyi @@ -11,13 +11,13 @@ class Markup(text_type): def __html__(self) -> Markup: ... def __add__(self, other: text_type) -> Markup: ... def __radd__(self, other: text_type) -> Markup: ... - def __mul__(self, num: int) -> Markup: ... # type: ignore - def __rmul__(self, num: int) -> Markup: ... # type: ignore + def __mul__(self, num: int) -> Markup: ... # type: ignore[override] + def __rmul__(self, num: int) -> Markup: ... # type: ignore[override] def __mod__(self, *args: Any) -> Markup: ... def join(self, seq: Iterable[text_type]) -> Markup: ... - def split(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore - def rsplit(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore - def splitlines(self, keepends: bool = ...) -> list[Markup]: ... # type: ignore + def split(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore[override] + def rsplit(self, sep: text_type | None = ..., maxsplit: SupportsIndex = ...) -> list[Markup]: ... # type: ignore[override] + def splitlines(self, keepends: bool = ...) -> list[Markup]: ... # type: ignore[override] def unescape(self) -> Text: ... def striptags(self) -> Text: ... @classmethod diff --git a/stubs/Pillow/PIL/ImageQt.pyi b/stubs/Pillow/PIL/ImageQt.pyi index 8b213852f..b223bba14 100644 --- a/stubs/Pillow/PIL/ImageQt.pyi +++ b/stubs/Pillow/PIL/ImageQt.pyi @@ -15,7 +15,7 @@ def fromqimage(im: Image | QImage) -> Image: ... def fromqpixmap(im: Image | QImage) -> Image: ... def align8to32(bytes: bytes, width: int, mode: Literal["1", "L", "P"]) -> bytes: ... -class ImageQt(QImage): # type: ignore +class ImageQt(QImage): def __init__(self, im: Image) -> None: ... def toqimage(im: Image) -> ImageQt: ... diff --git a/stubs/PyMySQL/pymysql/cursors.pyi b/stubs/PyMySQL/pymysql/cursors.pyi index b2d1ffb74..459421961 100644 --- a/stubs/PyMySQL/pymysql/cursors.pyi +++ b/stubs/PyMySQL/pymysql/cursors.pyi @@ -40,11 +40,11 @@ class DictCursorMixin: def __iter__(self) -> Iterator[dict[Text, Any]]: ... class SSCursor(Cursor): - def fetchall(self) -> list[Tuple[Any, ...]]: ... # type: ignore + def fetchall(self) -> list[Tuple[Any, ...]]: ... # type: ignore[override] def fetchall_unbuffered(self) -> Iterator[Tuple[Any, ...]]: ... def scroll(self, value: int, mode: Text = ...) -> None: ... -class DictCursor(DictCursorMixin, Cursor): ... # type: ignore +class DictCursor(DictCursorMixin, Cursor): ... # type: ignore[misc] -class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore - def fetchall_unbuffered(self) -> Iterator[dict[Text, Any]]: ... # type: ignore +class SSDictCursor(DictCursorMixin, SSCursor): # type: ignore[misc] + def fetchall_unbuffered(self) -> Iterator[dict[Text, Any]]: ... # type: ignore[override] diff --git a/stubs/Pygments/pygments/lexer.pyi b/stubs/Pygments/pygments/lexer.pyi index 979d822b9..6ede8438b 100644 --- a/stubs/Pygments/pygments/lexer.pyi +++ b/stubs/Pygments/pygments/lexer.pyi @@ -89,7 +89,9 @@ class LexerContext: def __init__(self, text, pos, stack: Any | None = ..., end: Any | None = ...) -> None: ... class ExtendedRegexLexer(RegexLexer): - def get_tokens_unprocessed(self, text: str | None = ..., context: LexerContext | None = ...) -> Iterator[tuple[int, _TokenType, str]]: ... # type: ignore + def get_tokens_unprocessed( # type: ignore[override] + self, text: str | None = ..., context: LexerContext | None = ... + ) -> Iterator[tuple[int, _TokenType, str]]: ... class ProfilingRegexLexerMeta(RegexLexerMeta): ... diff --git a/stubs/Pygments/pygments/token.pyi b/stubs/Pygments/pygments/token.pyi index b428132f5..74a918f52 100644 --- a/stubs/Pygments/pygments/token.pyi +++ b/stubs/Pygments/pygments/token.pyi @@ -6,7 +6,7 @@ class _TokenType(Tuple[str]): # TODO: change to lower-case tuple once new mypy def split(self) -> list[_TokenType]: ... subtypes: set[_TokenType] def __init__(self, *args: str) -> None: ... - def __contains__(self, val: _TokenType) -> bool: ... # type: ignore + def __contains__(self, val: _TokenType) -> bool: ... # type: ignore[override] def __getattr__(self, name: str) -> _TokenType: ... def __copy__(self): ... def __deepcopy__(self, memo): ... diff --git a/stubs/Werkzeug/werkzeug/datastructures.pyi b/stubs/Werkzeug/werkzeug/datastructures.pyi index e727cefed..db05da6eb 100644 --- a/stubs/Werkzeug/werkzeug/datastructures.pyi +++ b/stubs/Werkzeug/werkzeug/datastructures.pyi @@ -49,7 +49,7 @@ class ImmutableListMixin(Generic[_V]): def reverse(self) -> NoReturn: ... def sort(self, cmp: Any | None = ..., key: Any | None = ..., reverse: Any | None = ...) -> NoReturn: ... -class ImmutableList(ImmutableListMixin[_V], List[_V]): ... # type: ignore +class ImmutableList(ImmutableListMixin[_V], List[_V]): ... # type: ignore[misc] class ImmutableDictMixin(object): @classmethod @@ -92,7 +92,7 @@ class TypeConversionDict(Dict[_K, _V]): @overload def get(self, key: _K, default: _D, type: Callable[[_V], _R]) -> _R | _D: ... -class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]): # type: ignore +class ImmutableTypeConversionDict(ImmutableDictMixin, TypeConversionDict[_K, _V]): # type: ignore[misc] def copy(self) -> TypeConversionDict[_K, _V]: ... def __copy__(self) -> ImmutableTypeConversionDict[_K, _V]: ... @@ -242,7 +242,7 @@ class EnvironHeaders(ImmutableHeadersMixin, Headers): def __iter__(self): ... def copy(self): ... -class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore +class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore[misc] def __reduce_ex__(self, protocol): ... dicts: Any def __init__(self, dicts: Any | None = ...): ... @@ -266,15 +266,15 @@ class CombinedMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ig class FileMultiDict(MultiDict[_K, _V]): def add_file(self, name, file, filename: Any | None = ..., content_type: Any | None = ...): ... -class ImmutableDict(ImmutableDictMixin, Dict[_K, _V]): # type: ignore +class ImmutableDict(ImmutableDictMixin, Dict[_K, _V]): # type: ignore[misc] def copy(self): ... def __copy__(self): ... -class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore +class ImmutableMultiDict(ImmutableMultiDictMixin, MultiDict[_K, _V]): # type: ignore[misc] def copy(self): ... def __copy__(self): ... -class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V]): # type: ignore +class ImmutableOrderedMultiDict(ImmutableMultiDictMixin, OrderedMultiDict[_K, _V]): # type: ignore[misc] def copy(self): ... def __copy__(self): ... @@ -288,8 +288,8 @@ class Accept(ImmutableList[Tuple[str, float]]): @overload def __getitem__(self, key: str) -> float: ... def quality(self, key: str) -> float: ... - def __contains__(self, value: str) -> bool: ... # type: ignore - def index(self, key: str | tuple[str, float]) -> int: ... # type: ignore + def __contains__(self, value: str) -> bool: ... # type: ignore[override] + def index(self, key: str | tuple[str, float]) -> int: ... # type: ignore[override] def find(self, key: str | tuple[str, float]) -> int: ... def values(self) -> Iterator[str]: ... def to_header(self) -> str: ... @@ -323,7 +323,7 @@ class _CacheControl(UpdateDictMixin, Dict[str, Any]): def __init__(self, values=..., on_update: Any | None = ...): ... def to_header(self): ... -class RequestCacheControl(ImmutableDictMixin, _CacheControl): # type: ignore +class RequestCacheControl(ImmutableDictMixin, _CacheControl): # type: ignore[misc] max_stale: Any min_fresh: Any no_transform: Any @@ -403,7 +403,7 @@ class ContentRange: def __nonzero__(self): ... __bool__: Any -class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore +class Authorization(ImmutableDictMixin, Dict[str, Any]): # type: ignore[misc] type: str def __init__(self, auth_type: str, data: Mapping[str, Any] | None = ...) -> None: ... @property diff --git a/stubs/fpdf2/fpdf/template.pyi b/stubs/fpdf2/fpdf/template.pyi index 7badad257..8ab4d6cb9 100644 --- a/stubs/fpdf2/fpdf/template.pyi +++ b/stubs/fpdf2/fpdf/template.pyi @@ -32,4 +32,4 @@ class Template(FlexTemplate): keywords: str = ..., ) -> None: ... def add_page(self) -> None: ... - def render(self, outfile: Any | None = ..., dest: Any | None = ...) -> None: ... # type: ignore + def render(self, outfile: Any | None = ..., dest: Any | None = ...) -> None: ... # type: ignore[override] diff --git a/stubs/httplib2/httplib2/__init__.pyi b/stubs/httplib2/httplib2/__init__.pyi index 7813440b4..14bf1dba7 100644 --- a/stubs/httplib2/httplib2/__init__.pyi +++ b/stubs/httplib2/httplib2/__init__.pyi @@ -79,8 +79,8 @@ class Credentials: def iter(self, domain) -> Generator[tuple[str, str], None, None]: ... class KeyCerts(Credentials): - def add(self, key, cert, domain, password) -> None: ... # type: ignore - def iter(self, domain) -> Generator[tuple[str, str, str], None, None]: ... # type: ignore + def add(self, key, cert, domain, password) -> None: ... # type: ignore[override] + def iter(self, domain) -> Generator[tuple[str, str, str], None, None]: ... # type: ignore[override] class AllHosts: ... diff --git a/stubs/humanfriendly/humanfriendly/case.pyi b/stubs/humanfriendly/humanfriendly/case.pyi index b3e276725..2dc151869 100644 --- a/stubs/humanfriendly/humanfriendly/case.pyi +++ b/stubs/humanfriendly/humanfriendly/case.pyi @@ -11,7 +11,7 @@ class CaseInsensitiveDict(collections.OrderedDict): def get(self, key, default: Any | None = ...): ... def pop(self, key, default: Any | None = ...): ... def setdefault(self, key, default: Any | None = ...): ... - def update(self, other: Any | None = ..., **kw) -> None: ... # type: ignore + def update(self, other: Any | None = ..., **kw) -> None: ... # type: ignore[override] def __contains__(self, key): ... def __delitem__(self, key): ... def __getitem__(self, key): ... diff --git a/stubs/itsdangerous/itsdangerous.pyi b/stubs/itsdangerous/itsdangerous.pyi index 463d81880..362cd61e7 100644 --- a/stubs/itsdangerous/itsdangerous.pyi +++ b/stubs/itsdangerous/itsdangerous.pyi @@ -135,7 +135,7 @@ class JSONWebSignatureSerializer(Serializer): def load_payload( self, payload: Text | bytes, serializer: _serializer | None = ..., return_header: bool = ... ) -> Any: ... # morally -> Any | Tuple[Any, MutableMapping[str, Any]] - def dump_payload(self, header: Mapping[str, Any], obj: Any) -> bytes: ... # type: ignore + def dump_payload(self, header: Mapping[str, Any], obj: Any) -> bytes: ... # type: ignore[override] def make_algorithm(self, algorithm_name: Text) -> SigningAlgorithm: ... def make_signer(self, salt: Text | bytes | None = ..., algorithm: SigningAlgorithm = ...) -> Signer: ... def make_header(self, header_fields: Mapping[str, Any] | None) -> MutableMapping[str, Any]: ... diff --git a/stubs/mock/mock/mock.pyi b/stubs/mock/mock/mock.pyi index 47d07301b..2b29be034 100644 --- a/stubs/mock/mock/mock.pyi +++ b/stubs/mock/mock/mock.pyi @@ -72,7 +72,7 @@ class _MockIter: class Base: def __init__(self, *args: Any, **kwargs: Any) -> None: ... -class NonCallableMock(Base, Any): # type: ignore +class NonCallableMock(Base, Any): def __new__(__cls, *args: Any, **kw: Any) -> NonCallableMock: ... def __init__( self, @@ -207,7 +207,7 @@ class _patcher: TEST_PREFIX: str dict: Type[_patch_dict] @overload - def __call__( # type: ignore + def __call__( # type: ignore[misc] self, target: Any, *, @@ -234,7 +234,7 @@ class _patcher: **kwargs: Any, ) -> _patch[_T]: ... @overload - def object( # type: ignore + def object( # type: ignore[misc] self, target: Any, attribute: str, diff --git a/stubs/paramiko/paramiko/hostkeys.pyi b/stubs/paramiko/paramiko/hostkeys.pyi index c099ac7fd..e1a109e2d 100644 --- a/stubs/paramiko/paramiko/hostkeys.pyi +++ b/stubs/paramiko/paramiko/hostkeys.pyi @@ -10,7 +10,7 @@ class _SubDict(MutableMapping[str, PKey]): def __delitem__(self, key: str) -> None: ... def __getitem__(self, key: str) -> PKey: ... def __setitem__(self, key: str, val: PKey) -> None: ... - def keys(self) -> list[str]: ... # type: ignore + def keys(self) -> list[str]: ... # type: ignore[override] class HostKeys(MutableMapping[str, _SubDict]): def __init__(self, filename: str | None = ...) -> None: ... @@ -25,8 +25,8 @@ class HostKeys(MutableMapping[str, _SubDict]): def __getitem__(self, key: str) -> _SubDict: ... def __delitem__(self, key: str) -> None: ... def __setitem__(self, hostname: str, entry: Mapping[str, PKey]) -> None: ... - def keys(self) -> list[str]: ... # type: ignore - def values(self) -> list[_SubDict]: ... # type: ignore + def keys(self) -> list[str]: ... # type: ignore[override] + def values(self) -> list[_SubDict]: ... # type: ignore[override] @staticmethod def hash_host(hostname: str, salt: str | None = ...) -> str: ... diff --git a/stubs/python-nmap/nmap/nmap.pyi b/stubs/python-nmap/nmap/nmap.pyi index 2976bac58..a07d4b5e1 100644 --- a/stubs/python-nmap/nmap/nmap.pyi +++ b/stubs/python-nmap/nmap/nmap.pyi @@ -94,12 +94,12 @@ class PortScannerAsync(object): class PortScannerYield(PortScannerAsync): def __init__(self) -> None: ... - def scan( # type: ignore + def scan( # type: ignore[override] self, hosts: str = ..., ports: str | None = ..., arguments: str = ..., sudo: bool = ..., timeout: int = ... ) -> Iterator[tuple[str, _Result]]: ... def stop(self) -> None: ... def wait(self, timeout: int | None = ...) -> None: ... - def still_scanning(self) -> None: ... # type: ignore + def still_scanning(self) -> None: ... # type: ignore[override] class PortScannerHostDict(Dict[str, Any]): def hostnames(self) -> list[_ResultHostNames]: ... diff --git a/stubs/redis/redis/commands/json/__init__.pyi b/stubs/redis/redis/commands/json/__init__.pyi index 71db9fb68..e67c7bfef 100644 --- a/stubs/redis/redis/commands/json/__init__.pyi +++ b/stubs/redis/redis/commands/json/__init__.pyi @@ -11,4 +11,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 +class Pipeline(JSONCommands, ClientPipeline): ... # type: ignore[misc] diff --git a/stubs/redis/redis/commands/timeseries/__init__.pyi b/stubs/redis/redis/commands/timeseries/__init__.pyi index 588fc2a5f..fae4f849b 100644 --- a/stubs/redis/redis/commands/timeseries/__init__.pyi +++ b/stubs/redis/redis/commands/timeseries/__init__.pyi @@ -10,4 +10,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 +class Pipeline(TimeSeriesCommands, ClientPipeline): ... # type: ignore[misc] diff --git a/stubs/redis/redis/utils.pyi b/stubs/redis/redis/utils.pyi index 337350b51..9df7a80e3 100644 --- a/stubs/redis/redis/utils.pyi +++ b/stubs/redis/redis/utils.pyi @@ -14,7 +14,7 @@ def from_url(url: str, *, db: int = ..., decode_responses: Literal[True], **kwar def from_url(url: str, *, db: int = ..., decode_responses: Literal[False] = ..., **kwargs: Any) -> Redis[bytes]: ... def pipeline(redis_obj: Redis[_StrType]) -> AbstractContextManager[Pipeline[_StrType]]: ... @overload -def str_if_bytes(value: bytes) -> str: ... # type: ignore +def str_if_bytes(value: bytes) -> str: ... # type: ignore[misc] @overload def str_if_bytes(value: _T) -> _T: ... def safe_str(value: object) -> str: ... diff --git a/stubs/requests/requests/structures.pyi b/stubs/requests/requests/structures.pyi index 9254113be..ed7d9a2f2 100644 --- a/stubs/requests/requests/structures.pyi +++ b/stubs/requests/requests/structures.pyi @@ -15,6 +15,6 @@ class CaseInsensitiveDict(MutableMapping[str, _VT], Generic[_VT]): class LookupDict(Dict[str, _VT]): name: Any def __init__(self, name: Any = ...) -> None: ... - def __getitem__(self, key: str) -> _VT | None: ... # type: ignore + def __getitem__(self, key: str) -> _VT | None: ... # type: ignore[override] def __getattr__(self, attr: str) -> _VT: ... def __setattr__(self, attr: str, value: _VT) -> None: ... diff --git a/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi b/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi index ba8b83460..1647f90f1 100644 --- a/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi +++ b/stubs/selenium/selenium/webdriver/common/actions/pointer_input.pyi @@ -13,5 +13,5 @@ class PointerInput(InputDevice): def create_pointer_down(self, button) -> None: ... def create_pointer_up(self, button) -> None: ... def create_pointer_cancel(self) -> None: ... - def create_pause(self, pause_duration) -> None: ... # type: ignore + def create_pause(self, pause_duration) -> None: ... # type: ignore[override] def encode(self): ... diff --git a/stubs/setuptools/setuptools/command/develop.pyi b/stubs/setuptools/setuptools/command/develop.pyi index 8bd432be5..8b099dc80 100644 --- a/stubs/setuptools/setuptools/command/develop.pyi +++ b/stubs/setuptools/setuptools/command/develop.pyi @@ -9,7 +9,7 @@ class develop(namespaces.DevelopInstaller, easy_install): boolean_options: Any command_consumes_arguments: bool multi_version: bool - def run(self) -> None: ... # type: ignore + def run(self) -> None: ... # type: ignore[override] uninstall: Any egg_path: Any setup_path: Any diff --git a/stubs/setuptools/setuptools/command/test.pyi b/stubs/setuptools/setuptools/command/test.pyi index c18892669..8d0309ab0 100644 --- a/stubs/setuptools/setuptools/command/test.pyi +++ b/stubs/setuptools/setuptools/command/test.pyi @@ -9,7 +9,7 @@ _T = TypeVar("_T") class ScanningLoader(TestLoader): def __init__(self) -> None: ... - def loadTestsFromModule(self, module: ModuleType, pattern: Any | None = ...) -> list[TestSuite]: ... # type: ignore + def loadTestsFromModule(self, module: ModuleType, pattern: Any | None = ...) -> list[TestSuite]: ... # type: ignore[override] class NonDataProperty(Generic[_T]): fget: Callable[..., _T] diff --git a/stubs/setuptools/setuptools/command/upload_docs.pyi b/stubs/setuptools/setuptools/command/upload_docs.pyi index 21ef5416d..0660bff72 100644 --- a/stubs/setuptools/setuptools/command/upload_docs.pyi +++ b/stubs/setuptools/setuptools/command/upload_docs.pyi @@ -15,4 +15,4 @@ class upload_docs(upload): def finalize_options(self) -> None: ... def create_zipfile(self, filename) -> None: ... def run(self) -> None: ... - def upload_file(self, filename) -> None: ... # type: ignore + def upload_file(self, filename) -> None: ... # type: ignore[override] diff --git a/stubs/setuptools/setuptools/lib2to3_ex.pyi b/stubs/setuptools/setuptools/lib2to3_ex.pyi index a7cc306bc..d8194ae03 100644 --- a/stubs/setuptools/setuptools/lib2to3_ex.pyi +++ b/stubs/setuptools/setuptools/lib2to3_ex.pyi @@ -2,7 +2,7 @@ from distutils.util import Mixin2to3 as _Mixin2to3 from lib2to3.refactor import RefactoringTool class DistutilsRefactoringTool(RefactoringTool): - def log_error(self, msg, *args, **kw) -> None: ... # type: ignore + def log_error(self, msg, *args, **kw) -> None: ... # type: ignore[override] def log_message(self, msg, *args) -> None: ... def log_debug(self, msg, *args) -> None: ... diff --git a/stubs/ttkthemes/ttkthemes/themed_style.pyi b/stubs/ttkthemes/ttkthemes/themed_style.pyi index 9566fb3f3..e70eb8a48 100644 --- a/stubs/ttkthemes/ttkthemes/themed_style.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_style.pyi @@ -8,5 +8,5 @@ class ThemedStyle(ttk.Style, ThemedWidget): self, master: tkinter.Misc | None = ..., *, theme: str | None = ..., gif_override: bool | None = ..., **kwargs ) -> None: ... # theme_use() can't return None (differs from ttk.Style) - def theme_use(self, theme_name: str | None = ...) -> str: ... # type: ignore - def theme_names(self) -> list[str]: ... # type: ignore + def theme_use(self, theme_name: str | None = ...) -> str: ... # type: ignore[override] + def theme_names(self) -> list[str]: ... # type: ignore[override] diff --git a/stubs/ttkthemes/ttkthemes/themed_tk.pyi b/stubs/ttkthemes/ttkthemes/themed_tk.pyi index 3a2c9d748..1cf27bf3a 100644 --- a/stubs/ttkthemes/ttkthemes/themed_tk.pyi +++ b/stubs/ttkthemes/ttkthemes/themed_tk.pyi @@ -23,8 +23,8 @@ class ThemedTk(tkinter.Tk, ThemedWidget): ) -> None: ... def set_theme(self, theme_name, toplevel: bool | None = ..., themebg: bool | None = ...) -> None: ... # TODO: currently no good way to say "use the same big list of kwargs as parent class but also add these" - def config(self, kw: Any | None = ..., **kwargs): ... # type: ignore + def config(self, kw: Any | None = ..., **kwargs): ... # type: ignore[override] def cget(self, k): ... - def configure(self, kw: Any | None = ..., **kwargs): ... # type: ignore + def configure(self, kw: Any | None = ..., **kwargs): ... # type: ignore[override] def __getitem__(self, k): ... def __setitem__(self, k, v): ... diff --git a/stubs/vobject/vobject/icalendar.pyi b/stubs/vobject/vobject/icalendar.pyi index 72f9ae5f2..bbd568502 100644 --- a/stubs/vobject/vobject/icalendar.pyi +++ b/stubs/vobject/vobject/icalendar.pyi @@ -36,7 +36,7 @@ class TimezoneComponent(Component): normal_attributes: Any @staticmethod def pickTzid(tzinfo, allowUTC: bool = ...): ... - def prettyPrint(self, level, tabwidth) -> None: ... # type: ignore + def prettyPrint(self, level, tabwidth) -> None: ... # type: ignore[override] class RecurringComponent(Component): isNative: bool diff --git a/stubs/vobject/vobject/vcard.pyi b/stubs/vobject/vobject/vcard.pyi index 08d6836b9..8dfd0bec3 100644 --- a/stubs/vobject/vobject/vcard.pyi +++ b/stubs/vobject/vobject/vcard.pyi @@ -78,7 +78,7 @@ class Photo(VCardTextBehavior): @classmethod def valueRepr(cls, line): ... @classmethod - def serialize(cls, obj, buf, lineLength, validate) -> None: ... # type: ignore + def serialize(cls, obj, buf, lineLength, validate) -> None: ... # type: ignore[override] def toListOrString(string): ... def splitFields(string): ... diff --git a/stubs/waitress/waitress/wasyncore.pyi b/stubs/waitress/waitress/wasyncore.pyi index 28563abd0..b7bb0b5d8 100644 --- a/stubs/waitress/waitress/wasyncore.pyi +++ b/stubs/waitress/waitress/wasyncore.pyi @@ -71,7 +71,7 @@ class dispatcher_with_send(dispatcher): def initiate_send(self) -> None: ... handle_write: Callable[[], None] = ... def writable(self) -> bool: ... - def send(self, data: bytes) -> None: ... # type: ignore + def send(self, data: bytes) -> None: ... # type: ignore[override] def close_all(map: Mapping[int, socket] | None = ..., ignore_all: bool = ...) -> None: ...