get_variable_obj => get_variable

This commit is contained in:
Emmanuel Garette 2021-01-17 18:04:49 +01:00
parent 529bb1ae7d
commit fc2551a8d2
9 changed files with 14 additions and 14 deletions

View File

@ -41,7 +41,7 @@ class CheckAnnotator:
check_name = check.target check_name = check.target
# let's replace the target by the an object # let's replace the target by the an object
try: try:
check.target = self.objectspace.paths.get_variable_obj(check.target) check.target = self.objectspace.paths.get_variable(check.target)
except DictConsistencyError as err: except DictConsistencyError as err:
if err.errno == 36: if err.errno == 36:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
@ -63,7 +63,7 @@ class CheckAnnotator:
param_option_indexes.append(idx) param_option_indexes.append(idx)
else: else:
# let's replace params by the path # let's replace params by the path
param.text = self.objectspace.paths.get_variable_obj(param.text) param.text = self.objectspace.paths.get_variable(param.text)
param_option_indexes.sort(reverse=True) param_option_indexes.sort(reverse=True)
for idx in param_option_indexes: for idx in param_option_indexes:
check.param.pop(idx) check.param.pop(idx)

View File

@ -85,7 +85,7 @@ class Conditionnnotator:
msg = _('target name and source name must be different: ' msg = _('target name and source name must be different: '
f'{condition.source}') f'{condition.source}')
raise DictConsistencyError(msg, 11) raise DictConsistencyError(msg, 11)
target.name = self.objectspace.paths.get_variable_obj(target.name) target.name = self.objectspace.paths.get_variable(target.name)
elif target.type == 'family': elif target.type == 'family':
target.name = self.objectspace.paths.get_family(target.name, target.name = self.objectspace.paths.get_family(target.name,
condition.namespace, condition.namespace,
@ -203,7 +203,7 @@ class Conditionnnotator:
""" """
for condition in self.objectspace.space.constraints.condition: for condition in self.objectspace.space.constraints.condition:
try: try:
condition.source = self.objectspace.paths.get_variable_obj(condition.source) condition.source = self.objectspace.paths.get_variable(condition.source)
except DictConsistencyError as err: except DictConsistencyError as err:
if err.errno == 36: if err.errno == 36:
xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(condition.xmlfiles)

View File

@ -169,7 +169,7 @@ class FamilyAnnotator:
for family in families.family.values(): for family in families.family.values():
if 'dynamic' not in vars(family): if 'dynamic' not in vars(family):
continue continue
family.dynamic = self.objectspace.paths.get_variable_obj(family.dynamic) family.dynamic = self.objectspace.paths.get_variable(family.dynamic)
if not family.dynamic.multi: if not family.dynamic.multi:
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
msg = _(f'dynamic family "{family.name}" must be linked ' msg = _(f'dynamic family "{family.name}" must be linked '

View File

@ -52,7 +52,7 @@ class FillAnnotator:
raise DictConsistencyError(msg, 26) raise DictConsistencyError(msg, 26)
# get the target variable # get the target variable
variable = self.objectspace.paths.get_variable_obj(fill.target) variable = self.objectspace.paths.get_variable(fill.target)
# create an object value # create an object value
value = self.objectspace.value(fill.xmlfiles) value = self.objectspace.value(fill.xmlfiles)
@ -97,7 +97,7 @@ class FillAnnotator:
path, suffix = self.objectspace.paths.get_variable_path(param.text, path, suffix = self.objectspace.paths.get_variable_path(param.text,
fill.namespace, fill.namespace,
) )
param.text = self.objectspace.paths.get_variable_obj(path) param.text = self.objectspace.paths.get_variable(path)
if suffix: if suffix:
param.suffix = suffix param.suffix = suffix
except DictConsistencyError as err: except DictConsistencyError as err:

View File

@ -25,7 +25,7 @@ class GroupAnnotator:
cache_paths = {} cache_paths = {}
for group in self.objectspace.space.constraints.group: for group in self.objectspace.space.constraints.group:
leader_fullname = group.leader leader_fullname = group.leader
leader = self.objectspace.paths.get_variable_obj(leader_fullname) leader = self.objectspace.paths.get_variable(leader_fullname)
if leader_fullname in cache_paths: if leader_fullname in cache_paths:
leader_family_path = cache_paths[leader_fullname] leader_family_path = cache_paths[leader_fullname]
else: else:

View File

@ -180,7 +180,7 @@ class ServiceAnnotator:
variable.mode = None variable.mode = None
variable.type = type_ variable.type = type_
if type_ == 'symlink': if type_ == 'symlink':
variable.opt = self.objectspace.paths.get_variable_obj(value) variable.opt = self.objectspace.paths.get_variable(value)
variable.multi = None variable.multi = None
else: else:
variable.doc = key variable.doc = key

View File

@ -147,7 +147,7 @@ class VariableAnnotator:
continue continue
if hasattr(family.separators, 'separator'): if hasattr(family.separators, 'separator'):
for separator in family.separators.separator: for separator in family.separators.separator:
option = self.objectspace.paths.get_variable_obj(separator.name) option = self.objectspace.paths.get_variable(separator.name)
if hasattr(option, 'separator'): if hasattr(option, 'separator'):
xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles) xmlfiles = self.objectspace.display_xmlfiles(separator.xmlfiles)
msg = _(f'{separator.name} already has a separator in {xmlfiles}') msg = _(f'{separator.name} already has a separator in {xmlfiles}')

View File

@ -319,7 +319,7 @@ class RougailObjSpace:
msg = _(f'Variable was previously create in family "{old_family_name}", ' msg = _(f'Variable was previously create in family "{old_family_name}", '
f'now it is in "{space.path}" in {xmlfiles}') f'now it is in "{space.path}" in {xmlfiles}')
raise DictConsistencyError(msg, 47) raise DictConsistencyError(msg, 47)
return self.paths.get_variable_obj(name) return self.paths.get_variable(name)
children = getattr(space, child.tag, {}) children = getattr(space, child.tag, {})
if name in children: if name in children:
return children[name] return children[name]

View File

@ -113,9 +113,9 @@ class Path:
variableobj=variableobj, variableobj=variableobj,
) )
def get_variable_obj(self, def get_variable(self,
name: str, name: str,
) -> 'Variable': # pylint: disable=C0111 ) -> 'Variable': # pylint: disable=C0111
variable, suffix = self._get_variable(name, with_suffix=True) variable, suffix = self._get_variable(name, with_suffix=True)
if suffix: if suffix:
raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36) raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36)