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.annotator.variable import Walk
|
||||||
from rougail.convert.object_model import Calculation
|
from rougail.convert.object_model import Calculation
|
||||||
from rougail.utils import NAME_REGEXP
|
from rougail.utils import NAME_REGEXP
|
||||||
|
from rougail.convert.object_model import VariableCalculation
|
||||||
|
|
||||||
|
|
||||||
PROPERTIES = (
|
PROPERTIES = (
|
||||||
|
|
@ -51,8 +52,10 @@ class Annotator(Walk):
|
||||||
|
|
||||||
def __init__(self, objectspace, *args) -> None:
|
def __init__(self, objectspace, *args) -> None:
|
||||||
self.objectspace = objectspace
|
self.objectspace = objectspace
|
||||||
|
if not self.objectspace.paths:
|
||||||
|
return
|
||||||
self.frozen = {}
|
self.frozen = {}
|
||||||
if self.objectspace.paths:
|
self.variables_default_transitive = []
|
||||||
self.convert_leadership()
|
self.convert_leadership()
|
||||||
self.convert_family()
|
self.convert_family()
|
||||||
self.convert_variable()
|
self.convert_variable()
|
||||||
|
|
@ -73,7 +76,7 @@ class Annotator(Walk):
|
||||||
def convert_family(self) -> None:
|
def convert_family(self) -> None:
|
||||||
"""convert families"""
|
"""convert families"""
|
||||||
for family in self.get_families():
|
for family in self.get_families():
|
||||||
self._convert_property(family)
|
self.family_variable_property(family)
|
||||||
# collect for force_default_on_freeze
|
# collect for force_default_on_freeze
|
||||||
if family.hidden:
|
if family.hidden:
|
||||||
if family.hidden is True:
|
if family.hidden is True:
|
||||||
|
|
@ -83,12 +86,12 @@ class Annotator(Walk):
|
||||||
frozen.attribute_name = "frozen"
|
frozen.attribute_name = "frozen"
|
||||||
if frozen.ori_path is None:
|
if frozen.ori_path is None:
|
||||||
frozen.ori_path = family.path
|
frozen.ori_path = family.path
|
||||||
self.set_variable_frozen(
|
self.set_variable_frozen_inside_family(
|
||||||
family.path,
|
family.path,
|
||||||
frozen,
|
frozen,
|
||||||
)
|
)
|
||||||
|
|
||||||
def set_variable_frozen(
|
def set_variable_frozen_inside_family(
|
||||||
self,
|
self,
|
||||||
family_path: str,
|
family_path: str,
|
||||||
frozen: Union[bool, Calculation],
|
frozen: Union[bool, Calculation],
|
||||||
|
|
@ -96,7 +99,7 @@ class Annotator(Walk):
|
||||||
for variable_path in self.objectspace.parents[family_path]:
|
for variable_path in self.objectspace.parents[family_path]:
|
||||||
if variable_path in self.objectspace.families:
|
if variable_path in self.objectspace.families:
|
||||||
# it's a family
|
# it's a family
|
||||||
self.set_variable_frozen(
|
self.set_variable_frozen_inside_family(
|
||||||
variable_path,
|
variable_path,
|
||||||
frozen,
|
frozen,
|
||||||
)
|
)
|
||||||
|
|
@ -121,19 +124,17 @@ class Annotator(Walk):
|
||||||
def convert_variable(self) -> None:
|
def convert_variable(self) -> None:
|
||||||
"""convert variables"""
|
"""convert variables"""
|
||||||
for variable in self.get_variables():
|
for variable in self.get_variables():
|
||||||
if variable.path.startswith("services."):
|
|
||||||
continue
|
|
||||||
if variable.type == "symlink":
|
if variable.type == "symlink":
|
||||||
continue
|
continue
|
||||||
self._convert_variable_property(variable)
|
self.convert_variable_property(variable)
|
||||||
|
|
||||||
def _convert_variable_property(
|
def convert_variable_property(
|
||||||
self,
|
self,
|
||||||
variable: dict,
|
variable: dict,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""convert properties"""
|
"""convert properties"""
|
||||||
path = variable.path
|
path = variable.path
|
||||||
self._convert_property(variable)
|
self.family_variable_property(variable)
|
||||||
if variable.hidden:
|
if variable.hidden:
|
||||||
if variable.hidden is True:
|
if variable.hidden is True:
|
||||||
self.frozen[path] = True
|
self.frozen[path] = True
|
||||||
|
|
@ -193,7 +194,7 @@ class Annotator(Walk):
|
||||||
).format(tag)
|
).format(tag)
|
||||||
raise DictConsistencyError(msg, 82, xmlfiles)
|
raise DictConsistencyError(msg, 82, xmlfiles)
|
||||||
|
|
||||||
def _convert_property(
|
def family_variable_property(
|
||||||
self,
|
self,
|
||||||
obj: dict,
|
obj: dict,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
|
|
||||||
|
|
@ -766,8 +766,10 @@ class ParserVariable:
|
||||||
sources,
|
sources,
|
||||||
)
|
)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
raise Exception(
|
raise DictConsistencyError(
|
||||||
f'the {typ} "{path}" in "{display_list(sources)}" has an invalid "{key}": {err}'
|
_('the {0} "{1}" has an invalid "{2}": {3}').format(typ, path, key, err),
|
||||||
|
84,
|
||||||
|
sources,
|
||||||
) from err
|
) from err
|
||||||
continue
|
continue
|
||||||
if not isinstance(value, list):
|
if not isinstance(value, list):
|
||||||
|
|
|
||||||
|
|
@ -489,7 +489,7 @@ class JinjaCalculation(Calculation):
|
||||||
|
|
||||||
class _VariableCalculation(Calculation):
|
class _VariableCalculation(Calculation):
|
||||||
variable: StrictStr
|
variable: StrictStr
|
||||||
propertyerror: Union[Literal["transitive"], bool] = True
|
propertyerror: bool = True,
|
||||||
allow_none: bool = False
|
allow_none: bool = False
|
||||||
optional: bool = False
|
optional: bool = False
|
||||||
|
|
||||||
|
|
@ -775,6 +775,7 @@ class VariableCalculation(_VariableCalculation):
|
||||||
|
|
||||||
class VariablePropertyCalculation(_VariableCalculation):
|
class VariablePropertyCalculation(_VariableCalculation):
|
||||||
attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||||
|
propertyerror: Union[Literal["transitive"], bool] = True
|
||||||
when: Any = undefined
|
when: Any = undefined
|
||||||
when_not: Any = undefined
|
when_not: Any = undefined
|
||||||
description: Optional[StrictStr] = None
|
description: Optional[StrictStr] = None
|
||||||
|
|
@ -817,6 +818,7 @@ class VariablePropertyCalculation(_VariableCalculation):
|
||||||
key="value",
|
key="value",
|
||||||
)
|
)
|
||||||
params["prop"] = self.attribute_name
|
params["prop"] = self.attribute_name
|
||||||
|
func = "variable_to_property"
|
||||||
if objectspace.force_optional and (
|
if objectspace.force_optional and (
|
||||||
not params["value"] or "variable" not in params["value"]
|
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'
|
'the variable "{0}" has an invalid attribute "{1}", "when" and "when_not" cannot set together'
|
||||||
).format(path, self.attribute_name)
|
).format(path, self.attribute_name)
|
||||||
raise DictConsistencyError(msg, 31, variable.xmlfiles)
|
raise DictConsistencyError(msg, 31, variable.xmlfiles)
|
||||||
when = self.when
|
params["when"] = self.when
|
||||||
inverse = False
|
params["inverse"] = False
|
||||||
elif self.when_not is not undefined:
|
elif self.when_not is not undefined:
|
||||||
if self.version == "1.0":
|
if self.version == "1.0":
|
||||||
msg = _(
|
msg = _(
|
||||||
'"when_not" is not allowed in format version 1.0 for attribute "{0}" for variable "{1}"'
|
'"when_not" is not allowed in format version 1.0 for attribute "{0}" for variable "{1}"'
|
||||||
).format(self.attribute_name, path)
|
).format(self.attribute_name, path)
|
||||||
raise DictConsistencyError(msg, 104, variable.xmlfiles)
|
raise DictConsistencyError(msg, 104, variable.xmlfiles)
|
||||||
when = self.when_not
|
params["when"] = self.when_not
|
||||||
inverse = True
|
params["inverse"] = True
|
||||||
else:
|
elif self.propertyerror != "transitive":
|
||||||
if variable.multi:
|
if variable.multi:
|
||||||
when = []
|
params["when"] = []
|
||||||
else:
|
else:
|
||||||
if variable.type != "boolean":
|
if variable.type != "boolean":
|
||||||
msg = _(
|
msg = _(
|
||||||
'"when" or "when_not" is mandatory for the not boolean variable "{0}" in attribute "{1}"'
|
'"when" or "when_not" is mandatory for the not boolean variable "{0}" in attribute "{1}"'
|
||||||
).format(path, self.attribute_name)
|
).format(path, self.attribute_name)
|
||||||
raise DictConsistencyError(msg, 106, variable.xmlfiles)
|
raise DictConsistencyError(msg, 106, variable.xmlfiles)
|
||||||
when = True
|
params["when"] = True
|
||||||
inverse = False
|
params["inverse"] = False
|
||||||
params["when"] = when
|
else:
|
||||||
params["inverse"] = inverse
|
func = "variable_to_property_transitive"
|
||||||
func = "variable_to_property"
|
|
||||||
return {
|
return {
|
||||||
"function": func,
|
"function": func,
|
||||||
"params": params,
|
"params": params,
|
||||||
|
|
|
||||||
|
|
@ -481,6 +481,11 @@ def variable_to_property(*, prop, value=undefined, when, inverse, **kwargs):
|
||||||
return prop if is_match else None
|
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
|
@function_waiting_for_error
|
||||||
def jinja_to_property(prop, description, when, inverse, **kwargs):
|
def jinja_to_property(prop, description, when, inverse, **kwargs):
|
||||||
value = func["jinja_to_function"](**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"] = jinja_to_property
|
||||||
func["jinja_to_property_help"] = jinja_to_property_help
|
func["jinja_to_property_help"] = jinja_to_property_help
|
||||||
func["variable_to_property"] = variable_to_property
|
func["variable_to_property"] = variable_to_property
|
||||||
|
func["variable_to_property_transitive"] = variable_to_property_transitive
|
||||||
func["valid_with_jinja"] = valid_with_jinja
|
func["valid_with_jinja"] = valid_with_jinja
|
||||||
func["normalize_family"] = normalize_family
|
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("basic")
|
||||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
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_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'], 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_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"}))
|
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])
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -10,6 +10,6 @@ except:
|
||||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
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_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'], 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_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])
|
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