From 5030b7419b065ff3469a6c1eee483b787cd9bf24 Mon Sep 17 00:00:00 2001 From: Jelle Zijlstra Date: Mon, 6 Nov 2023 09:09:04 -0800 Subject: [PATCH] stdlib: Use pos-only parameters for many Protocols (#10985) --- stdlib/_typeshed/wsgi.pyi | 2 +- stdlib/_typeshed/xml.pyi | 6 +++--- stdlib/argparse.pyi | 2 +- stdlib/compileall.pyi | 2 +- stdlib/email/headerregistry.pyi | 4 ++-- stdlib/imghdr.pyi | 4 ++-- stdlib/imp.pyi | 2 +- stdlib/importlib/abc.pyi | 4 ++-- stdlib/types.pyi | 2 +- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/stdlib/_typeshed/wsgi.pyi b/stdlib/_typeshed/wsgi.pyi index de731aea9..e8ebf6409 100644 --- a/stdlib/_typeshed/wsgi.pyi +++ b/stdlib/_typeshed/wsgi.pyi @@ -11,7 +11,7 @@ from typing import Any, Protocol from typing_extensions import TypeAlias class _Readable(Protocol): - def read(self, size: int = ...) -> bytes: ... + def read(self, __size: int = ...) -> bytes: ... # Optional: def close(self) -> object: ... if sys.version_info >= (3, 11): diff --git a/stdlib/_typeshed/xml.pyi b/stdlib/_typeshed/xml.pyi index 231c2b86e..46c5fab09 100644 --- a/stdlib/_typeshed/xml.pyi +++ b/stdlib/_typeshed/xml.pyi @@ -4,6 +4,6 @@ from typing import Any, Protocol # As defined https://docs.python.org/3/library/xml.dom.html#domimplementation-objects class DOMImplementation(Protocol): - def hasFeature(self, feature: str, version: str | None) -> bool: ... - def createDocument(self, namespaceUri: str, qualifiedName: str, doctype: Any | None) -> Any: ... - def createDocumentType(self, qualifiedName: str, publicId: str, systemId: str) -> Any: ... + def hasFeature(self, __feature: str, __version: str | None) -> bool: ... + def createDocument(self, __namespaceUri: str, __qualifiedName: str, __doctype: Any | None) -> Any: ... + def createDocumentType(self, __qualifiedName: str, __publicId: str, __systemId: str) -> Any: ... diff --git a/stdlib/argparse.pyi b/stdlib/argparse.pyi index 924cc8986..e947f67ed 100644 --- a/stdlib/argparse.pyi +++ b/stdlib/argparse.pyi @@ -120,7 +120,7 @@ class _ActionsContainer: def _handle_conflict_resolve(self, action: Action, conflicting_actions: Iterable[tuple[str, Action]]) -> None: ... class _FormatterClass(Protocol): - def __call__(self, prog: str) -> HelpFormatter: ... + def __call__(self, *, prog: str) -> HelpFormatter: ... class ArgumentParser(_AttributeHolder, _ActionsContainer): prog: str diff --git a/stdlib/compileall.pyi b/stdlib/compileall.pyi index 7520c2f5b..7f101bf79 100644 --- a/stdlib/compileall.pyi +++ b/stdlib/compileall.pyi @@ -6,7 +6,7 @@ from typing import Any, Protocol __all__ = ["compile_dir", "compile_file", "compile_path"] class _SupportsSearch(Protocol): - def search(self, string: str) -> Any: ... + def search(self, __string: str) -> Any: ... if sys.version_info >= (3, 10): def compile_dir( diff --git a/stdlib/email/headerregistry.pyi b/stdlib/email/headerregistry.pyi index e158e8981..94623e96f 100644 --- a/stdlib/email/headerregistry.pyi +++ b/stdlib/email/headerregistry.pyi @@ -143,9 +143,9 @@ if sys.version_info >= (3, 8): class _HeaderParser(Protocol): max_count: ClassVar[Literal[1] | None] @staticmethod - def value_parser(value: str) -> TokenList: ... + def value_parser(__value: str) -> TokenList: ... @classmethod - def parse(cls, value: str, kwds: dict[str, Any]) -> None: ... + def parse(cls, __value: str, __kwds: dict[str, Any]) -> None: ... class HeaderRegistry: registry: dict[str, type[_HeaderParser]] diff --git a/stdlib/imghdr.pyi b/stdlib/imghdr.pyi index ed3647f20..d0960a5a1 100644 --- a/stdlib/imghdr.pyi +++ b/stdlib/imghdr.pyi @@ -6,8 +6,8 @@ __all__ = ["what"] class _ReadableBinary(Protocol): def tell(self) -> int: ... - def read(self, size: int) -> bytes: ... - def seek(self, offset: int) -> Any: ... + def read(self, __size: int) -> bytes: ... + def seek(self, __offset: int) -> Any: ... @overload def what(file: StrPath | _ReadableBinary, h: None = None) -> str | None: ... diff --git a/stdlib/imp.pyi b/stdlib/imp.pyi index 3f2920de9..b532f480f 100644 --- a/stdlib/imp.pyi +++ b/stdlib/imp.pyi @@ -45,7 +45,7 @@ class _FileLike(Protocol): def read(self) -> str | bytes: ... def close(self) -> Any: ... def __enter__(self) -> Any: ... - def __exit__(self, typ: type[BaseException] | None, exc: BaseException | None, tb: TracebackType | None) -> Any: ... + def __exit__(self, __typ: type[BaseException] | None, __exc: BaseException | None, __tb: TracebackType | None) -> Any: ... # PathLike doesn't work for the pathname argument here def load_source(name: str, pathname: str, file: _FileLike | None = None) -> types.ModuleType: ... diff --git a/stdlib/importlib/abc.pyi b/stdlib/importlib/abc.pyi index 438dbafb4..5a6a5caa0 100644 --- a/stdlib/importlib/abc.pyi +++ b/stdlib/importlib/abc.pyi @@ -138,10 +138,10 @@ if sys.version_info >= (3, 9): # which is not the case. @overload @abstractmethod - def open(self, mode: Literal["r", "w"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: ... + def open(self, __mode: Literal["r", "w"] = "r", *, encoding: str | None = None, errors: str | None = None) -> IO[str]: ... @overload @abstractmethod - def open(self, mode: Literal["rb", "wb"]) -> IO[bytes]: ... + def open(self, __mode: Literal["rb", "wb"]) -> IO[bytes]: ... @property @abstractmethod def name(self) -> str: ... diff --git a/stdlib/types.pyi b/stdlib/types.pyi index a50bbf145..fcaf5264c 100644 --- a/stdlib/types.pyi +++ b/stdlib/types.pyi @@ -335,7 +335,7 @@ class SimpleNamespace: def __delattr__(self, __name: str) -> None: ... class _LoaderProtocol(Protocol): - def load_module(self, fullname: str) -> ModuleType: ... + def load_module(self, __fullname: str) -> ModuleType: ... class ModuleType: __name__: str