Skip to content

Commit 9476253

Browse files
Appease the linter
Signed-off-by: Richo Healey <[email protected]>
1 parent abdd6f1 commit 9476253

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

python/ray/dashboard/optional_utils.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,16 @@ def is_browser_request(req: Request) -> bool:
138138
return req.headers["User-Agent"].startswith("Mozilla")
139139

140140
def has_sec_fetch_headers(req: Request) -> bool:
141-
"""Checks for the existance of any of the sec-fetch-* headers.
142-
143-
"""
144-
return any(h in req.headers for h in ("Sec-Fetch-Mode", "Sec-Fetch-Dest", "Sec-Fetch-Site", "Sec-Fetch-User"))
141+
"""Checks for the existance of any of the sec-fetch-* headers"""
142+
return any(
143+
h in req.headers
144+
for h in (
145+
"Sec-Fetch-Mode",
146+
"Sec-Fetch-Dest",
147+
"Sec-Fetch-Site",
148+
"Sec-Fetch-User"
149+
)
150+
)
145151

146152
def deny_browser_requests() -> Callable:
147153
"""Reject any requests that appear to be made by a browser"""

python/ray/dashboard/tests/test_dashboard.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ def dashboard_available():
463463
if time.time() > start_time + timeout_seconds:
464464
raise Exception("Timed out while testing.")
465465

466+
466467
def test_deny_fetch_requests(enable_test_module, ray_start_with_dashboard):
467468
assert wait_until_server_available(ray_start_with_dashboard["webui_url"]) is True
468469
webui_url = ray_start_with_dashboard["webui_url"]
@@ -492,12 +493,8 @@ def dashboard_available():
492493
webui_url + "/api/jobs/",
493494
json={"entrypoint": "ls"},
494495
headers={
495-
"User-Agent": (
496-
"Spurious User Agent"
497-
),
498-
"Sec-Fetch-Site": (
499-
"cross-site"
500-
)
496+
"User-Agent": ("Spurious User Agent"),
497+
"Sec-Fetch-Site": ("cross-site"),
501498
},
502499
)
503500
with pytest.raises(HTTPError):

0 commit comments

Comments
 (0)