remove RENAME_ATTIBUTES

This commit is contained in:
Emmanuel Garette 2021-01-26 18:32:22 +01:00
parent 8eb3b99f27
commit 623d234add
2 changed files with 10 additions and 15 deletions

View File

@ -3,7 +3,6 @@
from ..i18n import _ from ..i18n import _
from ..error import DictConsistencyError from ..error import DictConsistencyError
from ..utils import normalize_family from ..utils import normalize_family
from .variable import RENAME_ATTIBUTES
#mode order is important #mode order is important
@ -64,9 +63,8 @@ class FamilyAnnotator:
for family in families.family.values(): for family in families.family.values():
if not hasattr(family, 'description'): if not hasattr(family, 'description'):
family.description = family.name family.description = family.name
for key, value in RENAME_ATTIBUTES.items(): family.doc = family.description
setattr(family, value, getattr(family, key)) del family.description
setattr(family, key, None)
family.name = normalize_family(family.name) family.name = normalize_family(family.name)
def change_modes(self): def change_modes(self):
@ -157,8 +155,9 @@ class FamilyAnnotator:
""" """
for families in self.objectspace.space.variables.values(): for families in self.objectspace.space.variables.values():
for family in families.family.values(): for family in families.family.values():
if hasattr(family, 'help'): if not hasattr(family, 'help'):
if not hasattr(family, 'information'): continue
family.information = self.objectspace.information(family.xmlfiles) if not hasattr(family, 'information'):
family.information.help = family.help family.information = self.objectspace.information(family.xmlfiles)
del family.help family.information.help = family.help
del family.help

View File

@ -39,9 +39,6 @@ FORCE_CHOICE = {'schedule': ['none', 'daily', 'weekly', 'monthly'],
} }
RENAME_ATTIBUTES = {'description': 'doc'}
class VariableAnnotator: # pylint: disable=R0903 class VariableAnnotator: # pylint: disable=R0903
"""Annotate variable """Annotate variable
""" """
@ -99,9 +96,8 @@ class VariableAnnotator: # pylint: disable=R0903
del variable.value[idx] del variable.value[idx]
if not variable.value: if not variable.value:
del variable.value del variable.value
for key, value in RENAME_ATTIBUTES.items(): variable.doc = variable.description
setattr(variable, value, getattr(variable, key)) del variable.description
setattr(variable, key, None)
if variable_type == 'follower': if variable_type == 'follower':
if variable.multi is True: if variable.multi is True:
variable.multi = 'submulti' variable.multi = 'submulti'