refactor: look up core file versions by slot

This commit is contained in:
Abdessamad Derraz committed 2026-11-05 11:58:10 +01:00
1 parent 5ef7a9fabf
commit 55b63dbc6e
3 files changed
+58 -4

No files matched your search

+11
View File
@@ -1004,6 +1004,17 @@ def same_slot_entries(files: list, name: str, path: str) -> list[dict]:
]
def slot_index(files: list) -> dict[tuple[str, str], list[dict]]:
"""A profile's entries keyed by (name, path), as same_slot_entries
matches them: one pass, then one lookup per extra."""
index: dict[tuple[str, str], list[dict]] = {}
for entry in files or []:
if isinstance(entry, dict):
name = entry.get("name")
index.setdefault((name, entry.get("path") or name), []).append(entry)
return index
def extra_alternatives(fe: dict, profiles: Mapping | None) -> list[dict]:
"""The versions the extra's own profile accepts at the extra's slot."""
if not profiles: