forked from genewildish/Mainline
style: apply ruff auto-fixes across codebase
- Fix import sorting (isort) across all engine modules - Fix SIM105 try-except-pass patterns (contextlib.suppress) - Fix nested with statements in tests - Fix unused loop variables Run 'uv run pytest' to verify tests still pass.
This commit is contained in:
@@ -4,15 +4,15 @@ Font loading, text rasterization, word-wrap, gradient coloring, headline block a
|
||||
Depends on: config, terminal, sources, translate.
|
||||
"""
|
||||
|
||||
import re
|
||||
import random
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
from PIL import Image, ImageDraw, ImageFont
|
||||
|
||||
from engine import config
|
||||
from engine.sources import NO_UPPER, SCRIPT_FONTS, SOURCE_LANGS
|
||||
from engine.terminal import RST
|
||||
from engine.sources import SCRIPT_FONTS, SOURCE_LANGS, NO_UPPER
|
||||
from engine.translate import detect_location_language, translate_headline
|
||||
|
||||
# ─── GRADIENT ─────────────────────────────────────────────
|
||||
@@ -62,7 +62,7 @@ def font():
|
||||
f"No primary font selected. Add .otf/.ttf/.ttc files to {config.FONT_DIR}."
|
||||
)
|
||||
key = (config.FONT_PATH, config.FONT_INDEX, config.FONT_SZ)
|
||||
if _FONT_OBJ is None or _FONT_OBJ_KEY != key:
|
||||
if _FONT_OBJ is None or key != _FONT_OBJ_KEY:
|
||||
_FONT_OBJ = ImageFont.truetype(
|
||||
config.FONT_PATH, config.FONT_SZ, index=config.FONT_INDEX
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user