]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
Another round of minor whitespace cleanups from autopep8
authorBen Darnell <ben@bendarnell.com>
Mon, 28 May 2012 03:07:56 +0000 (20:07 -0700)
committerBen Darnell <ben@bendarnell.com>
Mon, 28 May 2012 03:07:56 +0000 (20:07 -0700)
20 files changed:
tornado/auth.py
tornado/curl_httpclient.py
tornado/database.py
tornado/httputil.py
tornado/iostream.py
tornado/options.py
tornado/platform/common.py
tornado/platform/windows.py
tornado/stack_context.py
tornado/test/gen_test.py
tornado/test/options_test.py
tornado/test/simple_httpclient_test.py
tornado/test/stack_context_test.py
tornado/test/template_test.py
tornado/test/testing_test.py
tornado/test/twisted_test.py
tornado/test/util_test.py
tornado/test/web_test.py
tornado/testing.py
tornado/web.py

index 11b2ea4e143d86e43538917040ba90ad4635aa0d..a61e359ac13d6a6dc4cd55f0b188dd92c464079e 100644 (file)
@@ -1069,7 +1069,7 @@ class FacebookGraphMixin(OAuth2Mixin):
         if access_token:
             all_args["access_token"] = access_token
             all_args.update(args)
-            
+
         if all_args:
             url += "?" + urllib.urlencode(all_args)
         callback = self.async_callback(self._on_facebook_request, callback)
index 048876319f1e83ec061776a1bfcc453be5748d1f..95958c19c16fa7f973bcca78bdfe10d81a8d3f80 100644 (file)
@@ -397,7 +397,7 @@ def _curl_setup_request(curl, request, buffer, headers):
 
     if request.client_cert is not None:
         curl.setopt(pycurl.SSLCERT, request.client_cert)
-        
+
     if request.client_key is not None:
         curl.setopt(pycurl.SSLKEY, request.client_key)
 
index 837746bbe3e7fd23655881dac711cec879f8c3e9..982c5db5045ddd612fa23ebe97594ce520869a28 100644 (file)
@@ -33,6 +33,7 @@ except ImportError:
     # which has limitations on third-party modules)
     MySQLdb = None
 
+
 class Connection(object):
     """A lightweight wrapper around MySQLdb DB-API connections.
 
@@ -232,7 +233,6 @@ if MySQLdb is not None:
     for field_type in field_types:
         CONVERSIONS[field_type] = [(FLAG.BINARY, str)] + CONVERSIONS[field_type]
 
-
     # Alias some common MySQL exceptions
     IntegrityError = MySQLdb.IntegrityError
     OperationalError = MySQLdb.OperationalError
index 2cbf677bfcad0d87aa424ec94d1210f3c31dc306..6201dd188ffbf29dc26e347b122577a2640f1733 100644 (file)
@@ -61,8 +61,8 @@ class HTTPHeaders(dict):
         if (len(args) == 1 and len(kwargs) == 0 and
             isinstance(args[0], HTTPHeaders)):
             # Copy constructor
-            for k,v in args[0].get_all():
-                self.add(k,v)
+            for k, v in args[0].get_all():
+                self.add(k, v)
         else:
             # Dict-style initialization
             self.update(*args, **kwargs)
index 927dc92c28928c05fb961508d53110de74f03106..47e981b419681956417e63e8b244391d19241971 100644 (file)
@@ -203,7 +203,7 @@ class IOStream(object):
             WRITE_BUFFER_CHUNK_SIZE = 128 * 1024
             if len(data) > WRITE_BUFFER_CHUNK_SIZE:
                 for i in range(0, len(data), WRITE_BUFFER_CHUNK_SIZE):
-                    self._write_buffer.append(data[i:i+WRITE_BUFFER_CHUNK_SIZE])
+                    self._write_buffer.append(data[i:i + WRITE_BUFFER_CHUNK_SIZE])
             else:
                 self._write_buffer.append(data)
         self._write_callback = stack_context.wrap(callback)
@@ -364,7 +364,6 @@ class IOStream(object):
         else:
             self._maybe_run_close_callback()
 
-
     def _set_read_callback(self, callback):
         assert not self._read_callback, "Already reading"
         self._read_callback = callback
@@ -712,6 +711,7 @@ class SSLIOStream(IOStream):
             return None
         return chunk
 
+
 def _double_prefix(deque):
     """Grow by doubling, but don't split the second chunk just because the
     first one is small.
index 1763e8d26b658fd49ace4f5ad343a350d456df1a..537891e0f8241021d08bf393dd2ffc26d220ad6f 100644 (file)
@@ -303,7 +303,6 @@ class _Option(object):
         return _unicode(value)
 
 
-
 options = _Options()
 """Global options dictionary.
 
index e1eafc2d8155d1503f76f4cc180f8c47fcafdfca..176ce2e5292a94cabf57b52c05f000f275c9714c 100644 (file)
@@ -7,6 +7,7 @@ import socket
 from tornado.platform import interface
 from tornado.util import b
 
+
 class Waker(interface.Waker):
     """Create an OS independent asynchronous pipe.
 
index 58016bfa13a04a3a96baa9e65a3512f4fffaaa2a..80c8a6e2886360e4f2660d98bbf6f29d1bf6cfbf 100644 (file)
@@ -18,5 +18,3 @@ def set_close_exec(fd):
     success = SetHandleInformation(fd, HANDLE_FLAG_INHERIT, 0)
     if not success:
         raise ctypes.GetLastError()
-
-
index 3e0bea85736a41b164ccf1b46b6449403a95d0a5..96719bc61829acb91c67b3b4027ca1618ef6c37e 100644 (file)
@@ -77,6 +77,7 @@ import threading
 
 from tornado.util import raise_exc_info
 
+
 class _State(threading.local):
     def __init__(self):
         self.contexts = ()
index c45ba540de8700672337e67e7135f0591474db73..d9ac9dabb3118ee0a58673727060385ef97b6d3c 100644 (file)
@@ -253,10 +253,12 @@ class GenTest(AsyncTestCase):
         # regression test: repeated invocations of a gen-based
         # function should not result in accumulated stack_contexts
         from tornado import stack_context
+
         @gen.engine
         def inner(callback):
             yield gen.Task(self.io_loop.add_callback)
             callback()
+
         @gen.engine
         def outer():
             for i in xrange(10):
index dabc2c9c6d597120d447d6796ba4bf407e3d62b4..faf1fdb9493615e85fbd082fc282b77cf5eadc18 100644 (file)
@@ -2,6 +2,7 @@ import unittest
 
 from tornado.options import _Options
 
+
 class OptionsTest(unittest.TestCase):
     def setUp(self):
         self.options = _Options()
index 29987a5556b87e5d234a15629f49a613c9122d74..db7562f5f1b1267b4ec8dafa39a3411d21df430d 100644 (file)
@@ -84,6 +84,7 @@ class SeeOther303GetHandler(RequestHandler):
         assert not self.request.body
         self.write("ok")
 
+
 class HostEchoHandler(RequestHandler):
     def get(self):
         self.write(self.request.headers["Host"])
index f35728759069e7f1c7bad77291b959d72a2a8801..dc717596a6687d8f1993f1d11503ab5decd4159d 100644 (file)
@@ -95,18 +95,22 @@ class StackContextTest(AsyncTestCase, LogTrapTestCase):
 
     def test_deactivate(self):
         deactivate_callbacks = []
+
         def f1():
             with StackContext(functools.partial(self.context, 'c1')) as c1:
                 deactivate_callbacks.append(c1)
                 self.io_loop.add_callback(f2)
+
         def f2():
             with StackContext(functools.partial(self.context, 'c2')) as c2:
                 deactivate_callbacks.append(c2)
                 self.io_loop.add_callback(f3)
+
         def f3():
             with StackContext(functools.partial(self.context, 'c3')) as c3:
                 deactivate_callbacks.append(c3)
                 self.io_loop.add_callback(f4)
+
         def f4():
             self.assertEqual(self.active_contexts, ['c1', 'c2', 'c3'])
             deactivate_callbacks[1]()
@@ -114,6 +118,7 @@ class StackContextTest(AsyncTestCase, LogTrapTestCase):
             # but it will be missing from the next iteration
             self.assertEqual(self.active_contexts, ['c1', 'c2', 'c3'])
             self.io_loop.add_callback(f5)
+
         def f5():
             self.assertEqual(self.active_contexts, ['c1', 'c3'])
             self.stop()
index 061f9d39eb30b0a5a1b5f6399c98a2cc13937f0f..d70e4875c4b42e8980868131aa01519e28324a65 100644 (file)
@@ -322,6 +322,7 @@ raw: {% raw name %}""",
         self.assertEqual(render("foo.py", ["not a string"]),
                          b("""s = "['not a string']"\n"""))
 
+
 class TemplateLoaderTest(LogTrapTestCase):
     def setUp(self):
         self.loader = Loader(os.path.join(os.path.dirname(__file__), "templates"))
index b030185725d124865f161501e15194d0ffffa424..1de20df1c3d2ab92ffe7e988d5f69a21219547fe 100644 (file)
@@ -21,9 +21,10 @@ class AsyncTestCaseTest(AsyncTestCase, LogTrapTestCase):
         clears the first timeout.
         """
         self.io_loop.add_timeout(time.time() + 0.01, self.stop)
-        self.wait(timeout = 0.02)
+        self.wait(timeout=0.02)
         self.io_loop.add_timeout(time.time() + 0.03, self.stop)
-        self.wait(timeout = 0.1)
+        self.wait(timeout=0.1)
+
 
 class SetUpTearDownTest(unittest.TestCase):
     def test_set_up_tear_down(self):
index 544c24fa3cfc35a96fc18347376ba885fe46683e..3fe7ee97d5f2fca0e78abb36b2d0eb238135c0e9 100644 (file)
@@ -52,6 +52,7 @@ from tornado.testing import get_unused_port
 from tornado.util import import_object
 from tornado.web import RequestHandler, Application
 
+
 def save_signal_handlers():
     saved = {}
     for sig in [signal.SIGINT, signal.SIGTERM, signal.SIGCHLD]:
@@ -59,10 +60,12 @@ def save_signal_handlers():
     assert "twisted" not in repr(saved), repr(saved)
     return saved
 
+
 def restore_signal_handlers(saved):
     for sig, handler in saved.iteritems():
         signal.signal(sig, handler)
 
+
 class ReactorTestCase(unittest.TestCase):
     def setUp(self):
         self._saved_signals = save_signal_handlers()
index 24f607a49999d45f9004654f4bdbbc97f00199c0..8707b0d58af1aa5d3c71582f6f0064e877f67303 100644 (file)
@@ -4,6 +4,7 @@ import unittest
 
 from tornado.util import raise_exc_info
 
+
 class RaiseExcInfoTest(unittest.TestCase):
     def test_two_arg_exception(self):
         # This test would fail on python 3 if raise_exc_info were simply
index 8d3675b978aeb83b92147b3a8df7db773e98bbe5..bb316b56f7afbe16e34797b81b686fd5aece7767 100644 (file)
@@ -108,7 +108,7 @@ class CookieTest(AsyncHTTPTestCase, LogTrapTestCase):
         class SetCookieOverwriteHandler(RequestHandler):
             def get(self):
                 self.set_cookie("a", "b", domain="example.com")
-                self.set_cookie("c", "d" ,domain="example.com")
+                self.set_cookie("c", "d"domain="example.com")
                 # A second call with the same name clobbers the first.
                 # Attributes from the first call are not carried over.
                 self.set_cookie("a", "e")
@@ -411,6 +411,7 @@ class RedirectHandler(RequestHandler):
         else:
             raise Exception("didn't get permanent or status arguments")
 
+
 class EmptyFlushCallbackHandler(RequestHandler):
     @gen.engine
     @asynchronous
@@ -437,6 +438,7 @@ class HeaderInjectionHandler(RequestHandler):
 
 class WebTest(AsyncHTTPTestCase, LogTrapTestCase):
     COOKIE_SECRET = "WebTest.COOKIE_SECRET"
+
     def get_app(self):
         loader = DictLoader({
                 "linkify.html": "{% module linkify(message) %}",
@@ -772,6 +774,7 @@ class CustomStaticFileTest(AsyncHTTPTestCase, LogTrapTestCase):
         response = self.fetch("/static_url/foo.txt")
         self.assertEqual(response.body, b("/static/foo.42.txt"))
 
+
 class NamedURLSpecGroupsTest(AsyncHTTPTestCase, LogTrapTestCase):
     def get_app(self):
         class EchoHandler(RequestHandler):
@@ -788,6 +791,7 @@ class NamedURLSpecGroupsTest(AsyncHTTPTestCase, LogTrapTestCase):
         response = self.fetch("/unicode/bar")
         self.assertEqual(response.body, b("bar"))
 
+
 class ClearHeaderTest(SimpleHandlerTestCase):
     class Handler(RequestHandler):
         def get(self):
@@ -800,19 +804,19 @@ class ClearHeaderTest(SimpleHandlerTestCase):
         response = self.fetch("/")
         self.assertTrue("h1" not in response.headers)
         self.assertEqual(response.headers["h2"], "bar")
-        
+
 
 class Header304Test(SimpleHandlerTestCase):
     class Handler(RequestHandler):
         def get(self):
             self.set_header("Content-Language", "en_US")
             self.write("hello")
-            
+
     def test_304_headers(self):
         response1 = self.fetch('/')
         self.assertEqual(response1.headers["Content-Length"], "5")
         self.assertEqual(response1.headers["Content-Language"], "en_US")
-        
+
         response2 = self.fetch('/', headers={
                 'If-None-Match': response1.headers["Etag"]})
         self.assertEqual(response2.code, 304)
index 30fd87ec368372f5a1d995852e66dd2c912e1594..fccdb8610c601c18d7848aec19b75047132756ed 100644 (file)
@@ -145,7 +145,6 @@ class AsyncTestCase(unittest.TestCase):
             self.__failure = None
             raise_exc_info(failure)
 
-
     def run(self, result=None):
         with StackContext(self._stack_context):
             super(AsyncTestCase, self).run(result)
index fa1fcd5515287d328666d5e2d895c25a94fa64dc..a7c9637f8cd8b589ac00f1d9842cc9306348e960 100644 (file)
@@ -1134,7 +1134,7 @@ def removeslash(method):
                 if uri:  # don't try to redirect '/' to ''
                     if self.request.query:
                         uri += "?" + self.request.query
-                    self.redirect(uri, permanent = True)
+                    self.redirect(uri, permanent=True)
                     return
             else:
                 raise HTTPError(404)
@@ -1156,7 +1156,7 @@ def addslash(method):
                 uri = self.request.path + "/"
                 if self.request.query:
                     uri += "?" + self.request.query
-                self.redirect(uri, permanent = True)
+                self.redirect(uri, permanent=True)
                 return
             raise HTTPError(404)
         return method(self, *args, **kwargs)