WIP: Expand the developer documentation #27
34 changed files with 219 additions and 32 deletions
|
|
@ -32,6 +32,7 @@ from rougail.error import DictConsistencyError
|
|||
from rougail.annotator.variable import Walk
|
||||
from rougail.convert.object_model import Calculation
|
||||
from rougail.utils import NAME_REGEXP
|
||||
from rougail.convert.object_model import VariableCalculation
|
||||
|
||||
|
||||
PROPERTIES = (
|
||||
|
|
@ -51,11 +52,13 @@ class Annotator(Walk):
|
|||
|
||||
def __init__(self, objectspace, *args) -> None:
|
||||
self.objectspace = objectspace
|
||||
if not self.objectspace.paths:
|
||||
return
|
||||
self.frozen = {}
|
||||
if self.objectspace.paths:
|
||||
self.convert_leadership()
|
||||
self.convert_family()
|
||||
self.convert_variable()
|
||||
self.variables_default_transitive = []
|
||||
self.convert_leadership()
|
||||
self.convert_family()
|
||||
self.convert_variable()
|
||||
|
||||
def convert_leadership(self) -> None:
|
||||
for variable_path in self.objectspace.leaders:
|
||||
|
|
@ -73,7 +76,7 @@ class Annotator(Walk):
|
|||
def convert_family(self) -> None:
|
||||
"""convert families"""
|
||||
for family in self.get_families():
|
||||
self._convert_property(family)
|
||||
self.family_variable_property(family)
|
||||
# collect for force_default_on_freeze
|
||||
if family.hidden:
|
||||
if family.hidden is True:
|
||||
|
|
@ -83,12 +86,12 @@ class Annotator(Walk):
|
|||
frozen.attribute_name = "frozen"
|
||||
if frozen.ori_path is None:
|
||||
frozen.ori_path = family.path
|
||||
self.set_variable_frozen(
|
||||
self.set_variable_frozen_inside_family(
|
||||
family.path,
|
||||
frozen,
|
||||
)
|
||||
|
||||
def set_variable_frozen(
|
||||
def set_variable_frozen_inside_family(
|
||||
self,
|
||||
family_path: str,
|
||||
frozen: Union[bool, Calculation],
|
||||
|
|
@ -96,7 +99,7 @@ class Annotator(Walk):
|
|||
for variable_path in self.objectspace.parents[family_path]:
|
||||
if variable_path in self.objectspace.families:
|
||||
# it's a family
|
||||
self.set_variable_frozen(
|
||||
self.set_variable_frozen_inside_family(
|
||||
variable_path,
|
||||
frozen,
|
||||
)
|
||||
|
|
@ -121,19 +124,17 @@ class Annotator(Walk):
|
|||
def convert_variable(self) -> None:
|
||||
"""convert variables"""
|
||||
for variable in self.get_variables():
|
||||
if variable.path.startswith("services."):
|
||||
continue
|
||||
if variable.type == "symlink":
|
||||
continue
|
||||
self._convert_variable_property(variable)
|
||||
self.convert_variable_property(variable)
|
||||
|
||||
def _convert_variable_property(
|
||||
def convert_variable_property(
|
||||
self,
|
||||
variable: dict,
|
||||
) -> None:
|
||||
"""convert properties"""
|
||||
path = variable.path
|
||||
self._convert_property(variable)
|
||||
self.family_variable_property(variable)
|
||||
if variable.hidden:
|
||||
if variable.hidden is True:
|
||||
self.frozen[path] = True
|
||||
|
|
@ -193,7 +194,7 @@ class Annotator(Walk):
|
|||
).format(tag)
|
||||
raise DictConsistencyError(msg, 82, xmlfiles)
|
||||
|
||||
def _convert_property(
|
||||
def family_variable_property(
|
||||
self,
|
||||
obj: dict,
|
||||
) -> None:
|
||||
|
|
|
|||
|
|
@ -766,8 +766,10 @@ class ParserVariable:
|
|||
sources,
|
||||
)
|
||||
except ValidationError as err:
|
||||
raise Exception(
|
||||
f'the {typ} "{path}" in "{display_list(sources)}" has an invalid "{key}": {err}'
|
||||
raise DictConsistencyError(
|
||||
_('the {0} "{1}" has an invalid "{2}": {3}').format(typ, path, key, err),
|
||||
84,
|
||||
sources,
|
||||
) from err
|
||||
continue
|
||||
if not isinstance(value, list):
|
||||
|
|
|
|||
|
|
@ -489,7 +489,7 @@ class JinjaCalculation(Calculation):
|
|||
|
||||
class _VariableCalculation(Calculation):
|
||||
variable: StrictStr
|
||||
propertyerror: Union[Literal["transitive"], bool] = True
|
||||
propertyerror: bool = True,
|
||||
allow_none: bool = False
|
||||
optional: bool = False
|
||||
|
||||
|
|
@ -775,6 +775,7 @@ class VariableCalculation(_VariableCalculation):
|
|||
|
||||
class VariablePropertyCalculation(_VariableCalculation):
|
||||
attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||
propertyerror: Union[Literal["transitive"], bool] = True
|
||||
when: Any = undefined
|
||||
when_not: Any = undefined
|
||||
description: Optional[StrictStr] = None
|
||||
|
|
@ -817,6 +818,7 @@ class VariablePropertyCalculation(_VariableCalculation):
|
|||
key="value",
|
||||
)
|
||||
params["prop"] = self.attribute_name
|
||||
func = "variable_to_property"
|
||||
if objectspace.force_optional and (
|
||||
not params["value"] or "variable" not in params["value"]
|
||||
):
|
||||
|
|
@ -834,30 +836,29 @@ class VariablePropertyCalculation(_VariableCalculation):
|
|||
'the variable "{0}" has an invalid attribute "{1}", "when" and "when_not" cannot set together'
|
||||
).format(path, self.attribute_name)
|
||||
raise DictConsistencyError(msg, 31, variable.xmlfiles)
|
||||
when = self.when
|
||||
inverse = False
|
||||
params["when"] = self.when
|
||||
params["inverse"] = False
|
||||
elif self.when_not is not undefined:
|
||||
if self.version == "1.0":
|
||||
msg = _(
|
||||
'"when_not" is not allowed in format version 1.0 for attribute "{0}" for variable "{1}"'
|
||||
).format(self.attribute_name, path)
|
||||
raise DictConsistencyError(msg, 104, variable.xmlfiles)
|
||||
when = self.when_not
|
||||
inverse = True
|
||||
else:
|
||||
params["when"] = self.when_not
|
||||
params["inverse"] = True
|
||||
elif self.propertyerror != "transitive":
|
||||
if variable.multi:
|
||||
when = []
|
||||
params["when"] = []
|
||||
else:
|
||||
if variable.type != "boolean":
|
||||
msg = _(
|
||||
'"when" or "when_not" is mandatory for the not boolean variable "{0}" in attribute "{1}"'
|
||||
).format(path, self.attribute_name)
|
||||
raise DictConsistencyError(msg, 106, variable.xmlfiles)
|
||||
when = True
|
||||
inverse = False
|
||||
params["when"] = when
|
||||
params["inverse"] = inverse
|
||||
func = "variable_to_property"
|
||||
params["when"] = True
|
||||
params["inverse"] = False
|
||||
else:
|
||||
func = "variable_to_property_transitive"
|
||||
return {
|
||||
"function": func,
|
||||
"params": params,
|
||||
|
|
|
|||
|
|
@ -481,6 +481,11 @@ def variable_to_property(*, prop, value=undefined, when, inverse, **kwargs):
|
|||
return prop if is_match else None
|
||||
|
||||
|
||||
def variable_to_property_transitive(*args, **kwargs):
|
||||
# do nothing, if associate variable is not accessible, autolib will raise directly
|
||||
pass
|
||||
|
||||
|
||||
@function_waiting_for_error
|
||||
def jinja_to_property(prop, description, when, inverse, **kwargs):
|
||||
value = func["jinja_to_function"](**kwargs)
|
||||
|
|
@ -516,6 +521,7 @@ func["jinja_to_function"] = jinja_to_function
|
|||
func["jinja_to_property"] = jinja_to_property
|
||||
func["jinja_to_property_help"] = jinja_to_property_help
|
||||
func["variable_to_property"] = variable_to_property
|
||||
func["variable_to_property_transitive"] = variable_to_property_transitive
|
||||
func["valid_with_jinja"] = valid_with_jinja
|
||||
func["normalize_family"] = normalize_family
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.condition": true
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.condition": true
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('../rougail-tests/funcs/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_3 = StrOption(name="variable1", doc="a variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_2), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_4 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property_transitive'], Params((), kwargs={'value': ParamOption(option_3, raisepropertyerror=True), 'prop': ParamValue("disabled")}), help_function=func['variable_to_property_transitive'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive/rougail/00-base.yml'], 'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3, option_4], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('../rougail-tests/funcs/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_2 = StrOption(name="variable1", doc="a variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_1), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_3 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property_transitive'], Params((), kwargs={'value': ParamOption(option_2, raisepropertyerror=True), 'prop': ParamValue("disabled")}), help_function=func['variable_to_property_transitive'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2, option_3])
|
||||
|
|
@ -0,0 +1 @@
|
|||
[]
|
||||
|
|
@ -10,7 +10,7 @@ except:
|
|||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"disabled", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable11/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_3 = StrOption(name="variable", doc="a variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_2, raisepropertyerror=True), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable11/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_2 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"disabled", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_2/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_3 = StrOption(name="variable", doc="a variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property_transitive'], Params((), kwargs={'value': ParamOption(option_2, raisepropertyerror=True), 'prop': ParamValue("disabled")}), help_function=func['variable_to_property_transitive'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_2/rougail/00-base.yml'], 'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
@ -10,6 +10,6 @@ except:
|
|||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"disabled", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable11/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_2 = StrOption(name="variable", doc="a variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_1, raisepropertyerror=True), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable11/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_1 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"disabled", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_2/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_2 = StrOption(name="variable", doc="a variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property_transitive'], Params((), kwargs={'value': ParamOption(option_1, raisepropertyerror=True), 'prop': ParamValue("disabled")}), help_function=func['variable_to_property_transitive'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_2/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": false
|
||||
},
|
||||
"rougail.variable1": {
|
||||
"owner": "default",
|
||||
"value": "disabled"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rougail.condition": false,
|
||||
"rougail.variable1": "disabled"
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": false
|
||||
},
|
||||
"rougail.variable1": {
|
||||
"owner": "default",
|
||||
"value": "disabled"
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
[]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rougail.condition": false,
|
||||
"rougail.variable1": "disabled"
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('../rougail-tests/funcs/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = BoolOption(name="condition", doc="a condition", default=False, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_3/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_3 = StrOption(name="variable1", doc="a variable", default="disabled", properties=frozenset({"mandatory", "standard", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_2), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_3/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_4 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_3, raisepropertyerror=True), 'prop': ParamValue("disabled"), 'when': ParamValue("disabled"), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_3/rougail/00-base.yml'], 'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3, option_4], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('../rougail-tests/funcs/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = BoolOption(name="condition", doc="a condition", default=False, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_3/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_2 = StrOption(name="variable1", doc="a variable", default="disabled", properties=frozenset({"mandatory", "standard", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_1), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_3/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_3 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_2, raisepropertyerror=True), 'prop': ParamValue("disabled"), 'when': ParamValue("disabled"), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_3/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2, option_3])
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.condition": true
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.condition": {
|
||||
"owner": "default",
|
||||
"value": true
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
[]
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.condition": true
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('../rougail-tests/funcs/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_4/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_3 = StrOption(name="variable1", doc="a variable", default="not_disabled", properties=frozenset({"mandatory", "standard", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_2), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_4/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_4 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_3, raisepropertyerror=True), 'prop': ParamValue("disabled"), 'when': ParamValue("disabled"), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_4/rougail/00-base.yml'], 'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3, option_4], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('../rougail-tests/funcs/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = BoolOption(name="condition", doc="a condition", default=True, properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_4/rougail/00-base.yml'], 'type': 'boolean'})
|
||||
option_2 = StrOption(name="variable1", doc="a variable", default="not_disabled", properties=frozenset({"mandatory", "standard", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_1), 'prop': ParamValue("disabled"), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_4/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_3 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((), kwargs={'value': ParamOption(option_2, raisepropertyerror=True), 'prop': ParamValue("disabled"), 'when': ParamValue("disabled"), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'ymlfiles': ['../rougail-tests/structures/04_5disabled_calculation_variable_transitive_4/rougail/00-base.yml'], 'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2, option_3])
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
---
|
||||
version: '1.1'
|
||||
condition:
|
||||
description: a condition
|
||||
default: true
|
||||
disabled: true
|
||||
variable:
|
||||
description: a variable
|
||||
default:
|
||||
variable: _.condition
|
||||
propertyerror: transitive
|
||||
Loading…
Reference in a new issue