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)
try:
from inspect import isawaitable # py35+
except ImportError:
- def isawaitable(x): return False
+ def isawaitable(x):
+ return False
try:
import builtins # py3
# to be used with 'await'.
if hasattr(types, 'coroutine'):
func = types.coroutine(func)
+
@functools.wraps(func)
def wrapper(*args, **kwargs):
future = TracebackFuture()
_use_gettext = False
CONTEXT_SEPARATOR = "\x04"
+
def get(*locale_codes):
"""Returns the closest match for the given locale codes.
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
import signal
import socket
import sys
-import types
try:
from cStringIO import StringIO # py2
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.
# 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)