style: turn on ruff UP and B rules and fix every finding

This commit is contained in:
imSp4rky
2026-11-25 16:34:09 -07:00
parent 1a63076df2
commit d8058a3610
264 changed files with 2950 additions and 2966 deletions
+1 -3
View File
@@ -1,7 +1,5 @@
from __future__ import annotations
from typing import Optional
import pytest
from unshackle.core.utilities import as_requested
@@ -20,5 +18,5 @@ from unshackle.core.utilities import as_requested
([], "en", ""),
],
)
def test_as_requested(tokens: list[str], orig_token: Optional[str], expected: str) -> None:
def test_as_requested(tokens: list[str], orig_token: str | None, expected: str) -> None:
assert as_requested(tokens, orig_token) == expected
@@ -11,7 +11,7 @@ from __future__ import annotations
import inspect
import logging
from pathlib import Path
from typing import Any, Optional, cast
from typing import Any, cast
import pytest
import requests
@@ -97,7 +97,7 @@ def run(
monkeypatch: pytest.MonkeyPatch,
caplog: pytest.LogCaptureFixture,
episodes: dict,
service: Optional[FakeService] = None,
service: FakeService | None = None,
to_end: bool = False,
**flags: Any,
) -> Any:
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Sequence
from collections.abc import Sequence
import pytest
@@ -1,7 +1,5 @@
from __future__ import annotations
from typing import Optional
import pytest
from unshackle.core.wire import original_audio_ids
@@ -14,7 +12,7 @@ class FakeTrack:
class FakeTitle:
def __init__(self, language: Optional[str]) -> None:
def __init__(self, language: str | None) -> None:
self.language = language
@@ -1,6 +1,6 @@
from __future__ import annotations
from typing import Optional, Sequence
from collections.abc import Sequence
import pytest
from langcodes import Language
@@ -22,7 +22,7 @@ from unshackle.core.utilities import ServiceTag, resolve_sort_langs
([], "ja", []),
],
)
def test_resolve_sort_langs(tokens: Sequence[str], original: Optional[str], expected: list[str]) -> None:
def test_resolve_sort_langs(tokens: Sequence[str], original: str | None, expected: list[str]) -> None:
assert resolve_sort_langs(tokens, original) == expected
+1 -1
View File
@@ -17,7 +17,7 @@ def selection(**flags: Any) -> TrackSelection:
"""A TrackSelection with every filter off but the given flags."""
off: dict[str, Any] = {}
for flag in fields(TrackSelection):
off[flag.name] = [] if str(flag.type).startswith("list") else None if "Optional" in str(flag.type) else False
off[flag.name] = None if "None" in str(flag.type) else [] if str(flag.type).startswith("list") else False
return TrackSelection(**{**off, **flags})