if not request_cookie:
raise AuthError("Missing OAuth request token cookie")
handler.clear_cookie("_oauth_request_token")
- cookie_key, cookie_secret = [
+ cookie_key, cookie_secret = (
base64.b64decode(escape.utf8(i)) for i in request_cookie.split("|")
- ]
+ )
if cookie_key != request_key:
raise AuthError("Request token does not match cookie")
token = dict(
instance_cache = cls._async_clients()
if instance_cache is not None and io_loop in instance_cache:
return instance_cache[io_loop]
- instance = super(AsyncHTTPClient, cls).__new__(cls, **kwargs) # type: ignore
+ instance = super().__new__(cls, **kwargs) # type: ignore
# Make sure the instance knows which cache to remove itself from.
# It can't simply call _async_clients() because we may be in
# __new__(AsyncHTTPClient) but instance.__class__ may be
AsyncHTTPClient.configure("tornado.curl_httpclient.CurlAsyncHTTPClient")
"""
- super(AsyncHTTPClient, cls).configure(impl, **kwargs)
+ super().configure(impl, **kwargs)
class HTTPRequest:
.. versionadded:: 4.4.2
"""
cookiedict = {}
- for chunk in cookie.split(str(";")):
- if str("=") in chunk:
- key, val = chunk.split(str("="), 1)
+ for chunk in cookie.split(";"):
+ if "=" in chunk:
+ key, val = chunk.split("=", 1)
else:
# Assume an empty name per
# https://bugzilla.mozilla.org/show_bug.cgi?id=169091
- key, val = str(""), chunk
+ key, val = "", chunk
key, val = key.strip(), val.strip()
if key or val:
# unquote using Python's algorithm.
impl = import_object(impl)
if isinstance(impl, type) and not issubclass(impl, BaseAsyncIOLoop):
raise RuntimeError("only AsyncIOLoop is allowed when asyncio is available")
- super(IOLoop, cls).configure(impl, **kwargs)
+ super().configure(impl, **kwargs)
@staticmethod
def instance() -> "IOLoop":
if impl.configurable_base() is not base:
# The impl class is itself configurable, so recurse.
return impl(*args, **init_kwargs)
- instance = super(Configurable, cls).__new__(impl)
+ instance = super().__new__(impl)
# initialize vs __init__ chosen for compatibility with AsyncHTTPClient
# singleton magic. If we get rid of that we can switch to __init__
# here too.