From bbfd096f4f3b951da91081d06c275c74e6bc1bf3 Mon Sep 17 00:00:00 2001 From: fydot Date: Thu, 3 Sep 2015 01:46:42 +0800 Subject: [PATCH] Remove useless lines, noused import and variable --- tornado/concurrent.py | 1 + tornado/gen.py | 4 +++- tornado/locale.py | 5 +++-- tornado/testing.py | 1 - tornado/web.py | 5 ++--- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/tornado/concurrent.py b/tornado/concurrent.py index f491bd09..7a83b507 100644 --- a/tornado/concurrent.py +++ b/tornado/concurrent.py @@ -373,6 +373,7 @@ def run_on_executor(*args, **kwargs): def run_on_executor_decorator(fn): executor = kwargs.get("executor", "executor") io_loop = kwargs.get("io_loop", "io_loop") + @functools.wraps(fn) def wrapper(self, *args, **kwargs): callback = kwargs.pop("callback", None) diff --git a/tornado/gen.py b/tornado/gen.py index 78ddce75..5c7dc019 100644 --- a/tornado/gen.py +++ b/tornado/gen.py @@ -106,7 +106,8 @@ except ImportError: try: from inspect import isawaitable # py35+ except ImportError: - def isawaitable(x): return False + def isawaitable(x): + return False try: import builtins # py3 @@ -222,6 +223,7 @@ def _make_coroutine_wrapper(func, replace_callback): # to be used with 'await'. if hasattr(types, 'coroutine'): func = types.coroutine(func) + @functools.wraps(func) def wrapper(*args, **kwargs): future = TracebackFuture() diff --git a/tornado/locale.py b/tornado/locale.py index a1f2b81b..8310c4d4 100644 --- a/tornado/locale.py +++ b/tornado/locale.py @@ -61,6 +61,7 @@ _supported_locales = frozenset([_default_locale]) _use_gettext = False CONTEXT_SEPARATOR = "\x04" + def get(*locale_codes): """Returns the closest match for the given locale codes. @@ -504,8 +505,8 @@ class GettextLocale(Locale): if plural_message is not None: assert count is not None msgs_with_ctxt = ("%s%s%s" % (context, CONTEXT_SEPARATOR, message), - "%s%s%s" % (context, CONTEXT_SEPARATOR, plural_message), - count) + "%s%s%s" % (context, CONTEXT_SEPARATOR, plural_message), + count) result = self.ngettext(*msgs_with_ctxt) if CONTEXT_SEPARATOR in result: # Translation not found diff --git a/tornado/testing.py b/tornado/testing.py index f3cfb773..304f22db 100644 --- a/tornado/testing.py +++ b/tornado/testing.py @@ -40,7 +40,6 @@ import re import signal import socket import sys -import types try: from cStringIO import StringIO # py2 diff --git a/tornado/web.py b/tornado/web.py index b6197ce7..dcdbb963 100644 --- a/tornado/web.py +++ b/tornado/web.py @@ -649,7 +649,6 @@ class RequestHandler(object): value = self.get_cookie(name) return get_signature_key_version(value) - def redirect(self, url, permanent=False, status=None): """Sends a redirect to the given (optionally relative) URL. @@ -2010,8 +2009,8 @@ class _RequestDispatcher(httputil.HTTPMessageDelegate): # except handler, and we cannot easily access the IOLoop here to # call add_future (because of the requirement to remain compatible # with WSGI) - f = self.handler._execute(transforms, *self.path_args, - **self.path_kwargs) + self.handler._execute(transforms, *self.path_args, + **self.path_kwargs) # If we are streaming the request body, then execute() is finished # when the handler has prepared to receive the body. If not, # it doesn't matter when execute() finishes (so we return None)