mirror of
https://github.com/mwisnowski/mtg_python_deckbuilder.git
synced 2025-12-17 08:00:13 +01:00
fix(lint): improved type checking and code maintainability
This commit is contained in:
parent
83fe527979
commit
40023e93b8
62 changed files with 187 additions and 197 deletions
|
|
@ -88,12 +88,12 @@ def _candidate_pool_for_role(builder, role: str) -> List[Tuple[str, dict]]:
|
|||
# Sort by edhrecRank then manaValue
|
||||
try:
|
||||
from . import builder_utils as bu
|
||||
sorted_df = bu.sort_by_priority(pool, ["edhrecRank", "manaValue"]) # type: ignore[attr-defined]
|
||||
sorted_df = bu.sort_by_priority(pool, ["edhrecRank", "manaValue"])
|
||||
# Prefer-owned bias
|
||||
if getattr(builder, "prefer_owned", False):
|
||||
owned = getattr(builder, "owned_card_names", None)
|
||||
if owned:
|
||||
sorted_df = bu.prefer_owned_first(sorted_df, {str(n).lower() for n in owned}) # type: ignore[attr-defined]
|
||||
sorted_df = bu.prefer_owned_first(sorted_df, {str(n).lower() for n in owned})
|
||||
except Exception:
|
||||
sorted_df = pool
|
||||
|
||||
|
|
@ -363,7 +363,7 @@ def enforce_bracket_compliance(builder, mode: str = "prompt") -> Dict:
|
|||
break
|
||||
# Rank candidates: break the most combos first; break ties by worst desirability
|
||||
cand_names = list(freq.keys())
|
||||
cand_names.sort(key=lambda nm: (-int(freq.get(nm, 0)), _score(nm)), reverse=False) # type: ignore[arg-type]
|
||||
cand_names.sort(key=lambda nm: (-int(freq.get(nm, 0)), _score(nm)), reverse=False)
|
||||
removed_any = False
|
||||
for nm in cand_names:
|
||||
if nm in blocked:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue