From: Ben Darnell Date: Sat, 31 Oct 2020 16:23:35 +0000 (-0400) Subject: *: Update black to newest version X-Git-Tag: v6.2.0b1~62^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3b9eecce8d3b3f1d2bdfdb1c569eb3d8be412598;p=thirdparty%2Ftornado.git *: Update black to newest version --- diff --git a/maint/requirements.in b/maint/requirements.in index 17dc33860..12a6a5d82 100644 --- a/maint/requirements.in +++ b/maint/requirements.in @@ -7,7 +7,7 @@ # is the lockfile, and maint/requirements.in is the input file containing only # direct dependencies. -black==19.10b0 +black flake8 mypy==0.740 tox diff --git a/maint/requirements.txt b/maint/requirements.txt index a32e55f04..39b7a4bad 100644 --- a/maint/requirements.txt +++ b/maint/requirements.txt @@ -6,7 +6,7 @@ # is the lockfile, and maint/requirements.in is the input file containing only # direct dependencies. -black==19.10b0 +black==20.8b1 flake8==3.8.4 mypy==0.740 tox==3.20.1 diff --git a/tornado/http1connection.py b/tornado/http1connection.py index 835027b47..77b1cda7d 100644 --- a/tornado/http1connection.py +++ b/tornado/http1connection.py @@ -69,8 +69,7 @@ class _ExceptionLoggingContext(object): class HTTP1ConnectionParameters(object): - """Parameters for `.HTTP1Connection` and `.HTTP1ServerConnection`. - """ + """Parameters for `.HTTP1Connection` and `.HTTP1ServerConnection`.""" def __init__( self, @@ -703,8 +702,7 @@ class HTTP1Connection(httputil.HTTPConnection): class _GzipMessageDelegate(httputil.HTTPMessageDelegate): - """Wraps an `HTTPMessageDelegate` to decode ``Content-Encoding: gzip``. - """ + """Wraps an `HTTPMessageDelegate` to decode ``Content-Encoding: gzip``.""" def __init__(self, delegate: httputil.HTTPMessageDelegate, chunk_size: int) -> None: self._delegate = delegate diff --git a/tornado/httputil.py b/tornado/httputil.py index bd32cd0c4..0eeb9349b 100644 --- a/tornado/httputil.py +++ b/tornado/httputil.py @@ -602,8 +602,7 @@ class HTTPConnection(object): raise NotImplementedError() def finish(self) -> None: - """Indicates that the last body data has been written. - """ + """Indicates that the last body data has been written.""" raise NotImplementedError() diff --git a/tornado/iostream.py b/tornado/iostream.py index ced869bc4..768b404b1 100644 --- a/tornado/iostream.py +++ b/tornado/iostream.py @@ -111,8 +111,7 @@ class UnsatisfiableReadError(Exception): class StreamBufferFullError(Exception): - """Exception raised by `IOStream` methods when the buffer is full. - """ + """Exception raised by `IOStream` methods when the buffer is full.""" class _StreamBuffer(object): diff --git a/tornado/locks.py b/tornado/locks.py index 0898ebaa8..29b6b4129 100644 --- a/tornado/locks.py +++ b/tornado/locks.py @@ -262,10 +262,10 @@ class Event(object): class _ReleasingContextManager(object): """Releases a Lock or Semaphore at the end of a "with" statement. - with (yield semaphore.acquire()): - pass + with (yield semaphore.acquire()): + pass - # Now semaphore.release() has been called. + # Now semaphore.release() has been called. """ def __init__(self, obj: Any) -> None: diff --git a/tornado/platform/asyncio.py b/tornado/platform/asyncio.py index 012948b3a..292d9b66a 100644 --- a/tornado/platform/asyncio.py +++ b/tornado/platform/asyncio.py @@ -463,7 +463,9 @@ class AddThreadSelectorEventLoop(asyncio.AbstractEventLoop): ) # type: Optional[Tuple[List[_FileDescriptorLike], List[_FileDescriptorLike]]] self._closing_selector = False self._thread = threading.Thread( - name="Tornado selector", daemon=True, target=self._run_select, + name="Tornado selector", + daemon=True, + target=self._run_select, ) self._thread.start() # Start the select loop once the loop is started. @@ -582,7 +584,9 @@ class AddThreadSelectorEventLoop(asyncio.AbstractEventLoop): self._start_select() def _handle_event( - self, fd: "_FileDescriptorLike", cb_map: Dict["_FileDescriptorLike", Callable], + self, + fd: "_FileDescriptorLike", + cb_map: Dict["_FileDescriptorLike", Callable], ) -> None: try: callback = cb_map[fd] diff --git a/tornado/template.py b/tornado/template.py index 2e6e0a2fc..d53e977c5 100644 --- a/tornado/template.py +++ b/tornado/template.py @@ -451,8 +451,7 @@ class BaseLoader(object): class Loader(BaseLoader): - """A template loader that loads from a single root directory. - """ + """A template loader that loads from a single root directory.""" def __init__(self, root_directory: str, **kwargs: Any) -> None: super().__init__(**kwargs) diff --git a/tornado/test/tcpclient_test.py b/tornado/test/tcpclient_test.py index 75f48186e..2f7bdc104 100644 --- a/tornado/test/tcpclient_test.py +++ b/tornado/test/tcpclient_test.py @@ -137,8 +137,7 @@ class TCPClientTest(AsyncTestCase): yield self.client.connect("127.0.0.1", port) def test_source_ip_fail(self): - """Fail when trying to use the source IP Address '8.8.8.8'. - """ + """Fail when trying to use the source IP Address '8.8.8.8'.""" self.assertRaises( socket.error, self.do_test_connect, @@ -148,14 +147,12 @@ class TCPClientTest(AsyncTestCase): ) def test_source_ip_success(self): - """Success when trying to use the source IP Address '127.0.0.1'. - """ + """Success when trying to use the source IP Address '127.0.0.1'.""" self.do_test_connect(socket.AF_INET, "127.0.0.1", source_ip="127.0.0.1") @skipIfNonUnix def test_source_port_fail(self): - """Fail when trying to use source port 1. - """ + """Fail when trying to use source port 1.""" if getpass.getuser() == "root": # Root can use any port so we can't easily force this to fail. # This is mainly relevant for docker. diff --git a/tornado/web.py b/tornado/web.py index 546e6ecf1..59768ce2a 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -1671,11 +1671,15 @@ class RequestHandler(object): ) # If XSRF cookies are turned on, reject form submissions without # the proper cookie - if self.request.method not in ( - "GET", - "HEAD", - "OPTIONS", - ) and self.application.settings.get("xsrf_cookies"): + if ( + self.request.method + not in ( + "GET", + "HEAD", + "OPTIONS", + ) + and self.application.settings.get("xsrf_cookies") + ): self.check_xsrf_cookie() result = self.prepare() diff --git a/tornado/websocket.py b/tornado/websocket.py index eef49e7c9..d2c6a427a 100644 --- a/tornado/websocket.py +++ b/tornado/websocket.py @@ -626,8 +626,7 @@ def _raise_not_supported_for_websockets(*args: Any, **kwargs: Any) -> None: class WebSocketProtocol(abc.ABC): - """Base class for WebSocket protocol versions. - """ + """Base class for WebSocket protocol versions.""" def __init__(self, handler: "_WebSocketDelegate") -> None: self.handler = handler diff --git a/tornado/wsgi.py b/tornado/wsgi.py index 77124aaa3..825b395cf 100644 --- a/tornado/wsgi.py +++ b/tornado/wsgi.py @@ -146,8 +146,7 @@ class WSGIContainer(object): @staticmethod def environ(request: httputil.HTTPServerRequest) -> Dict[Text, Any]: - """Converts a `tornado.httputil.HTTPServerRequest` to a WSGI environment. - """ + """Converts a `tornado.httputil.HTTPServerRequest` to a WSGI environment.""" hostport = request.host.split(":") if len(hostport) == 2: host = hostport[0]