]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
autopep8 whitespace fixes.
authorBen Darnell <ben@bendarnell.com>
Mon, 30 Dec 2013 04:56:37 +0000 (23:56 -0500)
committerBen Darnell <ben@bendarnell.com>
Mon, 30 Dec 2013 04:56:37 +0000 (23:56 -0500)
tornado/auth.py
tornado/gen.py
tornado/iostream.py
tornado/platform/asyncio.py
tornado/simple_httpclient.py
tornado/test/httpserver_test.py
tornado/test/web_test.py
tornado/test/websocket_test.py
tornado/web.py
tornado/websocket.py
tornado/wsgi.py

index a2cef35658e040d474a347469376c4d2687a8e88..f2080f1e9730e80a625db3beb9c907859950c735 100644 (file)
@@ -988,8 +988,8 @@ class GoogleOAuth2Mixin(OAuth2Mixin):
         })
 
         http.fetch(self._OAUTH_ACCESS_TOKEN_URL,
-                  self.async_callback(self._on_access_token, callback),
-                  method="POST", headers={'Content-Type': 'application/x-www-form-urlencoded'}, body=body)
+                   self.async_callback(self._on_access_token, callback),
+                   method="POST", headers={'Content-Type': 'application/x-www-form-urlencoded'}, body=body)
 
     def _on_access_token(self, future, response):
         """Callback function for the exchange to the access token."""
index 5ce52efd313a0e2d8cbb591ecc4655a21bd07c15..21f692ab9ad15d09032f7bd58807a24929678508 100644 (file)
@@ -411,6 +411,7 @@ class YieldFuture(YieldPoint):
         else:
             return self.result
 
+
 class Multi(YieldPoint):
     """Runs multiple asynchronous operations in parallel.
 
index 08430ceaf84158ffc0afafb5a32a607d900b91ec..5d4d08ac4eb0ead8894182be0faf0757e4f66e19 100644 (file)
@@ -55,6 +55,7 @@ _ERRNO_WOULDBLOCK = (errno.EWOULDBLOCK, errno.EAGAIN)
 # They should be caught and handled less noisily than other errors.
 _ERRNO_CONNRESET = (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE)
 
+
 class StreamClosedError(IOError):
     """Exception raised by `IOStream` methods when the stream is closed.
 
@@ -738,7 +739,7 @@ class IOStream(BaseIOStream):
             # localhost, so handle them the same way as an error
             # reported later in _handle_connect.
             if (e.args[0] != errno.EINPROGRESS and
-                e.args[0] not in _ERRNO_WOULDBLOCK):
+                    e.args[0] not in _ERRNO_WOULDBLOCK):
                 gen_log.warning("Connect error on fd %d: %s",
                                 self.socket.fileno(), e)
                 self.close(exc_info=True)
index a8f5bad475fa7dd8d0fe8289bf9204566ab8a3fb..09b2bf3d3a91b04207a173d7abcd0e01ad181756 100644 (file)
@@ -16,6 +16,7 @@ import os
 from tornado.ioloop import IOLoop
 from tornado import stack_context
 
+
 class BaseAsyncIOLoop(IOLoop):
     def initialize(self, asyncio_loop, close_loop=False):
         self.asyncio_loop = asyncio_loop
@@ -104,7 +105,7 @@ class BaseAsyncIOLoop(IOLoop):
         else:
             raise TypeError("Unsupported deadline %r", deadline)
         return self.asyncio_loop.call_later(delay, self._run_callback,
-                                          stack_context.wrap(callback))
+                                            stack_context.wrap(callback))
 
     def remove_timeout(self, timeout):
         timeout.cancel()
@@ -114,8 +115,8 @@ class BaseAsyncIOLoop(IOLoop):
             raise RuntimeError("IOLoop is closing")
         if kwargs:
             self.asyncio_loop.call_soon_threadsafe(functools.partial(
-                    self._run_callback, stack_context.wrap(callback),
-                    *args, **kwargs))
+                self._run_callback, stack_context.wrap(callback),
+                *args, **kwargs))
         else:
             self.asyncio_loop.call_soon_threadsafe(
                 self._run_callback, stack_context.wrap(callback), *args)
@@ -128,6 +129,7 @@ class AsyncIOMainLoop(BaseAsyncIOLoop):
         super(AsyncIOMainLoop, self).initialize(asyncio.get_event_loop(),
                                                 close_loop=False)
 
+
 class AsyncIOLoop(BaseAsyncIOLoop):
     def initialize(self):
         super(AsyncIOLoop, self).initialize(asyncio.new_event_loop(),
index 2558ada800cfcda88c50624e5d01d0605dd50bbe..73bfee89e4c26b12cefeb12e90af6db2e6c30eba 100644 (file)
@@ -94,9 +94,9 @@ class SimpleAsyncHTTPClient(AsyncHTTPClient):
         self.queue.append((key, request, callback))
         if not len(self.active) < self.max_clients:
             timeout_handle = self.io_loop.add_timeout(
-                    self.io_loop.time() + min(request.connect_timeout,
-                                              request.request_timeout),
-                    functools.partial(self._on_timeout, key))
+                self.io_loop.time() + min(request.connect_timeout,
+                                          request.request_timeout),
+                functools.partial(self._on_timeout, key))
         else:
             timeout_handle = None
         self.waiting[key] = (request, callback, timeout_handle)
@@ -136,8 +136,8 @@ class SimpleAsyncHTTPClient(AsyncHTTPClient):
         request, callback, timeout_handle = self.waiting[key]
         self.queue.remove((key, request, callback))
         timeout_response = HTTPResponse(
-                request, 599, error=HTTPError(599, "Timeout"),
-                request_time=self.io_loop.time() - request.start_time)
+            request, 599, error=HTTPError(599, "Timeout"),
+            request_time=self.io_loop.time() - request.start_time)
         self.io_loop.add_callback(callback, timeout_response)
         del self.waiting[key]
 
index 47607d4bc6b40b8e7f7b5b7b4913a20f17c4493f..5ca2993501a01ce709d5b03ed274630e5a14d3ab 100644 (file)
@@ -211,15 +211,15 @@ class HTTPConnectionTest(AsyncHTTPTestCase):
             b"X-Header-encoding-test: \xe9",
         ],
             b"\r\n".join([
-            b"Content-Disposition: form-data; name=argument",
-            b"",
-            u("\u00e1").encode("utf-8"),
-            b"--1234567890",
-            u('Content-Disposition: form-data; name="files"; filename="\u00f3"').encode("utf8"),
-            b"",
-            u("\u00fa").encode("utf-8"),
-            b"--1234567890--",
-            b"",
+                b"Content-Disposition: form-data; name=argument",
+                b"",
+                u("\u00e1").encode("utf-8"),
+                b"--1234567890",
+                u('Content-Disposition: form-data; name="files"; filename="\u00f3"').encode("utf8"),
+                b"",
+                u("\u00fa").encode("utf-8"),
+                b"--1234567890--",
+                b"",
             ]))
         data = json_decode(response.body)
         self.assertEqual(u("\u00e9"), data["header"])
@@ -548,7 +548,6 @@ class UnixSocketTest(AsyncTestCase):
         self.assertEqual(response, b"")
 
 
-
 class KeepAliveTest(AsyncHTTPTestCase):
     """Tests various scenarios for HTTP 1.1 keep-alive support.
 
index e12f7ec0efcec221f3347ee5fee7b41fdff230b7..5029cd526039341542cf0a0013978a44ae18f70b 100644 (file)
@@ -1743,6 +1743,7 @@ class Default404Test(WebTestCase):
                          b'<html><title>404: Not Found</title>'
                          b'<body>404: Not Found</body></html>')
 
+
 @wsgi_safe
 class Custom404Test(WebTestCase):
     def get_handlers(self):
@@ -1761,6 +1762,7 @@ class Custom404Test(WebTestCase):
         self.assertEqual(response.code, 404)
         self.assertEqual(response.body, b'custom 404 response')
 
+
 @wsgi_safe
 class DefaultHandlerArgumentsTest(WebTestCase):
     def get_handlers(self):
index 7eb6a116371257b886072de7ba9f2f99d8daedc5..d5cc1ceb4c3c01d8c47665d5583648209474cd2b 100644 (file)
@@ -11,6 +11,7 @@ try:
 except ImportError:
     speedups = None
 
+
 class TestWebSocketHandler(WebSocketHandler):
     """Base class for testing handlers that exposes the on_close event.
 
@@ -153,6 +154,7 @@ class PythonMaskFunctionTest(MaskFunctionMixin, unittest.TestCase):
     def mask(self, mask, data):
         return _websocket_mask_python(mask, data)
 
+
 @unittest.skipIf(speedups is None, "tornado.speedups module not present")
 class CythonMaskFunctionTest(MaskFunctionMixin, unittest.TestCase):
     def mask(self, mask, data):
index 2f7e92ea09e11f96d6aa86c37e73656f6e983191..65a76cd47468e02214d88bf2065d5c2a71decb18 100644 (file)
@@ -1912,7 +1912,7 @@ class StaticFileHandler(RequestHandler):
                 # content, or when a suffix with length 0 is specified
                 self.set_status(416)  # Range Not Satisfiable
                 self.set_header("Content-Type", "text/plain")
-                self.set_header("Content-Range", "bytes */%s" %(size, ))
+                self.set_header("Content-Range", "bytes */%s" % (size, ))
                 return
             if start is not None and start < 0:
                 start += size
index 8c2f5a647e8c45c40c3781038d2bda4d264b4fcf..9bec9bbae28d63d667fc20db69b4c484e9a6369d 100644 (file)
@@ -381,12 +381,12 @@ class WebSocketProtocol76(WebSocketProtocol):
             "Sec-WebSocket-Location: %(scheme)s://%(host)s%(uri)s\r\n"
             "%(subprotocol)s"
             "\r\n" % (dict(
-            version=tornado.version,
-            origin=self.request.headers["Origin"],
-            scheme=scheme,
-            host=self.request.host,
-            uri=self.request.uri,
-            subprotocol=subprotocol_header))))
+                version=tornado.version,
+                origin=self.request.headers["Origin"],
+                scheme=scheme,
+                host=self.request.host,
+                uri=self.request.uri,
+                subprotocol=subprotocol_header))))
         self.stream.read_bytes(8, self._handle_challenge)
 
     def challenge_response(self, challenge):
@@ -891,6 +891,7 @@ def websocket_connect(url, io_loop=None, callback=None, connect_timeout=None):
         io_loop.add_future(conn.connect_future, callback)
     return conn.connect_future
 
+
 def _websocket_mask_python(mask, data):
     """Websocket masking function.
 
index 8e5ddedb98c5e97bf9fece841efd2258717754f5..615f2e1fdd8c4cd0b59e6db7e9d2c77899956fdb 100644 (file)
@@ -294,7 +294,7 @@ class WSGIContainer(object):
             "REQUEST_METHOD": request.method,
             "SCRIPT_NAME": "",
             "PATH_INFO": to_wsgi_str(escape.url_unescape(
-            request.path, encoding=None, plus=False)),
+                request.path, encoding=None, plus=False)),
             "QUERY_STRING": request.query,
             "REMOTE_ADDR": request.remote_ip,
             "SERVER_NAME": host,