* Case insensitivity for extranetwork mapping lookup.

This commit is contained in:
Antonio Cordero Balcazar
2026-05-16 20:51:50 +02:00
parent b971ea8d37
commit 51da23465b
2 changed files with 16 additions and 2 deletions
+14
View File
@@ -92,6 +92,20 @@ class PPPExtraNetworkMappings:
+ self.cached_mappings.__sizeof__()
)
def get_mapping(self, key: str) -> PPPENMapping | None:
"""
Get an extra network mapping by key.
Args:
key (str): The key of the extra network mapping in the format "kind:name".
Returns:
PPPENMapping | None: The extra network mapping if found, or None if not found
"""
for k, v in self.extranetwork_mappings.items():
if k.lower() == key.lower():
return v
return None
def refresh_extranetwork_mappings(
self,
debug_level: DEBUG_LEVEL,
+2 -2
View File
@@ -1570,13 +1570,13 @@ class TreeProcessor(lark.visitors.Interpreter):
compiled_extra_triggers = None
if is_mapping:
found = self.state.extranetwork_mappings_obj.cached_mappings.get(extnet_id, None)
# we assume the conditions do not change inside the prompt
# we assume the conditions do not change inside the prompt (although they could in some circumstances)
found_in_cache = found is not None
if found is None:
found_mappings: list[PPPENMappingVariant] = []
else_mapping = None
if self.state.extranetwork_mappings_obj:
enmapping = self.state.extranetwork_mappings_obj.extranetwork_mappings.get(extnet_id, None)
enmapping = self.state.extranetwork_mappings_obj.get_mapping(extnet_id)
if enmapping:
for v in enmapping.variants:
cond = str(v.condition) if v.condition is not None else None