Skip to content

Commit aa72183

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 6a74aae commit aa72183

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

jupyter_server/gateway/gateway_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@ def load_connection_args(self, **kwargs):
630630

631631
return kwargs
632632

633-
def update_cookies(self, headers: "HTTPHeaders") -> None:
633+
def update_cookies(self, headers: HTTPHeaders) -> None:
634634
"""Update cookies from response headers"""
635635

636636
if not self.accept_cookies:
@@ -639,7 +639,7 @@ def update_cookies(self, headers: "HTTPHeaders") -> None:
639639
# Get individual Set-Cookie headers in list form. This handles multiple cookies
640640
# that are otherwise comma-separated in the header and will break the parsing logic
641641
# if only headers.get() is used.
642-
cookie_headers = headers.get_list('Set-Cookie')
642+
cookie_headers = headers.get_list("Set-Cookie")
643643
if not cookie_headers:
644644
return
645645

tests/test_gateway.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from jupyter_core.utils import ensure_async
1717
from tornado.concurrent import Future
1818
from tornado.httpclient import HTTPRequest, HTTPResponse
19-
from tornado.httputil import HTTPServerRequest, HTTPHeaders
19+
from tornado.httputil import HTTPHeaders, HTTPServerRequest
2020
from tornado.queues import Queue
2121
from tornado.web import HTTPError
2222
from traitlets import Int, Unicode
@@ -372,6 +372,7 @@ def test_gateway_request_timeout_pad_option(
372372

373373
GatewayClient.clear_instance()
374374

375+
375376
@pytest.mark.parametrize(
376377
"accept_cookies,expire_arg,expire_param,existing_cookies",
377378
[
@@ -399,8 +400,9 @@ def test_gateway_request_with_expiring_cookies(
399400
cookie_value = "SERVERID=1234567; Path=/; HttpOnly"
400401
if expire_arg == "expires":
401402
# Convert expire_param to a string in the format of "Expires: <date>" (RFC 7231)
402-
expire_param = (datetime.now(tz=timezone.utc) + timedelta(seconds=expire_param))\
403-
.strftime("%a, %d %b %Y %H:%M:%S GMT")
403+
expire_param = (datetime.now(tz=timezone.utc) + timedelta(seconds=expire_param)).strftime(
404+
"%a, %d %b %Y %H:%M:%S GMT"
405+
)
404406
cookie_value = f"SERVERID=1234567; Path=/; expires={expire_param}; HttpOnly"
405407
elif expire_arg == "Max-Age":
406408
cookie_value = f"SERVERID=1234567; Path=/; Max-Age={expire_param}; HttpOnly"
@@ -421,7 +423,7 @@ def test_gateway_request_with_expiring_cookies(
421423
connection_args = GatewayClient.instance().load_connection_args(**args)
422424

423425
if not accept_cookies or test_expiration:
424-
# The first condition ensure the response cookie is not accepted,
426+
# The first condition ensure the response cookie is not accepted,
425427
# the second condition ensures that the cookie is not accepted if it is expired.
426428
assert "SERVERID" not in connection_args["headers"].get("Cookie")
427429
else:

0 commit comments

Comments
 (0)