Commit e098b275 authored by Floreal Cabanettes's avatar Floreal Cabanettes
Browse files

Make prefix private : _prefix

parent c951f908
......@@ -43,7 +43,7 @@ class Component(object):
TRACE_FILE_NAME = "trace.txt"
def __init__(self):
self.prefix = "default"
self._prefix = "default"
self.params_order = []
self.output_directory = None
self.description = None
......@@ -505,10 +505,10 @@ class Component(object):
return exec_path
def get_nameid(self):
return self.__class__.__name__ + "." + self.prefix
return self.__class__.__name__ + "." + self._prefix
def __eq__(self, other):
return self.__class__ == other.__class__ and self.prefix == other.prefix
return self.__class__ == other.__class__ and self._prefix == other._prefix
def __getattribute__(self, attr):
# an IOobject is a specific object defined by the presence of the dump_path attribute
......
......@@ -765,14 +765,14 @@ class Workflow(threading.Thread):
# build the object and define required field
cmpt_object = getattr(my_pckge, component_name)()
cmpt_object.output_directory = self.get_component_output_directory(component_name, component_prefix)
cmpt_object.prefix = component_prefix
cmpt_object._prefix = component_prefix
if kwargs: cmpt_object.define_parameters(**kwargs)
else: cmpt_object.define_parameters(*args)
# external components
else :
cmpt_object = self.external_components[component_name]()
cmpt_object.output_directory = self.get_component_output_directory(component_name, component_prefix)
cmpt_object.prefix = component_prefix
cmpt_object._prefix = component_prefix
# can't use positional arguments with external components
cmpt_object.define_parameters(**kwargs)
......@@ -791,7 +791,7 @@ class Workflow(threading.Thread):
else:
if self._component_is_duplicated(cmpt_object):
raise ValueError("Component " + cmpt_object.__class__.__name__ + " with prefix " +
cmpt_object.prefix + " already exist in this pipeline!")
cmpt_object._prefix + " already exist in this pipeline!")
self.component_nameids[cmpt_object.get_nameid()] = None
self.components_to_exec = []
self.components = []
......@@ -803,13 +803,13 @@ class Workflow(threading.Thread):
elif not self.component_nameids_is_init and not self.dynamic_component_present:
if self._component_is_duplicated(cmpt_object):
raise ValueError("Component " + cmpt_object.__class__.__name__ + " with prefix " +
cmpt_object.prefix + " already exist in this pipeline!")
cmpt_object._prefix + " already exist in this pipeline!")
self.components_to_exec.append(cmpt_object)
self.components.append(cmpt_object)
else:
if self._component_is_duplicated(cmpt_object):
raise ValueError("Component " + cmpt_object.__class__.__name__ + " with prefix " +
cmpt_object.prefix + " already exist in this pipeline!")
cmpt_object._prefix + " already exist in this pipeline!")
self.component_nameids[cmpt_object.get_nameid()] = None
return cmpt_object
......
Markdown is supported
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