From 41fab0f5f6a71f6d6d907b04592a691c942ce6a5 Mon Sep 17 00:00:00 2001 From: pyth0n1c Date: Mon, 6 Jan 2025 13:14:58 -0800 Subject: [PATCH] Fix regex to step matching before hitting | character which may occur WITHOUT whitespace being present. Ensure that any CSV or MLMODEL file written to the app ends in the appropriate datetime stamp. --- contentctl/objects/lookup.py | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/contentctl/objects/lookup.py b/contentctl/objects/lookup.py index 245b926a..5fcb18db 100644 --- a/contentctl/objects/lookup.py +++ b/contentctl/objects/lookup.py @@ -86,9 +86,9 @@ def fix_lookup_path(cls, data:Any, info: ValidationInfo)->Any: @staticmethod def get_lookups(text_field: str, director:DirectorOutputDto, ignore_lookups:set[str]=LOOKUPS_TO_IGNORE)->list[Lookup]: # Comprehensively match all kinds of lookups, including inputlookup and outputlookup - inputLookupsToGet = set(re.findall(r'inputlookup(?:\s*(?:(?:append|strict|start|max)\s*=\s*(?:true|t|false|f))){0,4}\s+([^\s]+)', text_field)) - outputLookupsToGet = set(re.findall(r'outputlookup(?:\s*(?:(?:append|create_empty|override_if_empty|max|key_field|allow_updates|createinapp|create_context|output_format)\s*=\s*[^\s]*))*\s+([^\s]+)',text_field)) - lookupsToGet = set(re.findall(r'(?:(?FilePath: 2. Only apply the datetime stamp if it is version > 1. This makes the code a small fraction more complicated, but preserves longstanding CSV that have not been modified in a long time ''' - if self.version > 1: - return pathlib.Path(f"{self.filename.stem}.{self.lookup_type}") #type: ignore - else: - return pathlib.Path(f"{self.filename.stem}_{self.date.year}{self.date.month:02}{self.date.day:02}.{self.lookup_type}") #type: ignore + return pathlib.Path(f"{self.filename.stem}_{self.date.year}{self.date.month:02}{self.date.day:02}.{self.lookup_type}") #type: ignore class CSVLookup(FileBackedLookup): lookup_type:Literal[Lookup_Type.csv]