[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2022-01-31 22:17:10 +00:00
parent 757053a9ec
commit 6633f8ef28
2 changed files with 6 additions and 10 deletions

View File

@@ -1520,14 +1520,10 @@ class UserUrlHandler(BaseHandler):
# if request is expecting JSON, assume it's an API request and fail with 503 # if request is expecting JSON, assume it's an API request and fail with 503
# because it won't like the redirect to the pending page # because it won't like the redirect to the pending page
if ( if get_accepted_mimetype(
get_accepted_mimetype( self.request.headers.get('Accept', ''),
self.request.headers.get('Accept', ''), choices=['application/json', 'text/html'],
choices=['application/json', 'text/html'], ) == 'application/json' or 'api' in user_path.split('/'):
)
== 'application/json'
or 'api' in user_path.split('/')
):
self._fail_api_request(user_name, server_name) self._fail_api_request(user_name, server_name)
return return
@@ -1609,7 +1605,7 @@ class UserUrlHandler(BaseHandler):
if redirects: if redirects:
self.log.warning("Redirect loop detected on %s", self.request.uri) self.log.warning("Redirect loop detected on %s", self.request.uri)
# add capped exponential backoff where cap is 10s # add capped exponential backoff where cap is 10s
await asyncio.sleep(min(1 * (2 ** redirects), 10)) await asyncio.sleep(min(1 * (2**redirects), 10))
# rewrite target url with new `redirects` query value # rewrite target url with new `redirects` query value
url_parts = urlparse(target) url_parts = urlparse(target)
query_parts = parse_qs(url_parts.query) query_parts = parse_qs(url_parts.query)

View File

@@ -493,7 +493,7 @@ class SingleUserNotebookAppMixin(Configurable):
i, i,
RETRIES, RETRIES,
) )
await asyncio.sleep(min(2 ** i, 16)) await asyncio.sleep(min(2**i, 16))
else: else:
break break
else: else: