From 8e7b78a8e87e56f48945ec0f18294fc342fd3af8 Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 1 Feb 2023 14:06:04 +0000 Subject: [PATCH] Bump black to 23.1.0 (#9647) --- .pre-commit-config.yaml | 2 +- requirements-tests.txt | 2 +- stdlib/_msi.pyi | 4 +++- stdlib/asyncio/base_subprocess.pyi | 1 - stdlib/asyncio/proactor_events.pyi | 1 - stdlib/asyncio/sslproto.pyi | 2 -- stdlib/asyncio/unix_events.pyi | 1 - stdlib/asyncore.pyi | 1 - stdlib/bdb.pyi | 1 - stdlib/functools.pyi | 2 +- stdlib/mailbox.pyi | 1 - stdlib/modulefinder.pyi | 1 - stdlib/msilib/__init__.pyi | 8 -------- stdlib/msilib/sequence.pyi | 1 - stdlib/msilib/text.pyi | 1 - stdlib/xmlrpc/client.pyi | 13 ------------- stdlib/xmlrpc/server.pyi | 4 ---- stubs/Pillow/PIL/Image.pyi | 2 +- stubs/PyScreeze/pyscreeze/__init__.pyi | 1 + stubs/colorama/colorama/winterm.pyi | 1 - stubs/gdb/gdb/__init__.pyi | 7 ------- stubs/gdb/gdb/printing.pyi | 2 -- stubs/pycurl/pycurl.pyi | 6 +++--- test_cases/stdlib/asyncio/check_coroutines.py | 1 - 24 files changed, 11 insertions(+), 55 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c8eec4588..025321440 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,7 +16,7 @@ repos: - id: pycln args: [--config=pyproject.toml, stubs, stdlib, tests, scripts] - repo: https://github.com/psf/black - rev: 22.12.0 # must match requirements-tests.txt + rev: 23.1.0 # must match requirements-tests.txt hooks: - id: black language_version: python3.10 diff --git a/requirements-tests.txt b/requirements-tests.txt index fca2e513e..02eaa2372 100644 --- a/requirements-tests.txt +++ b/requirements-tests.txt @@ -1,5 +1,5 @@ aiohttp==3.8.3 -black==22.12.0 # must match .pre-commit-config.yaml +black==23.1.0 # must match .pre-commit-config.yaml flake8==6.0.0; python_version >= "3.8" # must match .pre-commit-config.yaml flake8-bugbear==23.1.14; python_version >= "3.8" # must match .pre-commit-config.yaml flake8-noqa==1.3.0; python_version >= "3.8" # must match .pre-commit-config.yaml diff --git a/stdlib/_msi.pyi b/stdlib/_msi.pyi index 1b86904d5..2fdbdfd0e 100644 --- a/stdlib/_msi.pyi +++ b/stdlib/_msi.pyi @@ -1,7 +1,6 @@ import sys if sys.platform == "win32": - # Actual typename View, not exposed by the implementation class _View: def Execute(self, params: _Record | None = ...) -> None: ... @@ -12,6 +11,7 @@ if sys.platform == "win32": # Don't exist at runtime __new__: None # type: ignore[assignment] __init__: None # type: ignore[assignment] + # Actual typename SummaryInformation, not exposed by the implementation class _SummaryInformation: def GetProperty(self, field: int) -> int | bytes | None: ... @@ -21,6 +21,7 @@ if sys.platform == "win32": # Don't exist at runtime __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: ... @@ -30,6 +31,7 @@ if sys.platform == "win32": # Don't exist at runtime __new__: None # type: ignore[assignment] __init__: None # type: ignore[assignment] + # Actual typename Record, not exposed by the implementation class _Record: def GetFieldCount(self) -> int: ... diff --git a/stdlib/asyncio/base_subprocess.pyi b/stdlib/asyncio/base_subprocess.pyi index 9dea83762..597c83029 100644 --- a/stdlib/asyncio/base_subprocess.pyi +++ b/stdlib/asyncio/base_subprocess.pyi @@ -9,7 +9,6 @@ from . import events, futures, protocols, transports _File: TypeAlias = int | IO[Any] | None class BaseSubprocessTransport(transports.SubprocessTransport): - _closed: bool # undocumented _protocol: protocols.SubprocessProtocol # undocumented _loop: events.AbstractEventLoop # undocumented diff --git a/stdlib/asyncio/proactor_events.pyi b/stdlib/asyncio/proactor_events.pyi index 9d582684a..33fdf84ad 100644 --- a/stdlib/asyncio/proactor_events.pyi +++ b/stdlib/asyncio/proactor_events.pyi @@ -57,7 +57,6 @@ class _ProactorWritePipeTransport(_ProactorBaseWritePipeTransport): ... class _ProactorDuplexPipeTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): ... class _ProactorSocketTransport(_ProactorReadPipeTransport, _ProactorBaseWritePipeTransport, transports.Transport): - _sendfile_compatible: ClassVar[constants._SendfileMode] def __init__( self, diff --git a/stdlib/asyncio/sslproto.pyi b/stdlib/asyncio/sslproto.pyi index b6cf4918b..aadc7d32b 100644 --- a/stdlib/asyncio/sslproto.pyi +++ b/stdlib/asyncio/sslproto.pyi @@ -35,7 +35,6 @@ else: if sys.version_info < (3, 11): class _SSLPipe: - max_size: ClassVar[int] _context: ssl.SSLContext @@ -64,7 +63,6 @@ if sys.version_info < (3, 11): def feed_appdata(self, data: bytes, offset: int = 0) -> tuple[list[bytes], int]: ... class _SSLProtocolTransport(transports._FlowControlMixin, transports.Transport): - _sendfile_compatible: ClassVar[constants._SendfileMode] _loop: events.AbstractEventLoop diff --git a/stdlib/asyncio/unix_events.pyi b/stdlib/asyncio/unix_events.pyi index 19dd3ca43..5e2b05f57 100644 --- a/stdlib/asyncio/unix_events.pyi +++ b/stdlib/asyncio/unix_events.pyi @@ -85,7 +85,6 @@ if sys.platform != "win32": DefaultEventLoopPolicy = _UnixDefaultEventLoopPolicy if sys.version_info >= (3, 8): - from typing import Protocol class _Warn(Protocol): diff --git a/stdlib/asyncore.pyi b/stdlib/asyncore.pyi index b287eb28e..f80549997 100644 --- a/stdlib/asyncore.pyi +++ b/stdlib/asyncore.pyi @@ -25,7 +25,6 @@ def loop(timeout: float = 30.0, use_poll: bool = False, map: _MapType | None = N # Not really subclass of socket.socket; it's only delegation. # It is not covariant to it. class dispatcher: - debug: bool connected: bool accepting: bool diff --git a/stdlib/bdb.pyi b/stdlib/bdb.pyi index d07c6a352..2a1fdddff 100644 --- a/stdlib/bdb.pyi +++ b/stdlib/bdb.pyi @@ -70,7 +70,6 @@ class Bdb: def runcall(self, __func: Callable[_P, _T], *args: _P.args, **kwds: _P.kwargs) -> _T | None: ... class Breakpoint: - next: int bplist: dict[tuple[str, int], list[Breakpoint]] bpbynumber: list[Breakpoint | None] diff --git a/stdlib/functools.pyi b/stdlib/functools.pyi index b0ed37ff8..877879814 100644 --- a/stdlib/functools.pyi +++ b/stdlib/functools.pyi @@ -63,7 +63,7 @@ else: def lru_cache(maxsize: int | None = 128, typed: bool = False) -> Callable[[Callable[..., _T]], _lru_cache_wrapper[_T]]: ... WRAPPER_ASSIGNMENTS: tuple[ - Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"], + Literal["__module__"], Literal["__name__"], Literal["__qualname__"], Literal["__doc__"], Literal["__annotations__"] ] WRAPPER_UPDATES: tuple[Literal["__dict__"]] diff --git a/stdlib/mailbox.pyi b/stdlib/mailbox.pyi index 7d667dd09..2fe9060e7 100644 --- a/stdlib/mailbox.pyi +++ b/stdlib/mailbox.pyi @@ -105,7 +105,6 @@ class Mailbox(Generic[_MessageT]): def __class_getitem__(cls, item: Any) -> GenericAlias: ... class Maildir(Mailbox[MaildirMessage]): - colon: str def __init__( self, dirname: StrPath, factory: Callable[[IO[Any]], MaildirMessage] | None = None, create: bool = True diff --git a/stdlib/modulefinder.pyi b/stdlib/modulefinder.pyi index 6e12e5ef8..6f1917644 100644 --- a/stdlib/modulefinder.pyi +++ b/stdlib/modulefinder.pyi @@ -23,7 +23,6 @@ class Module: # undocumented def __init__(self, name: str, file: str | None = None, path: str | None = None) -> None: ... class ModuleFinder: - modules: dict[str, Module] path: list[str] # undocumented badmodules: dict[str, dict[str, int]] # undocumented diff --git a/stdlib/msilib/__init__.pyi b/stdlib/msilib/__init__.pyi index 039fa3582..9f7367d15 100644 --- a/stdlib/msilib/__init__.pyi +++ b/stdlib/msilib/__init__.pyi @@ -24,7 +24,6 @@ if sys.platform == "win32": knownbits: Literal[0x3FFF] class Table: - name: str fields: list[tuple[int, str, int]] def __init__(self, name: str) -> None: ... @@ -50,7 +49,6 @@ if sys.platform == "win32": def gen_uuid() -> str: ... class CAB: - name: str files: list[tuple[str, str]] filenames: set[str] @@ -62,7 +60,6 @@ if sys.platform == "win32": _directories: set[str] class Directory: - db: _Database cab: CAB basedir: str @@ -98,12 +95,10 @@ if sys.platform == "win32": def remove_pyc(self) -> None: ... class Binary: - name: str def __init__(self, fname: str) -> None: ... class Feature: - id: str def __init__( self, @@ -120,7 +115,6 @@ if sys.platform == "win32": def set_current(self) -> None: ... class Control: - dlg: Dialog name: str def __init__(self, dlg: Dialog, name: str) -> None: ... @@ -129,14 +123,12 @@ if sys.platform == "win32": def condition(self, action: str, condition: str) -> None: ... class RadioButtonGroup(Control): - property: str index: int def __init__(self, dlg: Dialog, name: str, property: str) -> None: ... def add(self, name: str, x: int, y: int, w: int, h: int, text: str, value: str | None = None) -> None: ... class Dialog: - db: _Database name: str x: int diff --git a/stdlib/msilib/sequence.pyi b/stdlib/msilib/sequence.pyi index 9cc1e0eae..b8af09f46 100644 --- a/stdlib/msilib/sequence.pyi +++ b/stdlib/msilib/sequence.pyi @@ -2,7 +2,6 @@ import sys from typing_extensions import TypeAlias if sys.platform == "win32": - _SequenceType: TypeAlias = list[tuple[str, str | None, int]] AdminExecuteSequence: _SequenceType diff --git a/stdlib/msilib/text.pyi b/stdlib/msilib/text.pyi index 879429ece..1353cf8a2 100644 --- a/stdlib/msilib/text.pyi +++ b/stdlib/msilib/text.pyi @@ -1,7 +1,6 @@ import sys if sys.platform == "win32": - ActionText: list[tuple[str, str, str | None]] UIText: list[tuple[str, str | None]] diff --git a/stdlib/xmlrpc/client.pyi b/stdlib/xmlrpc/client.pyi index 81fc694a8..21c9d020f 100644 --- a/stdlib/xmlrpc/client.pyi +++ b/stdlib/xmlrpc/client.pyi @@ -55,7 +55,6 @@ INTERNAL_ERROR: int # undocumented class Error(Exception): ... class ProtocolError(Error): - url: str errcode: int errmsg: str @@ -65,7 +64,6 @@ class ProtocolError(Error): class ResponseError(Error): ... class Fault(Error): - faultCode: int faultString: str def __init__(self, faultCode: int, faultString: str, **extra: Any) -> None: ... @@ -77,7 +75,6 @@ def _iso8601_format(value: datetime) -> str: ... # undocumented def _strftime(value: _XMLDate) -> str: ... # undocumented class DateTime: - value: str # undocumented def __init__(self, value: int | str | datetime | time.struct_time | tuple[int, ...] = 0) -> None: ... def __lt__(self, other: _DateTimeComparable) -> bool: ... @@ -94,7 +91,6 @@ def _datetime(data: Any) -> DateTime: ... # undocumented def _datetime_type(data: str) -> datetime: ... # undocumented class Binary: - data: bytes def __init__(self, data: bytes | bytearray | None = None) -> None: ... def decode(self, data: ReadableBuffer) -> None: ... @@ -137,7 +133,6 @@ class Marshaller: def dump_instance(self, value: object, write: _WriteCallback) -> None: ... class Unmarshaller: - dispatch: dict[str, Callable[[Unmarshaller, str], None]] _type: str | None @@ -174,7 +169,6 @@ class Unmarshaller: def end_methodName(self, data: str) -> None: ... class _MultiCallMethod: # undocumented - __call_list: list[tuple[str, tuple[_Marshallable, ...]]] __name: str def __init__(self, call_list: list[tuple[str, _Marshallable]], name: str) -> None: ... @@ -182,13 +176,11 @@ class _MultiCallMethod: # undocumented def __call__(self, *args: _Marshallable) -> None: ... class MultiCallIterator: # undocumented - results: list[list[_Marshallable]] def __init__(self, results: list[list[_Marshallable]]) -> None: ... def __getitem__(self, i: int) -> _Marshallable: ... class MultiCall: - __server: ServerProxy __call_list: list[tuple[str, tuple[_Marshallable, ...]]] def __init__(self, server: ServerProxy) -> None: ... @@ -215,12 +207,10 @@ def gzip_encode(data: ReadableBuffer) -> bytes: ... # undocumented def gzip_decode(data: ReadableBuffer, max_decode: int = ...) -> bytes: ... # undocumented class GzipDecodedResponse(gzip.GzipFile): # undocumented - io: BytesIO def __init__(self, response: SupportsRead[ReadableBuffer]) -> None: ... class _Method: # undocumented - __send: Callable[[str, tuple[_Marshallable, ...]], _Marshallable] __name: str def __init__(self, send: Callable[[str, tuple[_Marshallable, ...]], _Marshallable], name: str) -> None: ... @@ -228,7 +218,6 @@ class _Method: # undocumented def __call__(self, *args: _Marshallable) -> _Marshallable: ... class Transport: - user_agent: str accept_gzip_encoding: bool encode_threshold: int | None @@ -264,7 +253,6 @@ class Transport: def parse_response(self, response: http.client.HTTPResponse) -> tuple[_Marshallable, ...]: ... class SafeTransport(Transport): - if sys.version_info >= (3, 8): def __init__( self, @@ -282,7 +270,6 @@ class SafeTransport(Transport): def make_connection(self, host: _HostType) -> http.client.HTTPSConnection: ... class ServerProxy: - __host: str __handler: str __transport: Transport diff --git a/stdlib/xmlrpc/server.pyi b/stdlib/xmlrpc/server.pyi index 10fa2bd79..800c20551 100644 --- a/stdlib/xmlrpc/server.pyi +++ b/stdlib/xmlrpc/server.pyi @@ -36,7 +36,6 @@ def resolve_dotted_attribute(obj: Any, attr: str, allow_dotted_names: bool = Tru def list_public_methods(obj: Any) -> list[str]: ... # undocumented class SimpleXMLRPCDispatcher: # undocumented - funcs: dict[str, _DispatchProtocol] instance: Any | None allow_none: bool @@ -70,7 +69,6 @@ class SimpleXMLRPCRequestHandler(http.server.BaseHTTPRequestHandler): def report_404(self) -> None: ... class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher): - _send_traceback_handler: bool def __init__( self, @@ -84,7 +82,6 @@ class SimpleXMLRPCServer(socketserver.TCPServer, SimpleXMLRPCDispatcher): ) -> None: ... class MultiPathXMLRPCServer(SimpleXMLRPCServer): # undocumented - dispatchers: dict[str, SimpleXMLRPCDispatcher] def __init__( self, @@ -119,7 +116,6 @@ class ServerHTMLDoc(pydoc.HTMLDoc): # undocumented def docserver(self, server_name: str, package_documentation: str, methods: dict[str, str]) -> str: ... class XMLRPCDocGenerator: # undocumented - server_name: str server_documentation: str server_title: str diff --git a/stubs/Pillow/PIL/Image.pyi b/stubs/Pillow/PIL/Image.pyi index d6f169f84..c5655f0e3 100644 --- a/stubs/Pillow/PIL/Image.pyi +++ b/stubs/Pillow/PIL/Image.pyi @@ -23,7 +23,7 @@ _Size: TypeAlias = tuple[int, int] _Box: TypeAlias = tuple[int, int, int, int] _ConversionMatrix: TypeAlias = Union[ - tuple[float, float, float, float], tuple[float, float, float, float, float, float, float, float, float, float, float, float], + tuple[float, float, float, float], tuple[float, float, float, float, float, float, float, float, float, float, float, float] ] # `str` values are only accepted if mode="RGB" for an `Image` object # `float` values are only accepted for certain modes such as "F" diff --git a/stubs/PyScreeze/pyscreeze/__init__.pyi b/stubs/PyScreeze/pyscreeze/__init__.pyi index 171ee0ba0..c62c94fe6 100644 --- a/stubs/PyScreeze/pyscreeze/__init__.pyi +++ b/stubs/PyScreeze/pyscreeze/__init__.pyi @@ -178,6 +178,7 @@ def pixel(x: int, y: int) -> tuple[int, int, int]: ... def screenshot(imageFilename: StrOrBytesPath | None = None, region: tuple[int, int, int, int] | None = None) -> Image.Image: ... grab = screenshot + # _locateAll_opencv @overload def locateAll( diff --git a/stubs/colorama/colorama/winterm.pyi b/stubs/colorama/colorama/winterm.pyi index 7740ad780..0de2c6d51 100644 --- a/stubs/colorama/colorama/winterm.pyi +++ b/stubs/colorama/colorama/winterm.pyi @@ -1,7 +1,6 @@ import sys if sys.platform == "win32": - from . import win32 class WinColor: diff --git a/stubs/gdb/gdb/__init__.pyi b/stubs/gdb/gdb/__init__.pyi index d96547f80..f343d3aac 100644 --- a/stubs/gdb/gdb/__init__.pyi +++ b/stubs/gdb/gdb/__init__.pyi @@ -58,7 +58,6 @@ _ValueOrNative: TypeAlias = bool | float | str | Value _ValueOrInt: TypeAlias = Value | int class Value: - address: Value is_optimized_out: bool type: Type @@ -120,7 +119,6 @@ class Value: def lookup_type(name: str, block: Block = ...) -> Type: ... class Type: - alignof: int code: int dynamic: bool @@ -144,7 +142,6 @@ class Type: def optimized_out(self) -> Value: ... class Field: - bitpos: int enumval: int name: str | None @@ -204,7 +201,6 @@ pretty_printers: list[_PrettyPrinterLookupFunction] # Filtering Frames class _FrameFilter(Protocol): - name: str enabled: bool priority: int @@ -507,7 +503,6 @@ def lookup_static_symbol(name: str, domain: int = ...) -> Symbol | None: ... def lookup_static_symbols(name: str, domain: int = ...) -> list[Symbol]: ... class Symbol: - type: Type | None symtab: Symtab line: int @@ -551,7 +546,6 @@ SYMBOL_LOC_COMMON_BLOCK: int # Symbol tables class Symtab_and_line: - symtab: Symtab pc: int last: int @@ -560,7 +554,6 @@ class Symtab_and_line: def is_valid(self) -> bool: ... class Symtab: - filename: str objfile: Objfile producer: str diff --git a/stubs/gdb/gdb/printing.pyi b/stubs/gdb/gdb/printing.pyi index 7187d014d..591fdd09a 100644 --- a/stubs/gdb/gdb/printing.pyi +++ b/stubs/gdb/gdb/printing.pyi @@ -4,7 +4,6 @@ import gdb from gdb import _PrettyPrinterLookupFunction class PrettyPrinter: - name: str subprinters: list[SubPrettyPrinter] | None enabled: bool @@ -13,7 +12,6 @@ class PrettyPrinter: def __call__(self, val: gdb.Value) -> gdb._PrettyPrinter | None: ... class SubPrettyPrinter: - name: str enabled: bool diff --git a/stubs/pycurl/pycurl.pyi b/stubs/pycurl/pycurl.pyi index 0953ec728..65fdf8b5c 100644 --- a/stubs/pycurl/pycurl.pyi +++ b/stubs/pycurl/pycurl.pyi @@ -6,9 +6,9 @@ version: str def global_init(option: int) -> None: ... def global_cleanup() -> None: ... -def version_info() -> tuple[ - int, str, int, str, int, str, int, str, tuple[str, ...], Incomplete | None, int, Incomplete | None -]: ... +def version_info() -> ( + tuple[int, str, int, str, int, str, int, str, tuple[str, ...], Incomplete | None, int, Incomplete | None] +): ... class error(Exception): ... diff --git a/test_cases/stdlib/asyncio/check_coroutines.py b/test_cases/stdlib/asyncio/check_coroutines.py index cfee8de0e..160bd8964 100644 --- a/test_cases/stdlib/asyncio/check_coroutines.py +++ b/test_cases/stdlib/asyncio/check_coroutines.py @@ -12,7 +12,6 @@ def test_iscoroutinefunction( z: Callable[[str, int], str | Awaitable[bytes]], xx: object, ) -> None: - if iscoroutinefunction(x): assert_type(x, Callable[[str, int], Coroutine[str, int, bytes]])