Make the codebase mypy-clean, drop dead media_utils and Pillow, rewrite README
This commit is contained in:
@@ -6,6 +6,7 @@ value (e.g. rating 87 → tag "Hodnocení/87"), while the folder groups it
|
||||
"""
|
||||
|
||||
import re
|
||||
from collections.abc import Callable
|
||||
|
||||
|
||||
def rating_band(rating: int) -> str:
|
||||
@@ -18,14 +19,14 @@ def rating_band(rating: int) -> str:
|
||||
return f"{low}–{high} %"
|
||||
|
||||
|
||||
def _decade_band(value) -> str:
|
||||
def _decade_band(value: str) -> str:
|
||||
"""``decade_band`` transform: pull the leading integer and bucket it."""
|
||||
match = re.search(r"\d+", str(value))
|
||||
return rating_band(int(match.group())) if match else str(value)
|
||||
|
||||
|
||||
# Named value transforms usable from the tag schema (config-driven, extensible).
|
||||
TAG_TRANSFORMS = {
|
||||
TAG_TRANSFORMS: dict[str | None, Callable[[str], str]] = {
|
||||
None: str,
|
||||
"identity": str,
|
||||
"decade_band": _decade_band,
|
||||
|
||||
Reference in New Issue
Block a user