]> git.ipfire.org Git - thirdparty/tornado.git/commitdiff
style fix: wrap or ignore long lines in tornado lib sources
authorPierce Lopez <pierce.lopez@gmail.com>
Mon, 1 Jan 2018 22:46:05 +0000 (17:46 -0500)
committerPierce Lopez <pierce.lopez@gmail.com>
Tue, 2 Jan 2018 20:29:18 +0000 (15:29 -0500)
excluding tests

13 files changed:
setup.py
tornado/auth.py
tornado/escape.py
tornado/ioloop.py
tornado/iostream.py
tornado/log.py
tornado/platform/twisted.py
tornado/platform/windows.py
tornado/routing.py
tornado/template.py
tornado/testing.py
tornado/web.py
tornado/websocket.py

index f9254d931a6342306db984f96e965f9b120d1605..7cea09991f1c84a759aeefac84db11400021f55f 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -177,7 +177,8 @@ setup(
     author_email="python-tornado@googlegroups.com",
     url="http://www.tornadoweb.org/",
     license="http://www.apache.org/licenses/LICENSE-2.0",
-    description="Tornado is a Python web framework and asynchronous networking library, originally developed at FriendFeed.",
+    description=("Tornado is a Python web framework and asynchronous networking library,"
+                 " originally developed at FriendFeed."),
     classifiers=[
         'License :: OSI Approved :: Apache Software License',
         'Programming Language :: Python :: 2',
index ba774c742652951dae193a8e76cecb864a3ff376..b8d373a581e88acf3da057ebc52cdb50474c99a1 100644 (file)
@@ -392,7 +392,8 @@ class OAuthMixin(object):
                 "Missing OAuth request token cookie"))
             return
         self.clear_cookie("_oauth_request_token")
-        cookie_key, cookie_secret = [base64.b64decode(escape.utf8(i)) for i in request_cookie.split("|")]
+        cookie_key, cookie_secret = [
+            base64.b64decode(escape.utf8(i)) for i in request_cookie.split("|")]
         if cookie_key != request_key:
             future.set_exception(AuthError(
                 "Request token does not match cookie"))
@@ -896,7 +897,7 @@ class GoogleOAuth2Mixin(OAuth2Mixin):
         .. testoutput::
            :hide:
 
-        """
+        """  # noqa: E501
         http = self.get_auth_http_client()
         body = urllib_parse.urlencode({
             "redirect_uri": redirect_uri,
@@ -908,7 +909,9 @@ class GoogleOAuth2Mixin(OAuth2Mixin):
 
         http.fetch(self._OAUTH_ACCESS_TOKEN_URL,
                    functools.partial(self._on_access_token, callback),
-                   method="POST", headers={'Content-Type': 'application/x-www-form-urlencoded'}, body=body)
+                   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."""
@@ -965,7 +968,8 @@ class FacebookGraphMixin(OAuth2Mixin):
           Tornado it will change from a string to an integer.
         * ``id``, ``name``, ``first_name``, ``last_name``, ``locale``, ``picture``,
           ``link``, plus any fields named in the ``extra_fields`` argument. These
-          fields are copied from the Facebook graph API `user object <https://developers.facebook.com/docs/graph-api/reference/user>`_
+          fields are copied from the Facebook graph API
+          `user object <https://developers.facebook.com/docs/graph-api/reference/user>`_
 
         .. versionchanged:: 4.5
            The ``session_expires`` field was updated to support changes made to the
index 2ca3fe3fe883249d6cacc457d5d0565b04804731..7fa6853bb3ef5bc08dfdfdea0e23837a20459331 100644 (file)
@@ -274,7 +274,9 @@ def recursive_unicode(obj):
 # This regex should avoid those problems.
 # Use to_unicode instead of tornado.util.u - we don't want backslashes getting
 # processed as escapes.
-_URL_RE = re.compile(to_unicode(r"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)"""))
+_URL_RE = re.compile(to_unicode(
+    r"""\b((?:([\w-]+):(/{1,3})|www[.])(?:(?:(?:[^\s&()]|&amp;|&quot;)*(?:[^!"#$%&'()*+,.:;<=>?@\[\]^`{|}~\s]))|(?:\((?:[^\s&()]|&amp;|&quot;)*\)))+)"""  # noqa: E501
+))
 
 
 def linkify(text, shorten=False, extra_params="",
index 38c506d1bad36822a914fdf5e9dc5f0456f15c23..b28eb46fe82c070607e41514c8816933c06cea4a 100644 (file)
@@ -49,11 +49,14 @@ import time
 import traceback
 import math
 
-from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info, future_add_done_callback
+from tornado.concurrent import Future, is_future, chain_future, future_set_exc_info, future_add_done_callback  # noqa: E501
 from tornado.log import app_log, gen_log
 from tornado.platform.auto import set_close_exec, Waker
 from tornado import stack_context
-from tornado.util import PY3, Configurable, errno_from_exception, timedelta_to_seconds, TimeoutError, unicode_type, import_object
+from tornado.util import (
+    PY3, Configurable, errno_from_exception, timedelta_to_seconds,
+    TimeoutError, unicode_type, import_object,
+)
 
 try:
     import signal
index 2c334d2f4566db06b87eb00c0f9ea17cc674ae35..fb89da089d0098e6ca626b8645d23b26fa1b6683 100644 (file)
@@ -66,7 +66,7 @@ _ERRNO_CONNRESET = (errno.ECONNRESET, errno.ECONNABORTED, errno.EPIPE,
                     errno.ETIMEDOUT)
 
 if hasattr(errno, "WSAECONNRESET"):
-    _ERRNO_CONNRESET += (errno.WSAECONNRESET, errno.WSAECONNABORTED, errno.WSAETIMEDOUT)  # type: ignore
+    _ERRNO_CONNRESET += (errno.WSAECONNRESET, errno.WSAECONNABORTED, errno.WSAETIMEDOUT)  # type: ignore # noqa: E501
 
 if sys.platform == 'darwin':
     # OSX appears to have a race condition that causes send(2) to return
index 6b1e186c2a97b6d39e47b48e7b7d279b875407d8..fc95a5f98b19150e07dc4bda77fe45f162dc76ab 100644 (file)
@@ -102,7 +102,8 @@ class LogFormatter(logging.Formatter):
        Added support for ``colorama``. Changed the constructor
        signature to be compatible with `logging.config.dictConfig`.
     """
-    DEFAULT_FORMAT = '%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)s'
+    DEFAULT_FORMAT = \
+        '%(color)s[%(levelname)1.1s %(asctime)s %(module)s:%(lineno)d]%(end_color)s %(message)s'
     DEFAULT_DATE_FORMAT = '%y%m%d %H:%M:%S'
     DEFAULT_COLORS = {
         logging.DEBUG: 4,  # Blue
index 43e447c13dbb4276f3ea48d16c8ab0a2edd8aac6..d1ab2c795765fda56113c3cfd70d7cd7b2d6d3d8 100644 (file)
@@ -32,7 +32,7 @@ import sys
 import twisted.internet.abstract  # type: ignore
 from twisted.internet.defer import Deferred  # type: ignore
 from twisted.internet.posixbase import PosixReactorBase  # type: ignore
-from twisted.internet.interfaces import IReactorFDSet, IDelayedCall, IReactorTime, IReadDescriptor, IWriteDescriptor  # type: ignore
+from twisted.internet.interfaces import IReactorFDSet, IDelayedCall, IReactorTime, IReadDescriptor, IWriteDescriptor  # type: ignore # noqa: E501
 from twisted.python import failure, log  # type: ignore
 from twisted.internet import error  # type: ignore
 import twisted.names.cache  # type: ignore
index e94a0cf13dab716e1a9168e7a0c5e7f4dac4e9ec..4127700659e3aaafc59a859b4fdfd5383734209a 100644 (file)
@@ -8,7 +8,7 @@ import ctypes.wintypes  # type: ignore
 
 # See: http://msdn.microsoft.com/en-us/library/ms724935(VS.85).aspx
 SetHandleInformation = ctypes.windll.kernel32.SetHandleInformation
-SetHandleInformation.argtypes = (ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD)
+SetHandleInformation.argtypes = (ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD, ctypes.wintypes.DWORD)  # noqa: E501
 SetHandleInformation.restype = ctypes.wintypes.BOOL
 
 HANDLE_FLAG_INHERIT = 0x00000001
index d3f17803b39a4d248956868076082b908470cc7b..4a19ba57aae75ab09538aa71ec32496086e6d335 100644 (file)
@@ -293,7 +293,8 @@ class RuleRouter(Router):
             ])
 
         In the examples above, ``Target`` can be a nested `Router` instance, an instance of
-        `~.httputil.HTTPServerConnectionDelegate` or an old-style callable, accepting a request argument.
+        `~.httputil.HTTPServerConnectionDelegate` or an old-style callable,
+        accepting a request argument.
 
         :arg rules: a list of `Rule` instances or tuples of `Rule`
             constructor arguments.
index 3b2fa3feef2d95f13055e48c193b81ffdf136abe..0818178dca7820b645bb77ebf699cded70765fe5 100644 (file)
@@ -260,9 +260,8 @@ class Template(object):
         :arg str template_string: the contents of the template file.
         :arg str name: the filename from which the template was loaded
             (used for error message).
-        :arg tornado.template.BaseLoader loader: the `~tornado.template.BaseLoader` responsible for this template,
-            used to resolve ``{% include %}`` and ``{% extend %}``
-            directives.
+        :arg tornado.template.BaseLoader loader: the `~tornado.template.BaseLoader` responsible
+            for this template, used to resolve ``{% include %}`` and ``{% extend %}`` directives.
         :arg bool compress_whitespace: Deprecated since Tornado 4.3.
             Equivalent to ``whitespace="single"`` if true and
             ``whitespace="all"`` if false.
index a0c836642de88111ce376aa14e4bfbd0a9b40777..21d4d88752ee6352fb0232aedb0fb2691ccec1e9 100644 (file)
@@ -301,7 +301,8 @@ class AsyncTestCase(unittest.TestCase):
                     except Exception:
                         self.__failure = sys.exc_info()
                     self.stop()
-                self.__timeout = self.io_loop.add_timeout(self.io_loop.time() + timeout, timeout_func)
+                self.__timeout = self.io_loop.add_timeout(self.io_loop.time() + timeout,
+                                                          timeout_func)
             while True:
                 self.__running = True
                 self.io_loop.start()
@@ -440,7 +441,8 @@ class AsyncHTTPSTestCase(AsyncHTTPTestCase):
         By default includes a self-signed testing certificate.
         """
         # Testing keys were generated with:
-        # openssl req -new -keyout tornado/test/test.key -out tornado/test/test.crt -nodes -days 3650 -x509
+        # openssl req -new -keyout tornado/test/test.key \
+        #                     -out tornado/test/test.crt -nodes -days 3650 -x509
         module_dir = os.path.dirname(__file__)
         return dict(
             certfile=os.path.join(module_dir, 'test', 'test.crt'),
index 8827209c1b5ccf11e9ca17a2a2caf8debc98002b..91d9abd1c7cea75019d8c298894a7ce96a89ac3e 100644 (file)
@@ -733,7 +733,8 @@ class RequestHandler(object):
         if not isinstance(chunk, (bytes, unicode_type, dict)):
             message = "write() only accepts bytes, unicode, and dict objects"
             if isinstance(chunk, list):
-                message += ". Lists not accepted for security reasons; see http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.write"
+                message += ". Lists not accepted for security reasons; see " + \
+                    "http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.write"
             raise TypeError(message)
         if isinstance(chunk, dict):
             chunk = escape.json_encode(chunk)
@@ -1735,7 +1736,7 @@ def stream_request_body(cls):
 
     See the `file receiver demo <https://github.com/tornadoweb/tornado/tree/master/demos/file_upload/>`_
     for example usage.
-    """
+    """  # noqa: E501
     if not issubclass(cls, RequestHandler):
         raise TypeError("expected subclass of RequestHandler, got %r", cls)
     cls._stream_request_body = True
@@ -2818,7 +2819,7 @@ class OutputTransform(object):
         pass
 
     def transform_first_chunk(self, status_code, headers, chunk, finishing):
-        # type: (int, httputil.HTTPHeaders, bytes, bool) -> typing.Tuple[int, httputil.HTTPHeaders, bytes]
+        # type: (int, httputil.HTTPHeaders, bytes, bool) -> typing.Tuple[int, httputil.HTTPHeaders, bytes] # noqa: E501
         return status_code, headers, chunk
 
     def transform_chunk(self, chunk, finishing):
@@ -2859,7 +2860,7 @@ class GZipContentEncoding(OutputTransform):
         return ctype.startswith('text/') or ctype in self.CONTENT_TYPES
 
     def transform_first_chunk(self, status_code, headers, chunk, finishing):
-        # type: (int, httputil.HTTPHeaders, bytes, bool) -> typing.Tuple[int, httputil.HTTPHeaders, bytes]
+        # type: (int, httputil.HTTPHeaders, bytes, bool) -> typing.Tuple[int, httputil.HTTPHeaders, bytes] # noqa: E501
         # TODO: can/should this type be inherited from the superclass?
         if 'Vary' in headers:
             headers['Vary'] += ', Accept-Encoding'
index d24a05f16bb94209652d1bf9ee1c654763fdaecd..4b1b220e788916ab27639be5c85e28002fcfcb87 100644 (file)
@@ -539,7 +539,8 @@ class _PerMessageDeflateCompressor(object):
             self._compressor = None
 
     def _create_compressor(self):
-        return zlib.compressobj(self._compression_level, zlib.DEFLATED, -self._max_wbits, self._mem_level)
+        return zlib.compressobj(self._compression_level,
+                                zlib.DEFLATED, -self._max_wbits, self._mem_level)
 
     def compress(self, data):
         compressor = self._compressor or self._create_compressor()