style: apply ruff format across backend + scripts (line-length 100)

Mechanical, whole-tree `ruff format` pass — no behaviour change. Recorded in
.git-blame-ignore-revs (next commit) so git blame skips it.
This commit is contained in:
2026-08-23 07:43:06 +02:00
parent 434a98d6ed
commit b1832afd18
217 changed files with 3149 additions and 1744 deletions
+80 -7
View File
@@ -19,6 +19,7 @@ Rules (user-approved "option b"):
an otherwise normal title is left alone.
4. Collapse repeated punctuation (!!! → !) and whitespace.
"""
import re
import unicodedata
@@ -47,15 +48,87 @@ _REPEAT_PUNCT = re.compile(r"([!?.,\-])\1{1,}")
# Short function words → lowercased when the title is de-shouted (proper title-case style).
_SHORT_LOWER = {
"to", "the", "and", "of", "a", "an", "in", "on", "at", "for", "or", "vs", "the",
"és", "az", "egy", "meg", "nem", "hogy", "de", "ha", "der", "die", "das", "und", "von",
"to",
"the",
"and",
"of",
"a",
"an",
"in",
"on",
"at",
"for",
"or",
"vs",
"the",
"és",
"az",
"egy",
"meg",
"nem",
"hogy",
"de",
"ha",
"der",
"die",
"das",
"und",
"von",
}
# Kept as-is even when everything else is de-shouted (common acronyms; compared lowercased).
_ACRONYMS = {
"ps", "ai", "pc", "tv", "hd", "4k", "8k", "uk", "eu", "us", "usa", "gta", "rpg", "fps",
"diy", "vr", "ar", "id", "ok", "faq", "nasa", "fbi", "cia", "ceo", "amd", "pdf", "usb",
"gps", "api", "dj", "mc", "suv", "gpu", "cpu", "ssd", "hdmi", "led", "ufo", "dna", "nba",
"nfl", "asmr", "pov", "diy", "wtf", "lol", "rtx", "gtx", "ios", "mmo", "vip", "hp",
"ps",
"ai",
"pc",
"tv",
"hd",
"4k",
"8k",
"uk",
"eu",
"us",
"usa",
"gta",
"rpg",
"fps",
"diy",
"vr",
"ar",
"id",
"ok",
"faq",
"nasa",
"fbi",
"cia",
"ceo",
"amd",
"pdf",
"usb",
"gps",
"api",
"dj",
"mc",
"suv",
"gpu",
"cpu",
"ssd",
"hdmi",
"led",
"ufo",
"dna",
"nba",
"nfl",
"asmr",
"pov",
"diy",
"wtf",
"lol",
"rtx",
"gtx",
"ios",
"mmo",
"vip",
"hp",
}
@@ -98,7 +171,7 @@ def normalize_title(raw: str | None) -> str | None:
if shouting: # ensure the first letter is capitalized (a leading function word got lowered)
for i, ch in enumerate(t):
if ch.isalpha():
t = t[:i] + ch.upper() + t[i + 1:]
t = t[:i] + ch.upper() + t[i + 1 :]
break
# Nothing survived cleaning: fall back to the prefix+hashtag-stripped text (so neither the
# stats prefix nor the SEO hashtags are resurrected). Only use the untouched raw when no prefix