WIP: Expand the developer documentation #27
1 changed files with 22 additions and 7 deletions
|
@ -66,7 +66,7 @@ class Annotator(Walk):
|
||||||
return
|
return
|
||||||
self.check_leadership()
|
self.check_leadership()
|
||||||
self.remove_empty_families()
|
self.remove_empty_families()
|
||||||
self.family_names()
|
self.family_description()
|
||||||
if self.objectspace.modes_level:
|
if self.objectspace.modes_level:
|
||||||
self.modes = {
|
self.modes = {
|
||||||
name: Mode(idx)
|
name: Mode(idx)
|
||||||
|
@ -75,6 +75,11 @@ class Annotator(Walk):
|
||||||
self.default_variable_mode = self.objectspace.default_variable_mode
|
self.default_variable_mode = self.objectspace.default_variable_mode
|
||||||
self.default_family_mode = self.objectspace.default_family_mode
|
self.default_family_mode = self.objectspace.default_family_mode
|
||||||
self.change_modes()
|
self.change_modes()
|
||||||
|
else:
|
||||||
|
for family in self.get_families():
|
||||||
|
self.valid_mode(family)
|
||||||
|
for variable in self.get_variables():
|
||||||
|
self.valid_mode(variable)
|
||||||
self.convert_help()
|
self.convert_help()
|
||||||
|
|
||||||
def check_leadership(self) -> None:
|
def check_leadership(self) -> None:
|
||||||
|
@ -113,11 +118,15 @@ class Annotator(Walk):
|
||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def family_names(self) -> None:
|
def family_description(self) -> None:
|
||||||
"""Set doc, path, ... to family"""
|
|
||||||
for family in self.get_families():
|
for family in self.get_families():
|
||||||
if not family.description:
|
if not family.description:
|
||||||
family.description = family.name
|
family.description = family.name
|
||||||
|
if family.type == 'dynamic' and isinstance(family.dynamic, VariableCalculation):
|
||||||
|
path = self.objectspace.paths.get_full_path(family.dynamic.variable,
|
||||||
|
family.path,
|
||||||
|
)
|
||||||
|
self.objectspace.informations.add(family.path, "dynamic_variable", path)
|
||||||
|
|
||||||
def change_modes(self):
|
def change_modes(self):
|
||||||
"""change the mode of variables"""
|
"""change the mode of variables"""
|
||||||
|
@ -159,10 +168,16 @@ class Annotator(Walk):
|
||||||
) -> None:
|
) -> None:
|
||||||
modes_level = self.objectspace.modes_level
|
modes_level = self.objectspace.modes_level
|
||||||
if self._has_mode(obj) and obj.mode not in modes_level:
|
if self._has_mode(obj) and obj.mode not in modes_level:
|
||||||
|
if modes_level:
|
||||||
msg = _(
|
msg = _(
|
||||||
f'mode "{obj.mode}" for "{obj.name}" is not a valid mode, '
|
f'mode "{obj.mode}" for "{obj.name}" is not a valid mode, '
|
||||||
f"valid modes are {modes_level}"
|
f"valid modes are {modes_level}"
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
msg = _(
|
||||||
|
f'mode "{obj.mode}" for "{obj.name}" is not a valid mode, '
|
||||||
|
f"no modes are available"
|
||||||
|
)
|
||||||
raise DictConsistencyError(msg, 71, obj.xmlfiles)
|
raise DictConsistencyError(msg, 71, obj.xmlfiles)
|
||||||
|
|
||||||
def _set_default_mode(
|
def _set_default_mode(
|
||||||
|
|
Loading…
Reference in a new issue