style: add future annotations

This commit is contained in:
2026-04-10 12:01:24 +02:00
parent 1b48386132
commit c505e117d1
41 changed files with 86 additions and 2 deletions
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-06 08:19:54
Description: The entry point.
"""
from __future__ import annotations
from .cli import run
if __name__ == "__main__":
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-06 08:21:01
Description: Credential authenticators for third-party provider APIs
"""
from __future__ import annotations
from lrx_cli.authenticators.qqmusic import QQMusicAuthenticator
from .base import BaseAuthenticator
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-05 03:18:14
Description: Base class for credential authenticators.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Optional
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-05 03:36:44
Description: A dummy authenticator that does nothing and always reports as configured.
"""
from __future__ import annotations
from .base import BaseAuthenticator
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-05 03:27:56
Description: Musixmatch authenticator — token management, 401 retry, and cooldown.
"""
from __future__ import annotations
import time
from typing import Optional
from urllib.parse import urlencode
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-05 03:47:30
Description: QQ Music API authenticator - currently only a proxy.
"""
from __future__ import annotations
from typing import Optional
import httpx
from loguru import logger
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-05 03:18:14
Description: Spotify authenticator — TOTP-based access token via SP_DC cookie.
"""
from __future__ import annotations
import hashlib
import hmac
import struct
+2
View File
@@ -5,6 +5,8 @@ Description: SQLite-based lyric cache with per-source slot rows, TTL expiration,
and schema migrations (confidence versioning + slot migration).
"""
from __future__ import annotations
import json
import sqlite3
import hashlib
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-26 02:04:39
Description: CLI interface.
"""
from __future__ import annotations
import sys
import time
import os
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-25 10:17:56
Description: Global configuration constants, typed config dataclasses, and logger setup.
"""
from __future__ import annotations
import dataclasses
import os
import sys
+2
View File
@@ -5,6 +5,8 @@ Description: Core orchestrator — coordinates fetchers with cache-aware fallbac
Also handles enrichers & authenticators & …
"""
from __future__ import annotations
import asyncio
from typing import Optional
from loguru import logger
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-31 06:09:11
Description: Metadata enrichment pipeline
"""
from __future__ import annotations
from loguru import logger
from .base import BaseEnricher
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-31 06:11:27
Description: Enricher that reads metadata from audio file tags.
"""
from __future__ import annotations
from typing import Optional
from loguru import logger
from mutagen._file import File, FileType
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-31 06:08:16
Description: Base class for metadata enrichers.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Optional
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-31 06:08:44
Description: Enricher that parses metadata from the audio file path.
"""
from __future__ import annotations
import re
from typing import Optional
from loguru import logger
+2 -1
View File
@@ -4,8 +4,9 @@ Date: 2026-04-05 02:13:49
Description: Musixmatch metadata enricher (matcher.track.get by Spotify track ID).
"""
from typing import Optional
from __future__ import annotations
from typing import Optional
from loguru import logger
from .base import BaseEnricher
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-25 02:33:26
Description: Fetcher pipeline — registry and types.
"""
from __future__ import annotations
from typing import Literal, Optional
from loguru import logger
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-25 02:33:26
Description: Base fetcher class and common interfaces.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from typing import Optional
from dataclasses import dataclass
+2 -1
View File
@@ -8,10 +8,11 @@ Description: Cache-search fetcher — cross-album fuzzy lookup in the local cach
albums or is played from different players.
"""
from __future__ import annotations
from typing import Optional
from loguru import logger
from .base import BaseFetcher, FetchResult
from .selection import SearchCandidate, select_best
from ..models import TrackMeta, LyricResult, CacheStatus
+2
View File
@@ -7,6 +7,8 @@ Description: Local fetcher — reads lyrics from .lrc sidecar files or embedded
2. Embedded lyrics in audio metadata (FLAC, MP3 USLT/SYLT tags)
"""
from __future__ import annotations
from typing import Optional
from loguru import logger
from mutagen._file import File
+2
View File
@@ -5,6 +5,8 @@ Description: LRCLIB fetcher — queries lrclib.net for synced/plain lyrics.
Requires complete track metadata (artist, title, album, duration).
"""
from __future__ import annotations
import httpx
from loguru import logger
from urllib.parse import urlencode
+2
View File
@@ -5,6 +5,8 @@ Description: LRCLIB search fetcher — fuzzy search via lrclib.net /api/search.
Used when metadata is incomplete (no album or duration) but title is available.
"""
from __future__ import annotations
import asyncio
import httpx
from loguru import logger
+2
View File
@@ -11,6 +11,8 @@ Description: Musixmatch fetchers (desktop API, anonymous or usertoken auth).
musixmatch — metadata search + best-candidate fallback
"""
from __future__ import annotations
import json
from typing import Optional
from loguru import logger
+2
View File
@@ -7,6 +7,8 @@ Description: Netease Cloud Music fetcher.
retrieving lyrics. No authentication required.
"""
from __future__ import annotations
import asyncio
import httpx
from loguru import logger
+2
View File
@@ -9,6 +9,8 @@ Description: QQ Music fetcher via self-hosted API proxy.
Search → pick best match → fetch LRC lyrics.
"""
from __future__ import annotations
import asyncio
from loguru import logger
+2
View File
@@ -8,6 +8,8 @@ Description: Shared candidate-selection logic for search-based fetchers.
proximity, and sync status.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Generic, Optional, TypeVar
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-25 10:43:21
Description: Spotify fetcher — obtains synced lyrics via Spotify's internal color-lyrics API.
"""
from __future__ import annotations
from loguru import logger
from .base import BaseFetcher, FetchResult
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-25 21:54:01
Description: LRC parsing, modeling, and serialization helpers.
"""
from __future__ import annotations
from abc import ABC, abstractmethod
from dataclasses import dataclass, field
import re
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-03-25 04:44:15
Description: MPRIS integration for fetching track metadata.
"""
from __future__ import annotations
import asyncio
from dbus_next.aio.message_bus import MessageBus
from dbus_next.constants import BusType
+2
View File
@@ -5,6 +5,8 @@ Description: Shared text normalization utilities for fuzzy matching.
Used by cache key generation, cache search, and candidate selection scoring.
"""
from __future__ import annotations
import re
import unicodedata
+2
View File
@@ -1,3 +1,5 @@
from __future__ import annotations
from .session import WatchCoordinator
__all__ = ["WatchCoordinator"]
+3
View File
@@ -4,6 +4,9 @@ Date: 2026-04-10 08:14:58
Description: Unix-socket control channel for communicating with a running watch session.
"""
from __future__ import annotations
import asyncio
import json
from pathlib import Path
+3
View File
@@ -4,6 +4,9 @@ Date: 2026-04-10 08:14:41
Description: Debounced lyric fetch orchestration for watch session.
"""
from __future__ import annotations
import asyncio
from typing import Awaitable, Callable, Optional
+3
View File
@@ -4,6 +4,9 @@ Date: 2026-04-10 08:14:27
Description: Player discovery, state monitoring, and active-player selection for watch mode.
"""
from __future__ import annotations
from dataclasses import dataclass
from typing import Callable, Optional
import asyncio
+2
View File
@@ -8,6 +8,8 @@ Description: Watch orchestration with explicit MVVM role boundaries.
- Coordinator: WatchCoordinator wires services and drives async workflows.
"""
from __future__ import annotations
import asyncio
from dataclasses import asdict
from typing import Optional
+3
View File
@@ -4,6 +4,9 @@ Date: 2026-04-10 08:13:35
Description: Playback position tracking utilities for watch mode.
"""
from __future__ import annotations
import asyncio
import time
from typing import Awaitable, Callable, Optional
+2
View File
@@ -1,5 +1,7 @@
"""Output abstraction types for watch mode rendering."""
from __future__ import annotations
from abc import ABC, abstractmethod
from bisect import bisect_right
from dataclasses import dataclass
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-10 08:15:17
Description: Pipe output implementation for watch mode.
"""
from __future__ import annotations
from bisect import bisect_right
from dataclasses import dataclass
import sys
+2
View File
@@ -4,6 +4,8 @@ Date: 2026-04-10 08:15:31
Description: Print output implementation for watch mode — one shot per track.
"""
from __future__ import annotations
import sys
from . import BaseOutput, WatchState, WatchStatus