From fc2551a8d2dbae8d1cd5a3115396e48b3baf3150 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sun, 17 Jan 2021 18:04:49 +0100 Subject: [PATCH] get_variable_obj => get_variable --- src/rougail/annotator/check.py | 4 ++-- src/rougail/annotator/condition.py | 4 ++-- src/rougail/annotator/family.py | 2 +- src/rougail/annotator/fill.py | 4 ++-- src/rougail/annotator/group.py | 2 +- src/rougail/annotator/service.py | 2 +- src/rougail/annotator/variable.py | 2 +- src/rougail/objspace.py | 2 +- src/rougail/path.py | 6 +++--- 9 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/rougail/annotator/check.py b/src/rougail/annotator/check.py index d8853f12e..11074ff7c 100644 --- a/src/rougail/annotator/check.py +++ b/src/rougail/annotator/check.py @@ -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) diff --git a/src/rougail/annotator/condition.py b/src/rougail/annotator/condition.py index abe21ed9c..261b3920a 100644 --- a/src/rougail/annotator/condition.py +++ b/src/rougail/annotator/condition.py @@ -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) diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 2c06b63f1..d60cb9504 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -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 ' diff --git a/src/rougail/annotator/fill.py b/src/rougail/annotator/fill.py index 8b23254be..d30799ac7 100644 --- a/src/rougail/annotator/fill.py +++ b/src/rougail/annotator/fill.py @@ -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: diff --git a/src/rougail/annotator/group.py b/src/rougail/annotator/group.py index b696373b6..bce242a20 100644 --- a/src/rougail/annotator/group.py +++ b/src/rougail/annotator/group.py @@ -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: diff --git a/src/rougail/annotator/service.py b/src/rougail/annotator/service.py index bc207e686..5494020b0 100644 --- a/src/rougail/annotator/service.py +++ b/src/rougail/annotator/service.py @@ -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 diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 61a902cb2..df7337cd7 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -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}') diff --git a/src/rougail/objspace.py b/src/rougail/objspace.py index ad6b79597..f24f27853 100644 --- a/src/rougail/objspace.py +++ b/src/rougail/objspace.py @@ -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] diff --git a/src/rougail/path.py b/src/rougail/path.py index 429ba8ee1..49fbaea4e 100644 --- a/src/rougail/path.py +++ b/src/rougail/path.py @@ -113,9 +113,9 @@ class Path: variableobj=variableobj, ) - def get_variable_obj(self, - name: str, - ) -> 'Variable': # pylint: disable=C0111 + def get_variable(self, + name: str, + ) -> 'Variable': # pylint: disable=C0111 variable, suffix = self._get_variable(name, with_suffix=True) if suffix: raise DictConsistencyError(_(f"{name} is a dynamic variable"), 36)