Enable FLY Ruff rules.

This commit is contained in:
Andrey Rakhmatullin 2025-01-01 21:50:02 +05:00
parent 838ff99f37
commit f44ca39fa2
3 changed files with 6 additions and 23 deletions

View File

@ -222,6 +222,8 @@ extend-select = [
"D",
# flake8-future-annotations
"FA",
# flynt
"FLY",
# refurb
"FURB",
# isort

View File

@ -34,7 +34,7 @@ def _path_safe(text: str) -> str:
# as we replace some letters we can get collision for different slots
# add we add unique part
unique_slot = hashlib.md5(text.encode("utf8")).hexdigest() # noqa: S324
return "-".join([pathable_slot, unique_slot])
return f"{pathable_slot}-{unique_slot}"
class QueueProtocol(Protocol):

View File

@ -891,14 +891,7 @@ class TestSettingsPolicyByName(TestCase):
# test parsing without space(s) after the comma
settings1 = Settings(
{
"REFERRER_POLICY": ",".join(
[
"some-custom-unknown-policy",
POLICY_SAME_ORIGIN,
POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN,
"another-custom-unknown-policy",
]
)
"REFERRER_POLICY": f"some-custom-unknown-policy,{POLICY_SAME_ORIGIN},{POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN},another-custom-unknown-policy"
}
)
mw1 = RefererMiddleware(settings1)
@ -907,13 +900,7 @@ class TestSettingsPolicyByName(TestCase):
# test parsing with space(s) after the comma
settings2 = Settings(
{
"REFERRER_POLICY": ", ".join(
[
POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN,
"another-custom-unknown-policy",
POLICY_UNSAFE_URL,
]
)
"REFERRER_POLICY": f"{POLICY_STRICT_ORIGIN_WHEN_CROSS_ORIGIN}, another-custom-unknown-policy, {POLICY_UNSAFE_URL}"
}
)
mw2 = RefererMiddleware(settings2)
@ -922,13 +909,7 @@ class TestSettingsPolicyByName(TestCase):
def test_multiple_policy_tokens_all_invalid(self):
settings = Settings(
{
"REFERRER_POLICY": ",".join(
[
"some-custom-unknown-policy",
"another-custom-unknown-policy",
"yet-another-custom-unknown-policy",
]
)
"REFERRER_POLICY": "some-custom-unknown-policy,another-custom-unknown-policy,yet-another-custom-unknown-policy"
}
)
with self.assertRaises(RuntimeError):