This commit is contained in:
Emmanuel Garette 2021-01-23 21:21:45 +01:00
parent f5c7220930
commit 1d33414e6a
4 changed files with 21 additions and 10 deletions

View File

@ -1,7 +1,7 @@
"""Annotate dictionaries
"""
from .group import GroupAnnotator
from .service import ServiceAnnotator, ERASED_ATTRIBUTES
from .service import ServiceAnnotator
from .variable import VariableAnnotator, CONVERT_OPTION
from .check import CheckAnnotator
from .value import ValueAnnotator
@ -30,4 +30,4 @@ class SpaceAnnotator: # pylint: disable=R0903
ValueAnnotator(objectspace)
__all__ = ('SpaceAnnotator', 'ERASED_ATTRIBUTES', 'CONVERT_OPTION', 'modes')
__all__ = ('SpaceAnnotator', 'CONVERT_OPTION', 'modes')

View File

@ -46,6 +46,8 @@ class FamilyAnnotator:
self.convert_help()
def family_names(self) -> None:
"""Set doc, path, ... to family
"""
for families in self.objectspace.space.variables.values():
families.doc = families.name
families.path = families.name

View File

@ -1,5 +1,8 @@
class ValueAnnotator:
"""Annotate check
"""Annotate value
"""
class ValueAnnotator: # pylint: disable=R0903
"""Annotate value
"""
def __init__(self,
objectspace,
@ -10,6 +13,8 @@ class ValueAnnotator:
self.convert_value()
def convert_value(self) -> None:
"""convert value
"""
for families in self.objectspace.space.variables.values():
for family in families.family.values():
for variable in family.variable.values():
@ -23,8 +28,8 @@ class ValueAnnotator:
else:
self._convert_value(variable)
def _convert_value(self,
variable,
@staticmethod
def _convert_value(variable,
variable_type: str=None,
) -> None:
if not hasattr(variable, 'value'):

View File

@ -2,12 +2,14 @@
flattened XML specific
"""
from .config import Config
from .annotator import ERASED_ATTRIBUTES, CONVERT_OPTION
from .annotator import CONVERT_OPTION
from .objspace import RootRougailObject
FUNC_TO_DICT = []
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'values', 'multi', 'default_multi', 'properties', 'validators', 'min_number', 'max_number')
ATTRIBUTES_ORDER = ('name', 'doc', 'default', 'values', 'multi', 'default_multi', 'properties',
'validators', 'min_number', 'max_number',
)
class Root(): # pylint: disable=R0903
@ -159,7 +161,8 @@ class Common:
self.text = text
self.elt.reflector_object = self
def populate_properties(self, child):
@staticmethod
def populate_properties(child) -> str:
"""Populate properties
"""
assert child.type == 'calculation'
@ -193,7 +196,8 @@ class Common:
if key == 'properties':
value = self.properties_to_string()
elif key == 'validators':
value = '[' + ', '.join([self.calculation_value(val, ['ParamSelfOption()']) for val in value]) + ']'
value = '[' + ', '.join([self.calculation_value(val, ['ParamSelfOption()']) \
for val in value]) + ']'
elif key == 'values':
if value[0].type == 'calculation':
value = value[0].name.reflector_object.get()