simplify: strip first/last char for squadron tag normalization

WT tags are always exactly one decorator char on each side, so a
simple s[1:-1] is clearer than a regex strip.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
deploy
2026-05-29 18:33:28 +00:00
parent f9cced2b39
commit 14430d3850
+4 -2
View File
@@ -1224,8 +1224,10 @@ def transform_to_local_format(api_data: Dict[str, Any]) -> Optional[Dict[str, An
loser_winged = str(replay.get("loser") or "") loser_winged = str(replay.get("loser") or "")
def _normalize_squadron_tag(raw: str) -> str: def _normalize_squadron_tag(raw: str) -> str:
cleaned = re.sub(r'^[^A-Za-z0-9]+|[^A-Za-z0-9]+$', '', raw or "") s = (raw or "").strip()
return cleaned or (raw or "").strip() if len(s) >= 3 and not s[0].isalnum() and not s[-1].isalnum():
s = s[1:-1]
return s or raw or ""
winner_squadron = _normalize_squadron_tag(winner_winged) winner_squadron = _normalize_squadron_tag(winner_winged)
loser_squadron = _normalize_squadron_tag(loser_winged) loser_squadron = _normalize_squadron_tag(loser_winged)