mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-16 15:40:12 +01:00
feat: optimize must-have controls and commander catalog
This commit is contained in:
parent
b7bfc4ca09
commit
3877890889
23 changed files with 1150 additions and 87 deletions
|
|
@ -2,10 +2,23 @@ from __future__ import annotations
|
|||
|
||||
from typing import Any, Dict, Iterable, List, Optional
|
||||
from deck_builder import builder_constants as bc
|
||||
from .build_utils import owned_set as owned_set_helper
|
||||
from .combo_utils import detect_for_summary as _detect_for_summary
|
||||
|
||||
|
||||
def _owned_set_helper() -> set[str]:
|
||||
try:
|
||||
from .build_utils import owned_set as _owned_set # type: ignore
|
||||
|
||||
return _owned_set()
|
||||
except Exception:
|
||||
try:
|
||||
from . import owned_store
|
||||
|
||||
return {str(n).strip().lower() for n in owned_store.get_names()}
|
||||
except Exception:
|
||||
return set()
|
||||
|
||||
|
||||
def _sanitize_tag_list(values: Iterable[Any]) -> List[str]:
|
||||
cleaned: List[str] = []
|
||||
for raw in values or []: # type: ignore[arg-type]
|
||||
|
|
@ -148,7 +161,7 @@ def summary_ctx(
|
|||
synergy_tags.append(label)
|
||||
versions = det.get("versions", {} if include_versions else None)
|
||||
return {
|
||||
"owned_set": owned_set_helper(),
|
||||
"owned_set": _owned_set_helper(),
|
||||
"game_changers": bc.GAME_CHANGERS,
|
||||
"combos": combos,
|
||||
"synergies": synergy_tags,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue