From 9cff4b2295a98b171dabaeb0ebe3545aeb84b52a Mon Sep 17 00:00:00 2001 From: haeussma <83341109+haeussma@users.noreply.github.com> Date: Fri, 19 Apr 2024 17:15:20 +0200 Subject: [PATCH] added _validate_annotation pattern to avoid duplicate generation of validate annotation method --- .gitignore | 2 +- sdRDM/generator/updater.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 68bc17f..7a18fca 100644 --- a/.gitignore +++ b/.gitignore @@ -99,7 +99,7 @@ ipython_config.py # This is especially recommended for binary packages to ensure reproducibility, and is more # commonly ignored for libraries. # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control -#poetry.lock +poetry.lock # pdm # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. diff --git a/sdRDM/generator/updater.py b/sdRDM/generator/updater.py index e1877e1..3da52c9 100644 --- a/sdRDM/generator/updater.py +++ b/sdRDM/generator/updater.py @@ -12,6 +12,7 @@ FUNCTION_PATTERN = r"def ([a-zA-Z0-9_]+)\(" FUNCTION_NAME_PATTERN = r"def ([a-zA-Z0-9_]+)\(" XML_PARSER_PATTERN = r"_parse_raw_xml_data" +ANNOTATION_PATTERN = r"_validate_annotation" class ModuleOrder(Enum): @@ -72,9 +73,11 @@ def extract_custom_methods(rendered_class: str, path: str) -> List[str]: if not re.findall(FUNCTION_PATTERN, line): continue - # Ignore adder functions + # Ignore adder, annotation, and xml parser functions if re.findall(ADDER_PATTERN, line): continue + elif re.findall(ANNOTATION_PATTERN, line): + continue elif re.findall(XML_PARSER_PATTERN, line): continue