From 7bb737e5ccac1af94bf313e3af4b59528da261cc Mon Sep 17 00:00:00 2001 From: gigamac Date: Fri, 30 Aug 2024 15:23:46 +0100 Subject: [PATCH] feat(parameterised): job needs have parameterised names apply parameterised name cleansing to job needs --- mermaid_entry.py | 3 ++- yaml_objects/job/JobNeed.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mermaid_entry.py b/mermaid_entry.py index 62231cb..0be4a65 100644 --- a/mermaid_entry.py +++ b/mermaid_entry.py @@ -15,7 +15,8 @@ pipeline_objects = Pipeline('mermaid-pipeline',openFile.open_file(args.input_file)) mermaid_flow_objects = MermaidFlowChartObjects().build(pipeline_objects) mermaid_flowchart = FlowChart(mermaid_flow_objects, Orient.top2bottom) -document = iter(write_document(mermaid_flowchart, Orient.top2bottom)) +document = write_document(mermaid_flowchart, Orient.top2bottom) +# document = iter(document) output_file_name = args.input_file.split('/')[-1].split('.')[0] i = 1 diff --git a/yaml_objects/job/JobNeed.py b/yaml_objects/job/JobNeed.py index 3e00de6..091dd82 100644 --- a/yaml_objects/job/JobNeed.py +++ b/yaml_objects/job/JobNeed.py @@ -1,13 +1,14 @@ import re from file_functions.tryNext import tryNext from match_functions.identify_line import identify_line +from match_functions.special_characters import Specials from pipeline.Parsers import ParserFunction class JobNeeds: job_needs = [] current_line = '' - PATTERN_JOB_SPEC = '^ {{{}}} {{0,}}- job: ([a-z,\-,0-9]*)' + PATTERN_JOB_SPEC = '^ {{{}}} {{0,}}- job: ([",\[,\],\$,a-z,\-,\_,\.,0-9, ]{{1,}})' PATTERN_JOB = '^ {{{}}} {{1,}}- ([a-z,\-,0-9]*)[^:]{{0,1}}' PATTERN_JOB_ARTIFACT_TF = '^ {{{}}} {{1,}}artifacts: ([a-z]*)$' PATTERN_JOB_OPTIONAL_TF = '^ {{{}}} {{1,}}optional: ([a-z]*)$' @@ -15,7 +16,7 @@ class JobNeeds: job_needs_parsers = [] def job_spec(self,matching_rule, job_need, current_line): - job_name = re.search(matching_rule,current_line).group(1) + job_name = Specials().cleanse_special_characters(re.search(matching_rule,current_line).group(1)) print(job_name) job_done = None if job_need.needed_job != '':