mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-26 19:05:13 +00:00
style: turn on ruff UP and B rules and fix every finding
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
|
||||
@@ -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})
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user