Commit 4b833af4 authored by Penom Nom's avatar Penom Nom
Browse files

Skip lines commented.

parent b2a851ca
......@@ -110,36 +110,38 @@ class Workflow(threading.Thread):
i += 1
next_line = workflow_command_lines[i]
line = re.search('(.+)\\\s*$', line).groups()[0] + next_line
component_prefix = "default"
component_name = line.strip().split("self.add_component")[1][1:-1].split(",")[0][1:-1]
arguments = re.search("self.add_component\s*\((.+)\)", line).groups()[0]
named_prefix = re.search("component_prefix\s*=\s*([^,]+)", arguments)
# Component prefix is in named argument
if named_prefix:
component_prefix = named_prefix.groups()[0].strip().strip('"')
# Component prefix is missing or in unamed argument
else :
without_named_args = re.sub( ",?\s*\S+\s*=\s*\S+", "" , arguments) # Discard named arguments
fields = without_named_args.strip(",").split(",")
# Group brackets arguments
args_split_clean = []
current_idx = 0
current_arg = ""
while current_idx < len(fields) :
current_arg = current_arg + fields[current_idx] + ','
open_brackets = current_arg.count("[")
close_brackets = current_arg.count("]")
if open_brackets == close_brackets:
args_split_clean.append( current_arg[:-1] )
current_arg = ""
current_idx += 1
# Find component prefix
if len(args_split_clean) >= 4:
component_prefix = args_split_clean[3].strip().strip('"')
if self._component_is_duplicated(component_name+"."+component_prefix):
raise ValueError("Component " + component_name + " with prefix " +
component_prefix + " already exist in this pipeline!")
self.component_nameids[component_name+"."+component_prefix] = None
# The line is not commented.
if not re.search('^\s*\#', line) :
component_prefix = "default"
component_name = line.strip().split("self.add_component")[1][1:-1].split(",")[0][1:-1]
arguments = re.search("self.add_component\s*\((.+)\)", line).groups()[0]
named_prefix = re.search("component_prefix\s*=\s*([^,]+)", arguments)
# Component prefix is in named argument
if named_prefix:
component_prefix = named_prefix.groups()[0].strip().strip('"')
# Component prefix is missing or in unamed argument
else :
without_named_args = re.sub( ",?\s*\S+\s*=\s*\S+", "" , arguments) # Discard named arguments
fields = without_named_args.strip(",").split(",")
# Group brackets arguments
args_split_clean = []
current_idx = 0
current_arg = ""
while current_idx < len(fields) :
current_arg = current_arg + fields[current_idx] + ','
open_brackets = current_arg.count("[")
close_brackets = current_arg.count("]")
if open_brackets == close_brackets:
args_split_clean.append( current_arg[:-1] )
current_arg = ""
current_idx += 1
# Find component prefix
if len(args_split_clean) >= 4:
component_prefix = args_split_clean[3].strip().strip('"')
if self._component_is_duplicated(component_name+"."+component_prefix):
raise ValueError("Component " + component_name + " with prefix " +
component_prefix + " already exist in this pipeline!")
self.component_nameids[component_name+"."+component_prefix] = None
@staticmethod
def config_parser(arg_lines):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment