From 623d234addd1e523cc2f2d96827a9b0b111ff2c8 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 26 Jan 2021 18:32:22 +0100 Subject: [PATCH] remove RENAME_ATTIBUTES --- src/rougail/annotator/family.py | 17 ++++++++--------- src/rougail/annotator/variable.py | 8 ++------ 2 files changed, 10 insertions(+), 15 deletions(-) diff --git a/src/rougail/annotator/family.py b/src/rougail/annotator/family.py index 0034787b0..7891b4035 100644 --- a/src/rougail/annotator/family.py +++ b/src/rougail/annotator/family.py @@ -3,7 +3,6 @@ from ..i18n import _ from ..error import DictConsistencyError from ..utils import normalize_family -from .variable import RENAME_ATTIBUTES #mode order is important @@ -64,9 +63,8 @@ class FamilyAnnotator: for family in families.family.values(): if not hasattr(family, 'description'): family.description = family.name - for key, value in RENAME_ATTIBUTES.items(): - setattr(family, value, getattr(family, key)) - setattr(family, key, None) + family.doc = family.description + del family.description family.name = normalize_family(family.name) def change_modes(self): @@ -157,8 +155,9 @@ class FamilyAnnotator: """ for families in self.objectspace.space.variables.values(): for family in families.family.values(): - if hasattr(family, 'help'): - if not hasattr(family, 'information'): - family.information = self.objectspace.information(family.xmlfiles) - family.information.help = family.help - del family.help + if not hasattr(family, 'help'): + continue + if not hasattr(family, 'information'): + family.information = self.objectspace.information(family.xmlfiles) + family.information.help = family.help + del family.help diff --git a/src/rougail/annotator/variable.py b/src/rougail/annotator/variable.py index 7335af795..9db259921 100644 --- a/src/rougail/annotator/variable.py +++ b/src/rougail/annotator/variable.py @@ -39,9 +39,6 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'], } -RENAME_ATTIBUTES = {'description': 'doc'} - - class VariableAnnotator: # pylint: disable=R0903 """Annotate variable """ @@ -99,9 +96,8 @@ class VariableAnnotator: # pylint: disable=R0903 del variable.value[idx] if not variable.value: del variable.value - for key, value in RENAME_ATTIBUTES.items(): - setattr(variable, value, getattr(variable, key)) - setattr(variable, key, None) + variable.doc = variable.description + del variable.description if variable_type == 'follower': if variable.multi is True: variable.multi = 'submulti'