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
# let's replace the target by the an object
try:
check.target = self.objectspace.paths.get_variable_obj(check.target)
check.target = self.objectspace.paths.get_variable(check.target)
except DictConsistencyError as err:
if err.errno == 36:
xmlfiles = self.objectspace.display_xmlfiles(check.xmlfiles)
@ -63,7 +63,7 @@ class CheckAnnotator:
param_option_indexes.append(idx)
else:
# 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)
for idx in param_option_indexes:
check.param.pop(idx)

View file

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

View file

@ -169,7 +169,7 @@ class FamilyAnnotator:
for family in families.family.values():
if 'dynamic' not in vars(family):
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:
xmlfiles = self.objectspace.display_xmlfiles(family.xmlfiles)
msg = _(f'dynamic family "{family.name}" must be linked '

View file

@ -52,7 +52,7 @@ class FillAnnotator:
raise DictConsistencyError(msg, 26)
# 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
value = self.objectspace.value(fill.xmlfiles)
@ -97,7 +97,7 @@ class FillAnnotator:
path, suffix = self.objectspace.paths.get_variable_path(param.text,
fill.namespace,
)
param.text = self.objectspace.paths.get_variable_obj(path)
param.text = self.objectspace.paths.get_variable(path)
if suffix:
param.suffix = suffix
except DictConsistencyError as err:

View file

@ -25,7 +25,7 @@ class GroupAnnotator:
cache_paths = {}
for group in self.objectspace.space.constraints.group:
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:
leader_family_path = cache_paths[leader_fullname]
else:

View file

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

View file

@ -147,7 +147,7 @@ class VariableAnnotator:
continue
if hasattr(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'):
xmlfiles = self.objectspace.display_xmlfiles(separator.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}", '
f'now it is in "{space.path}" in {xmlfiles}')
raise DictConsistencyError(msg, 47)
return self.paths.get_variable_obj(name)
return self.paths.get_variable(name)
children = getattr(space, child.tag, {})
if name in children:
return children[name]

View file

@ -113,7 +113,7 @@ class Path:
variableobj=variableobj,
)
def get_variable_obj(self,
def get_variable(self,
name: str,
) -> 'Variable': # pylint: disable=C0111
variable, suffix = self._get_variable(name, with_suffix=True)