pouet
This commit is contained in:
parent
0c02807775
commit
3f378194ba
8 changed files with 367 additions and 140 deletions
|
@ -46,7 +46,7 @@ def convert_boolean(value: str) -> bool:
|
|||
return True
|
||||
elif value == "false":
|
||||
return False
|
||||
elif value in ['', None]:
|
||||
elif value in ["", None]:
|
||||
return None
|
||||
raise Exception(f'unknown boolean value "{value}"')
|
||||
|
||||
|
@ -61,34 +61,45 @@ CONVERT_OPTION = {
|
|||
"unix_filename": dict(opttype="FilenameOption", example="/tmp/myfile.txt"),
|
||||
"date": dict(opttype="DateOption", example="2000-01-01"),
|
||||
"unix_user": dict(opttype="UsernameOption", example="username"),
|
||||
"ip": dict(opttype="IPOption", initkwargs={"allow_reserved": True}, example="1.1.1.1"),
|
||||
"ip": dict(
|
||||
opttype="IPOption", initkwargs={"allow_reserved": True}, example="1.1.1.1"
|
||||
),
|
||||
"cidr": dict(opttype="IPOption", initkwargs={"cidr": True}, example="1.1.1.0/24"),
|
||||
"netmask": dict(opttype="NetmaskOption", example="255.255.255.0"),
|
||||
"network": dict(opttype="NetworkOption", example="1.1.1.0"),
|
||||
"network_cidr": dict(opttype="NetworkOption", initkwargs={"cidr": True}, example="1.1.1.0/24"),
|
||||
"network_cidr": dict(
|
||||
opttype="NetworkOption", initkwargs={"cidr": True}, example="1.1.1.0/24"
|
||||
),
|
||||
"broadcast": dict(opttype="BroadcastOption", example="1.1.1.255"),
|
||||
"netbios": dict(
|
||||
opttype="DomainnameOption",
|
||||
initkwargs={"type": "netbios", "warnings_only": True},
|
||||
example="example"
|
||||
example="example",
|
||||
),
|
||||
"domainname": dict(
|
||||
opttype="DomainnameOption", initkwargs={"type": "domainname", "allow_ip": False},
|
||||
example="example.net"
|
||||
opttype="DomainnameOption",
|
||||
initkwargs={"type": "domainname", "allow_ip": False},
|
||||
example="example.net",
|
||||
),
|
||||
"hostname": dict(
|
||||
opttype="DomainnameOption", initkwargs={"type": "hostname", "allow_ip": False},
|
||||
example="example"
|
||||
opttype="DomainnameOption",
|
||||
initkwargs={"type": "hostname", "allow_ip": False},
|
||||
example="example",
|
||||
),
|
||||
"web_address": dict(
|
||||
opttype="URLOption", initkwargs={"allow_ip": False, "allow_without_dot": True},
|
||||
example="https://example.net"
|
||||
opttype="URLOption",
|
||||
initkwargs={"allow_ip": False, "allow_without_dot": True},
|
||||
example="https://example.net",
|
||||
),
|
||||
"port": dict(
|
||||
opttype="PortOption", initkwargs={"allow_private": True}, example="111"
|
||||
),
|
||||
"port": dict(opttype="PortOption", initkwargs={"allow_private": True}, example="111"),
|
||||
"mac": dict(opttype="MACOption", example="00:00:00:00:00"),
|
||||
"unix_permissions": dict(
|
||||
opttype="PermissionsOption", initkwargs={"warnings_only": True}, func=int,
|
||||
example="644"
|
||||
opttype="PermissionsOption",
|
||||
initkwargs={"warnings_only": True},
|
||||
func=int,
|
||||
example="644",
|
||||
),
|
||||
"choice": dict(opttype="ChoiceOption", example="a_choice"),
|
||||
#
|
||||
|
@ -100,7 +111,8 @@ class Param(BaseModel):
|
|||
key: str
|
||||
model_config = ConfigDict(extra="forbid")
|
||||
|
||||
def __init__(self,
|
||||
def __init__(
|
||||
self,
|
||||
path,
|
||||
attribute,
|
||||
family_is_dynamic,
|
||||
|
@ -127,12 +139,13 @@ class SuffixParam(Param):
|
|||
type: str
|
||||
suffix: Optional[int] = None
|
||||
|
||||
def __init__(self,
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
if not kwargs['family_is_dynamic']:
|
||||
if not kwargs["family_is_dynamic"]:
|
||||
msg = f'suffix parameter for "{kwargs["attribute"]}" in "{kwargs["path"]}" cannot be set none dynamic family'
|
||||
raise DictConsistencyError(msg, 10, kwargs['xmlfiles'])
|
||||
raise DictConsistencyError(msg, 10, kwargs["xmlfiles"])
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
|
@ -145,17 +158,17 @@ class InformationParam(Param):
|
|||
class IndexParam(Param):
|
||||
type: str
|
||||
|
||||
def __init__(self,
|
||||
def __init__(
|
||||
self,
|
||||
**kwargs,
|
||||
) -> None:
|
||||
|
||||
if not kwargs["is_follower"]:
|
||||
msg = f'the variable "{kwargs["path"]}" is not a follower, so cannot have index type for param in "{kwargs["attribute"]}"'
|
||||
raise DictConsistencyError(msg, 25, kwargs['xmlfiles'])
|
||||
raise DictConsistencyError(msg, 25, kwargs["xmlfiles"])
|
||||
super().__init__(**kwargs)
|
||||
|
||||
|
||||
|
||||
PARAM_TYPES = {
|
||||
"any": AnyParam,
|
||||
"variable": VariableParam,
|
||||
|
@ -195,7 +208,12 @@ class Calculation(BaseModel):
|
|||
else:
|
||||
path = self.ori_path
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(
|
||||
param["variable"], self.path_prefix, path, self.version, self.namespace, self.xmlfiles
|
||||
param["variable"],
|
||||
self.path_prefix,
|
||||
path,
|
||||
self.version,
|
||||
self.namespace,
|
||||
self.xmlfiles,
|
||||
)
|
||||
if not variable:
|
||||
if not param.get("optional"):
|
||||
|
@ -214,7 +232,12 @@ class Calculation(BaseModel):
|
|||
else:
|
||||
path = self.ori_path
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(
|
||||
param["variable"], self.path_prefix, path, self.version, self.namespace, self.xmlfiles
|
||||
param["variable"],
|
||||
self.path_prefix,
|
||||
path,
|
||||
self.version,
|
||||
self.namespace,
|
||||
self.xmlfiles,
|
||||
)
|
||||
if not variable:
|
||||
msg = f'cannot find variable "{param["variable"]}" defined in "{self.attribute_name}" for "{self.path}"'
|
||||
|
@ -231,7 +254,14 @@ class Calculation(BaseModel):
|
|||
|
||||
class JinjaCalculation(Calculation):
|
||||
attribute_name: Literal[
|
||||
"frozen", "hidden", "mandatory", "disabled", "default", "validators", "choices", "dynamic"
|
||||
"frozen",
|
||||
"hidden",
|
||||
"mandatory",
|
||||
"disabled",
|
||||
"default",
|
||||
"validators",
|
||||
"choices",
|
||||
"dynamic",
|
||||
]
|
||||
jinja: StrictStr
|
||||
params: Optional[List[Param]] = None
|
||||
|
@ -264,7 +294,7 @@ class JinjaCalculation(Calculation):
|
|||
},
|
||||
}
|
||||
if self.default_values:
|
||||
default["params"]['__default_value'] = self.default_values
|
||||
default["params"]["__default_value"] = self.default_values
|
||||
if add_help:
|
||||
default["help"] = function + "_help"
|
||||
if self.params:
|
||||
|
@ -340,7 +370,7 @@ class JinjaCalculation(Calculation):
|
|||
False,
|
||||
objectspace,
|
||||
add_help=True,
|
||||
params={None: [self.attribute_name], 'when': True, 'inverse': False},
|
||||
params={None: [self.attribute_name], "when": True, "inverse": False},
|
||||
)
|
||||
elif self.attribute_name == "choices":
|
||||
return_type = self.return_type
|
||||
|
@ -362,16 +392,13 @@ class JinjaCalculation(Calculation):
|
|||
raise Exception("hu?")
|
||||
|
||||
|
||||
class VariableCalculation(Calculation):
|
||||
attribute_name: Literal[
|
||||
"default", "choices", "dynamic"
|
||||
]
|
||||
class _VariableCalculation(Calculation):
|
||||
variable: StrictStr
|
||||
propertyerror: bool = True
|
||||
allow_none: bool = False
|
||||
optional: bool = False
|
||||
|
||||
def get_params(self,
|
||||
def get_params(
|
||||
self,
|
||||
objectspace,
|
||||
needs_multi: Optional[bool] = None,
|
||||
):
|
||||
|
@ -380,7 +407,12 @@ class VariableCalculation(Calculation):
|
|||
else:
|
||||
path = self.ori_path
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(
|
||||
self.variable, self.path_prefix, path, self.version, self.namespace, self.xmlfiles
|
||||
self.variable,
|
||||
self.path_prefix,
|
||||
path,
|
||||
self.version,
|
||||
self.namespace,
|
||||
self.xmlfiles,
|
||||
)
|
||||
if not variable:
|
||||
if self.optional:
|
||||
|
@ -398,7 +430,7 @@ class VariableCalculation(Calculation):
|
|||
param["suffix"] = suffix
|
||||
params = {None: [param]}
|
||||
if self.default_values:
|
||||
params['__default_value'] = self.default_values
|
||||
params["__default_value"] = self.default_values
|
||||
if self.allow_none:
|
||||
params["allow_none"] = True
|
||||
if needs_multi is None:
|
||||
|
@ -408,11 +440,15 @@ class VariableCalculation(Calculation):
|
|||
needs_multi = self.path in objectspace.multis
|
||||
calc_variable_is_multi = variable.path in objectspace.multis
|
||||
if not calc_variable_is_multi:
|
||||
if variable.path in objectspace.paths._dynamics and (suffix is None or suffix[-1] is None):
|
||||
if variable.path in objectspace.paths._dynamics and (
|
||||
suffix is None or suffix[-1] is None
|
||||
):
|
||||
self_dyn_path = objectspace.paths._dynamics.get(self.path)
|
||||
if self_dyn_path is not None:
|
||||
var_dyn_path = objectspace.paths._dynamics[variable.path]
|
||||
if self_dyn_path != var_dyn_path and not self_dyn_path.startswith(f'{var_dyn_path}.'):
|
||||
if self_dyn_path != var_dyn_path and not self_dyn_path.startswith(
|
||||
f"{var_dyn_path}."
|
||||
):
|
||||
calc_variable_is_multi = True
|
||||
else:
|
||||
calc_variable_is_multi = True
|
||||
|
@ -432,18 +468,27 @@ class VariableCalculation(Calculation):
|
|||
raise DictConsistencyError(msg, 21, self.xmlfiles)
|
||||
return params
|
||||
|
||||
|
||||
class VariableCalculation(_VariableCalculation):
|
||||
attribute_name: Literal["default", "choices", "dynamic"]
|
||||
optional: bool = False
|
||||
|
||||
def to_function(
|
||||
self,
|
||||
objectspace,
|
||||
) -> dict:
|
||||
params = self.get_params(objectspace)
|
||||
if self.attribute_name == "choices":
|
||||
if hasattr(self, "optional") and self.optional is True:
|
||||
msg = "'choices' variable shall not have an 'optional' atttibute"
|
||||
raise DictConsistencyError(msg, 33, self.xmlfiles)
|
||||
return {
|
||||
"function": "calc_value",
|
||||
"params": params,
|
||||
}
|
||||
|
||||
|
||||
class VariablePropertyCalculation(VariableCalculation):
|
||||
class VariablePropertyCalculation(_VariableCalculation):
|
||||
attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||
when: Any = undefined
|
||||
when_not: Any = undefined
|
||||
|
@ -455,7 +500,7 @@ class VariablePropertyCalculation(VariableCalculation):
|
|||
params = self.get_params(objectspace, False)
|
||||
variable = params[None][0]["variable"]
|
||||
if self.when is not undefined:
|
||||
if self.version == '1.0':
|
||||
if self.version == "1.0":
|
||||
msg = f'when is not allowed in format version 1.0 for attribute "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 103, variable.xmlfiles)
|
||||
if self.when_not is not undefined:
|
||||
|
@ -464,7 +509,7 @@ class VariablePropertyCalculation(VariableCalculation):
|
|||
when = self.when
|
||||
inverse = False
|
||||
elif self.when_not is not undefined:
|
||||
if self.version == '1.0':
|
||||
if self.version == "1.0":
|
||||
msg = f'when_not is not allowed in format version 1.0 for attribute "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 104, variable.xmlfiles)
|
||||
when = self.when_not
|
||||
|
@ -475,9 +520,10 @@ class VariablePropertyCalculation(VariableCalculation):
|
|||
when = True
|
||||
inverse = False
|
||||
params[None].insert(0, self.attribute_name)
|
||||
params['when'] = when
|
||||
params['inverse'] = inverse
|
||||
return {"function": "variable_to_property",
|
||||
params["when"] = when
|
||||
params["inverse"] = inverse
|
||||
return {
|
||||
"function": "variable_to_property",
|
||||
"params": params,
|
||||
"help": "variable_to_property",
|
||||
}
|
||||
|
@ -492,10 +538,13 @@ class InformationCalculation(Calculation):
|
|||
self,
|
||||
objectspace,
|
||||
) -> dict:
|
||||
params = {None: [{
|
||||
params = {
|
||||
None: [
|
||||
{
|
||||
"type": "information",
|
||||
"information": self.information,
|
||||
}]
|
||||
}
|
||||
]
|
||||
}
|
||||
if self.variable:
|
||||
if self.ori_path is None:
|
||||
|
@ -503,13 +552,18 @@ class InformationCalculation(Calculation):
|
|||
else:
|
||||
path = self.ori_path
|
||||
variable, suffix = objectspace.paths.get_with_dynamic(
|
||||
self.variable, self.path_prefix, path, self.version, self.namespace, self.xmlfiles
|
||||
self.variable,
|
||||
self.path_prefix,
|
||||
path,
|
||||
self.version,
|
||||
self.namespace,
|
||||
self.xmlfiles,
|
||||
)
|
||||
if variable is None or suffix is not None:
|
||||
raise Exception("pfff")
|
||||
params[None][0]["variable"] = variable
|
||||
if self.default_values:
|
||||
params['__default_value'] = self.default_values
|
||||
params["__default_value"] = self.default_values
|
||||
return {
|
||||
"function": "calc_value",
|
||||
"params": params,
|
||||
|
@ -526,7 +580,7 @@ class SuffixCalculation(Calculation):
|
|||
) -> dict:
|
||||
suffix = {"type": "suffix"}
|
||||
if self.suffix is not None:
|
||||
suffix['suffix'] = self.suffix
|
||||
suffix["suffix"] = self.suffix
|
||||
return {
|
||||
"function": "calc_value",
|
||||
"params": {None: [suffix]},
|
||||
|
@ -614,11 +668,6 @@ class Variable(BaseModel):
|
|||
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
||||
|
||||
|
||||
#class Choice(Variable):
|
||||
# type: Literal["choice"] = "choice"
|
||||
# choices: Union[List[BASETYPE_CALC], Calculation]
|
||||
|
||||
|
||||
class SymLink(BaseModel):
|
||||
type: Literal["symlink"] = "symlink"
|
||||
name: str
|
||||
|
|
|
@ -78,7 +78,9 @@ class TiramisuReflector:
|
|||
)
|
||||
if self.objectspace.export_with_import:
|
||||
self.text["header"].extend(
|
||||
["from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription"]
|
||||
[
|
||||
"from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription"
|
||||
]
|
||||
)
|
||||
if funcs_paths:
|
||||
for funcs_path in sorted(funcs_paths, key=sorted_func_name):
|
||||
|
@ -105,7 +107,7 @@ class TiramisuReflector:
|
|||
baseelt = BaseElt()
|
||||
self.objectspace.reflector_names[
|
||||
baseelt.path
|
||||
] = f'option_0{self.objectspace.suffix}'
|
||||
] = f"option_0{self.objectspace.suffix}"
|
||||
basefamily = Family(
|
||||
baseelt,
|
||||
self,
|
||||
|
@ -450,10 +452,14 @@ class Variable(Common):
|
|||
)
|
||||
return
|
||||
if self.elt.type == "choice":
|
||||
raise DictConsistencyError(
|
||||
"Sub-attributes not allowed in a 'choices' attribute",
|
||||
100,
|
||||
self.elt.xmlfiles,
|
||||
# TODO : 'optional' sub-attriute shall be forbidden
|
||||
# raise DictConsistencyError(
|
||||
# "Sub-attributes not allowed in a 'choices' attribute",
|
||||
# 100,
|
||||
# self.elt.xmlfiles,
|
||||
# )
|
||||
keys["values"] = self.populate_calculation(
|
||||
self.elt.choices, return_a_tuple=True
|
||||
)
|
||||
if self.elt.path in self.objectspace.multis:
|
||||
keys["multi"] = self.objectspace.multis[self.elt.path]
|
||||
|
@ -462,13 +468,13 @@ class Variable(Common):
|
|||
keys["default"] = self.populate_calculation(self.elt.default)
|
||||
except VariableCalculationDependencyError:
|
||||
pass
|
||||
for attribute in ["frozen", "hidden", "mandatory", "disabled"]:
|
||||
if hasattr(self.elt, attribute): # FIXME FIXME and attribute == "optional":
|
||||
raise DictConsistencyError(
|
||||
f"Sub-attributes not allowed in a '{attribute}' attribute",
|
||||
100,
|
||||
self.elt.xmlfiles,
|
||||
)
|
||||
# for attribute in ["frozen", "hidden", "mandatory", "disabled"]:
|
||||
# if hasattr(self.elt, attribute): # FIXME FIXME and attribute == "optional":
|
||||
# raise DictConsistencyError(
|
||||
# f"Sub-attributes not allowed in a '{attribute}' attribute",
|
||||
# 100,
|
||||
# self.elt.xmlfiles,
|
||||
# )
|
||||
if self.elt.path in self.objectspace.default_multi:
|
||||
keys["default_multi"] = self.populate_calculation(
|
||||
self.objectspace.default_multi[self.elt.path]
|
||||
|
|
|
@ -1,10 +1,24 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
|
||||
load_functions("tests/dictionaries/../eosfunc/test.py")
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
option_2 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
optiondescription_1 = OptionDescription(
|
||||
name="rougail",
|
||||
doc="Rougail",
|
||||
children=[option_2],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
option_0 = OptionDescription(
|
||||
name="baseoption", doc="baseoption", children=[optiondescription_1]
|
||||
)
|
||||
|
|
|
@ -1,14 +1,51 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
|
||||
load_functions("tests/dictionaries/../eosfunc/test.py")
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="rougail", children=[option_3], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_6 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
optiondescription_5 = OptionDescription(name="rougail", doc="rougail", children=[option_6], properties=frozenset({"standard"}))
|
||||
optiondescription_4 = OptionDescription(name="2", doc="2", children=[optiondescription_5], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_4])
|
||||
option_3 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
optiondescription_2 = OptionDescription(
|
||||
name="rougail",
|
||||
doc="Rougail",
|
||||
children=[option_3],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
optiondescription_1 = OptionDescription(
|
||||
name="1",
|
||||
doc="1",
|
||||
children=[optiondescription_2],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
option_6 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
optiondescription_5 = OptionDescription(
|
||||
name="rougail",
|
||||
doc="Rougail",
|
||||
children=[option_6],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
optiondescription_4 = OptionDescription(
|
||||
name="2",
|
||||
doc="2",
|
||||
children=[optiondescription_5],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
option_0 = OptionDescription(
|
||||
name="baseoption",
|
||||
doc="baseoption",
|
||||
children=[optiondescription_1, optiondescription_4],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
|
||||
load_functions("tests/dictionaries/../eosfunc/test.py")
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
|
@ -1,11 +1,34 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
|
||||
load_functions("tests/dictionaries/../eosfunc/test.py")
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
option_2 = StrOption(
|
||||
name="my_variable",
|
||||
doc="my_variable",
|
||||
multi=True,
|
||||
default=["val1", "val2"],
|
||||
default_multi="val1",
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
option_3 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
default=Calculation(func["calc_value"], Params((ParamOption(option_2)))),
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
optiondescription_1 = OptionDescription(
|
||||
name="rougail",
|
||||
doc="Rougail",
|
||||
children=[option_2, option_3],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
option_0 = OptionDescription(
|
||||
name="baseoption", doc="baseoption", children=[optiondescription_1]
|
||||
)
|
||||
|
|
|
@ -1,16 +1,71 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('tests/dictionaries/../eosfunc/test.py')
|
||||
|
||||
load_functions("tests/dictionaries/../eosfunc/test.py")
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)))), properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="rougail", children=[option_3, option_4], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_7 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_7)))), properties=frozenset({"mandatory", "notempty", "standard"}))
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="rougail", children=[option_7, option_8], properties=frozenset({"standard"}))
|
||||
optiondescription_5 = OptionDescription(name="2", doc="2", children=[optiondescription_6], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_5])
|
||||
option_3 = StrOption(
|
||||
name="my_variable",
|
||||
doc="my_variable",
|
||||
multi=True,
|
||||
default=["val1", "val2"],
|
||||
default_multi="val1",
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
option_4 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
default=Calculation(func["calc_value"], Params((ParamOption(option_3)))),
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
optiondescription_2 = OptionDescription(
|
||||
name="rougail",
|
||||
doc="Rougail",
|
||||
children=[option_3, option_4],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
optiondescription_1 = OptionDescription(
|
||||
name="1",
|
||||
doc="1",
|
||||
children=[optiondescription_2],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
option_7 = StrOption(
|
||||
name="my_variable",
|
||||
doc="my_variable",
|
||||
multi=True,
|
||||
default=["val1", "val2"],
|
||||
default_multi="val1",
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
option_8 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
default=Calculation(func["calc_value"], Params((ParamOption(option_7)))),
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
optiondescription_6 = OptionDescription(
|
||||
name="rougail",
|
||||
doc="Rougail",
|
||||
children=[option_7, option_8],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
optiondescription_5 = OptionDescription(
|
||||
name="2",
|
||||
doc="2",
|
||||
children=[optiondescription_6],
|
||||
properties=frozenset({"standard"}),
|
||||
)
|
||||
option_0 = OptionDescription(
|
||||
name="baseoption",
|
||||
doc="baseoption",
|
||||
children=[optiondescription_1, optiondescription_5],
|
||||
)
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
|
||||
load_functions("tests/dictionaries/../eosfunc/test.py")
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(
|
||||
name="my_variable",
|
||||
doc="my_variable",
|
||||
multi=True,
|
||||
default=["val1", "val2"],
|
||||
default_multi="val1",
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
option_2 = StrOption(
|
||||
name="my_calculated_variable",
|
||||
doc="my_calculated_variable",
|
||||
multi=True,
|
||||
properties=frozenset({"mandatory", "notempty", "standard"}),
|
||||
informations={"type": "string"},
|
||||
)
|
||||
option_0 = OptionDescription(
|
||||
name="baseoption", doc="baseoption", children=[option_1, option_2]
|
||||
)
|
Loading…
Reference in a new issue