From 90ae304f6f68322a8186075bd1bbdcd50f5d9e21 Mon Sep 17 00:00:00 2001 From: Ben Darnell Date: Thu, 13 Jun 2024 15:08:18 -0400 Subject: [PATCH] lint: Set black target version to 3.8+ This makes black use trailing commas consistently across the codebase. Without this, it uses certain trailing commas only in files that contain fstrings (because this marks them as requiring Python 3.6+). --- pyproject.toml | 3 +++ tornado/auth.py | 6 +++--- tornado/httpclient.py | 4 ++-- tornado/ioloop.py | 4 ++-- tornado/netutil.py | 2 +- tornado/websocket.py | 4 ++-- 6 files changed, 13 insertions(+), 10 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fa75e066..f8268bf0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -2,6 +2,9 @@ requires = ["setuptools", "wheel"] build-backend = "setuptools.build_meta" +[tool.black] +target-version = ['py38', 'py39', 'py310', 'py311', 'py312'] + [tool.cibuildwheel] build = "cp3[89]* cp310* cp311* cp312*" test-command = "python -m tornado.test" diff --git a/tornado/auth.py b/tornado/auth.py index 73acf9e9..035d34b0 100644 --- a/tornado/auth.py +++ b/tornado/auth.py @@ -632,7 +632,7 @@ class OAuth2Mixin: url: str, access_token: Optional[str] = None, post_args: Optional[Dict[str, Any]] = None, - **args: Any + **args: Any, ) -> Any: """Fetches the given URL auth an OAuth2 access token. @@ -761,7 +761,7 @@ class TwitterMixin(OAuthMixin): path: str, access_token: Dict[str, Any], post_args: Optional[Dict[str, Any]] = None, - **args: Any + **args: Any, ) -> Any: """Fetches the given API path, e.g., ``statuses/user_timeline/btaylor`` @@ -1096,7 +1096,7 @@ class FacebookGraphMixin(OAuth2Mixin): path: str, access_token: Optional[str] = None, post_args: Optional[Dict[str, Any]] = None, - **args: Any + **args: Any, ) -> Any: """Fetches the given relative API path, e.g., "/btaylor/picture" diff --git a/tornado/httpclient.py b/tornado/httpclient.py index 879c45f6..1fc04c64 100644 --- a/tornado/httpclient.py +++ b/tornado/httpclient.py @@ -89,7 +89,7 @@ class HTTPClient: def __init__( self, async_client_class: "Optional[Type[AsyncHTTPClient]]" = None, - **kwargs: Any + **kwargs: Any, ) -> None: # Initialize self._closed at the beginning of the constructor # so that an exception raised here doesn't lead to confusing @@ -250,7 +250,7 @@ class AsyncHTTPClient(Configurable): self, request: Union[str, "HTTPRequest"], raise_error: bool = True, - **kwargs: Any + **kwargs: Any, ) -> "Future[HTTPResponse]": """Executes a request, asynchronously returning an `HTTPResponse`. diff --git a/tornado/ioloop.py b/tornado/ioloop.py index e6a17968..31874fd2 100644 --- a/tornado/ioloop.py +++ b/tornado/ioloop.py @@ -554,7 +554,7 @@ class IOLoop(Configurable): deadline: Union[float, datetime.timedelta], callback: Callable, *args: Any, - **kwargs: Any + **kwargs: Any, ) -> object: """Runs the ``callback`` at the time ``deadline`` from the I/O loop. @@ -705,7 +705,7 @@ class IOLoop(Configurable): self, executor: Optional[concurrent.futures.Executor], func: Callable[..., _T], - *args: Any + *args: Any, ) -> "Future[_T]": """Runs a function in a ``concurrent.futures.Executor``. If ``executor`` is ``None``, the IO loop's default executor will be used. diff --git a/tornado/netutil.py b/tornado/netutil.py index da134c15..e74cf0f1 100644 --- a/tornado/netutil.py +++ b/tornado/netutil.py @@ -645,7 +645,7 @@ def ssl_wrap_socket( ssl_options: Union[Dict[str, Any], ssl.SSLContext], server_hostname: Optional[str] = None, server_side: Optional[bool] = None, - **kwargs: Any + **kwargs: Any, ) -> ssl.SSLSocket: """Returns an ``ssl.SSLSocket`` wrapping the given socket. diff --git a/tornado/websocket.py b/tornado/websocket.py index 581a0f40..1e0161e1 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -212,7 +212,7 @@ class WebSocketHandler(tornado.web.RequestHandler): self, application: tornado.web.Application, request: httputil.HTTPServerRequest, - **kwargs: Any + **kwargs: Any, ) -> None: super().__init__(application, request, **kwargs) self.ws_connection = None # type: Optional[WebSocketProtocol] @@ -1015,7 +1015,7 @@ class WebSocketProtocol13(WebSocketProtocol): max_message_size=self.params.max_message_size, **self._get_compressor_options( other_side, agreed_parameters, compression_options - ) + ), ) def _write_frame(