fix: simplify version support
This commit is contained in:
parent
e71d4600d7
commit
b229154df5
11 changed files with 139 additions and 35 deletions
|
|
@ -259,7 +259,6 @@ class ParserVariable:
|
||||||
path: str,
|
path: str,
|
||||||
obj: dict,
|
obj: dict,
|
||||||
family_is_leadership: bool,
|
family_is_leadership: bool,
|
||||||
version: str,
|
|
||||||
filename: str,
|
filename: str,
|
||||||
) -> Literal["variable", "family"]:
|
) -> Literal["variable", "family"]:
|
||||||
"""Check object to determine if it's a variable or a family"""
|
"""Check object to determine if it's a variable or a family"""
|
||||||
|
|
@ -303,7 +302,7 @@ class ParserVariable:
|
||||||
else:
|
else:
|
||||||
return "variable"
|
return "variable"
|
||||||
else:
|
else:
|
||||||
if version == "1.0":
|
if self.version == "1.0":
|
||||||
msg = f'Invalid value for the variable "{path}": "{obj}"'
|
msg = f'Invalid value for the variable "{path}": "{obj}"'
|
||||||
raise DictConsistencyError(msg, 102, [filename])
|
raise DictConsistencyError(msg, 102, [filename])
|
||||||
return "variable"
|
return "variable"
|
||||||
|
|
@ -332,7 +331,6 @@ class ParserVariable:
|
||||||
name: str,
|
name: str,
|
||||||
subpath: str,
|
subpath: str,
|
||||||
obj: dict,
|
obj: dict,
|
||||||
version: str,
|
|
||||||
comment: Optional[str],
|
comment: Optional[str],
|
||||||
*,
|
*,
|
||||||
first_variable: bool = False,
|
first_variable: bool = False,
|
||||||
|
|
@ -347,14 +345,13 @@ class ParserVariable:
|
||||||
path = name
|
path = name
|
||||||
else:
|
else:
|
||||||
path = f"{subpath}.{name}"
|
path = f"{subpath}.{name}"
|
||||||
if version == "0.1" and not isinstance(obj, dict) and obj is not None:
|
if self.version == "0.1" and not isinstance(obj, dict) and obj is not None:
|
||||||
msg = f'the variable "{path}" has a wrong type "{type(obj)}"'
|
msg = f'the variable "{path}" has a wrong type "{type(obj)}"'
|
||||||
raise DictConsistencyError(msg, 17, [filename])
|
raise DictConsistencyError(msg, 17, [filename])
|
||||||
typ = self.is_family_or_variable(
|
typ = self.is_family_or_variable(
|
||||||
path,
|
path,
|
||||||
obj,
|
obj,
|
||||||
family_is_leadership,
|
family_is_leadership,
|
||||||
version,
|
|
||||||
filename,
|
filename,
|
||||||
)
|
)
|
||||||
logging.info("family_or_variable: %s is a %s", path, typ)
|
logging.info("family_or_variable: %s is a %s", path, typ)
|
||||||
|
|
@ -367,7 +364,6 @@ class ParserVariable:
|
||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
obj,
|
obj,
|
||||||
version,
|
|
||||||
comment=comment,
|
comment=comment,
|
||||||
first_variable=first_variable,
|
first_variable=first_variable,
|
||||||
family_is_leadership=family_is_leadership,
|
family_is_leadership=family_is_leadership,
|
||||||
|
|
@ -381,7 +377,6 @@ class ParserVariable:
|
||||||
name: str,
|
name: str,
|
||||||
path: str,
|
path: str,
|
||||||
obj: Optional[Dict[str, Any]],
|
obj: Optional[Dict[str, Any]],
|
||||||
version: str,
|
|
||||||
*,
|
*,
|
||||||
comment: Optional[str] = None,
|
comment: Optional[str] = None,
|
||||||
first_variable: bool = False,
|
first_variable: bool = False,
|
||||||
|
|
@ -394,7 +389,7 @@ class ParserVariable:
|
||||||
obj = {}
|
obj = {}
|
||||||
family_obj = {}
|
family_obj = {}
|
||||||
subfamily_obj = {}
|
subfamily_obj = {}
|
||||||
if version != "1.0":
|
if self.version != "1.0":
|
||||||
exists = obj.pop("exists", None)
|
exists = obj.pop("exists", None)
|
||||||
else:
|
else:
|
||||||
exists = None
|
exists = None
|
||||||
|
|
@ -406,7 +401,7 @@ class ParserVariable:
|
||||||
family_obj[key] = value
|
family_obj[key] = value
|
||||||
else:
|
else:
|
||||||
subfamily_obj[key] = value
|
subfamily_obj[key] = value
|
||||||
if version != "1.0" and not family_obj and comment:
|
if self.version != "1.0" and not family_obj and comment:
|
||||||
family_obj["description"] = comment
|
family_obj["description"] = comment
|
||||||
|
|
||||||
if path in self.paths:
|
if path in self.paths:
|
||||||
|
|
@ -423,7 +418,6 @@ class ParserVariable:
|
||||||
obj,
|
obj,
|
||||||
filename,
|
filename,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
version,
|
|
||||||
typ="family",
|
typ="family",
|
||||||
)
|
)
|
||||||
if self.load_unexist_redefine or exists in [None, True]:
|
if self.load_unexist_redefine or exists in [None, True]:
|
||||||
|
|
@ -481,7 +475,6 @@ class ParserVariable:
|
||||||
filename,
|
filename,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
parent_dynamic,
|
parent_dynamic,
|
||||||
version,
|
|
||||||
)
|
)
|
||||||
force_not_first = False
|
force_not_first = False
|
||||||
if self.paths[path].type == "leadership":
|
if self.paths[path].type == "leadership":
|
||||||
|
|
@ -495,7 +488,6 @@ class ParserVariable:
|
||||||
key,
|
key,
|
||||||
path,
|
path,
|
||||||
value,
|
value,
|
||||||
version,
|
|
||||||
comment,
|
comment,
|
||||||
first_variable=first_variable,
|
first_variable=first_variable,
|
||||||
family_is_leadership=family_is_leadership,
|
family_is_leadership=family_is_leadership,
|
||||||
|
|
@ -553,17 +545,16 @@ class ParserVariable:
|
||||||
filename: str,
|
filename: str,
|
||||||
family_is_dynamic: bool,
|
family_is_dynamic: bool,
|
||||||
parent_dynamic: str,
|
parent_dynamic: str,
|
||||||
version: str,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Add a new family"""
|
"""Add a new family"""
|
||||||
family["path"] = path
|
family["path"] = path
|
||||||
family["namespace"] = self.namespace
|
family["namespace"] = self.namespace
|
||||||
family["version"] = version
|
family["version"] = self.version
|
||||||
family["xmlfiles"] = [filename]
|
family["xmlfiles"] = [filename]
|
||||||
obj_type = self.get_family_or_variable_type(family)
|
obj_type = self.get_family_or_variable_type(family)
|
||||||
if obj_type == "dynamic":
|
if obj_type == "dynamic":
|
||||||
family_obj = self.dynamic
|
family_obj = self.dynamic
|
||||||
if version == "1.0":
|
if self.version == "1.0":
|
||||||
if "variable" not in family:
|
if "variable" not in family:
|
||||||
raise DictConsistencyError(
|
raise DictConsistencyError(
|
||||||
f'dynamic family must have "variable" attribute for "{path}"',
|
f'dynamic family must have "variable" attribute for "{path}"',
|
||||||
|
|
@ -592,7 +583,7 @@ class ParserVariable:
|
||||||
"allow_none": True,
|
"allow_none": True,
|
||||||
}
|
}
|
||||||
del family["variable"]
|
del family["variable"]
|
||||||
if version != "1.0":
|
if self.version != "1.0":
|
||||||
warning = f'"variable" attribute in dynamic family "{ path }" is depreciated in {filename}'
|
warning = f'"variable" attribute in dynamic family "{ path }" is depreciated in {filename}'
|
||||||
warn(warning)
|
warn(warning)
|
||||||
if "variable" in family:
|
if "variable" in family:
|
||||||
|
|
@ -607,7 +598,6 @@ class ParserVariable:
|
||||||
family,
|
family,
|
||||||
filename,
|
filename,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
version,
|
|
||||||
typ="family",
|
typ="family",
|
||||||
)
|
)
|
||||||
try:
|
try:
|
||||||
|
|
@ -637,7 +627,6 @@ class ParserVariable:
|
||||||
name: str,
|
name: str,
|
||||||
path: str,
|
path: str,
|
||||||
obj: Optional[Dict[str, Any]],
|
obj: Optional[Dict[str, Any]],
|
||||||
version: str,
|
|
||||||
*,
|
*,
|
||||||
comment: Optional[str] = None,
|
comment: Optional[str] = None,
|
||||||
first_variable: bool = False,
|
first_variable: bool = False,
|
||||||
|
|
@ -646,7 +635,7 @@ class ParserVariable:
|
||||||
parent_dynamic: Optional[str] = None,
|
parent_dynamic: Optional[str] = None,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Parse variable"""
|
"""Parse variable"""
|
||||||
if version == "1.0" or isinstance(obj, dict):
|
if self.version == "1.0" or isinstance(obj, dict):
|
||||||
if obj is None:
|
if obj is None:
|
||||||
obj = {}
|
obj = {}
|
||||||
extra_attrs = set(obj) - self.variable_attrs
|
extra_attrs = set(obj) - self.variable_attrs
|
||||||
|
|
@ -666,10 +655,9 @@ class ParserVariable:
|
||||||
obj,
|
obj,
|
||||||
filename,
|
filename,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
version,
|
|
||||||
)
|
)
|
||||||
self.parse_params(path, obj, filename)
|
self.parse_params(path, obj, filename)
|
||||||
self.parse_secret_manager(path, obj, filename, version, family_is_dynamic)
|
self.parse_secret_manager(path, obj, filename, family_is_dynamic)
|
||||||
exists = obj.pop("exists", None)
|
exists = obj.pop("exists", None)
|
||||||
if path in self.paths:
|
if path in self.paths:
|
||||||
if not self.load_unexist_redefine:
|
if not self.load_unexist_redefine:
|
||||||
|
|
@ -700,7 +688,7 @@ class ParserVariable:
|
||||||
raise DictConsistencyError(msg, 46, [filename])
|
raise DictConsistencyError(msg, 46, [filename])
|
||||||
obj["path"] = path
|
obj["path"] = path
|
||||||
self.add_variable(
|
self.add_variable(
|
||||||
name, obj, filename, family_is_dynamic, parent_dynamic, version
|
name, obj, filename, family_is_dynamic, parent_dynamic
|
||||||
)
|
)
|
||||||
if family_is_leadership:
|
if family_is_leadership:
|
||||||
if first_variable:
|
if first_variable:
|
||||||
|
|
@ -714,7 +702,6 @@ class ParserVariable:
|
||||||
obj: dict,
|
obj: dict,
|
||||||
filename: str,
|
filename: str,
|
||||||
family_is_dynamic: bool,
|
family_is_dynamic: bool,
|
||||||
version: str,
|
|
||||||
*,
|
*,
|
||||||
typ: str = "variable",
|
typ: str = "variable",
|
||||||
):
|
):
|
||||||
|
|
@ -737,7 +724,6 @@ class ParserVariable:
|
||||||
value,
|
value,
|
||||||
path,
|
path,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
version,
|
|
||||||
[filename],
|
[filename],
|
||||||
)
|
)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
|
|
@ -762,7 +748,6 @@ class ParserVariable:
|
||||||
val,
|
val,
|
||||||
path,
|
path,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
version,
|
|
||||||
[filename],
|
[filename],
|
||||||
inside_list=True,
|
inside_list=True,
|
||||||
index=idx,
|
index=idx,
|
||||||
|
|
@ -808,7 +793,7 @@ class ParserVariable:
|
||||||
) from err
|
) from err
|
||||||
obj["params"] = params
|
obj["params"] = params
|
||||||
|
|
||||||
def parse_secret_manager(self, path, obj, filename, version, family_is_dynamic):
|
def parse_secret_manager(self, path, obj, filename, family_is_dynamic):
|
||||||
"""Parse variable secret_manager"""
|
"""Parse variable secret_manager"""
|
||||||
if "secret_manager" not in obj:
|
if "secret_manager" not in obj:
|
||||||
return
|
return
|
||||||
|
|
@ -828,7 +813,6 @@ class ParserVariable:
|
||||||
secret_manager,
|
secret_manager,
|
||||||
path,
|
path,
|
||||||
family_is_dynamic,
|
family_is_dynamic,
|
||||||
version,
|
|
||||||
[filename],
|
[filename],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -839,7 +823,6 @@ class ParserVariable:
|
||||||
filename: str,
|
filename: str,
|
||||||
family_is_dynamic: bool,
|
family_is_dynamic: bool,
|
||||||
parent_dynamic: Optional[str],
|
parent_dynamic: Optional[str],
|
||||||
version: str,
|
|
||||||
) -> None:
|
) -> None:
|
||||||
if "{ suffix" in variable["path"]:
|
if "{ suffix" in variable["path"]:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
@ -848,7 +831,7 @@ class ParserVariable:
|
||||||
filename = [filename]
|
filename = [filename]
|
||||||
|
|
||||||
variable["namespace"] = self.namespace
|
variable["namespace"] = self.namespace
|
||||||
variable["version"] = version
|
variable["version"] = self.version
|
||||||
variable["xmlfiles"] = filename
|
variable["xmlfiles"] = filename
|
||||||
variable_type = self.get_family_or_variable_type(variable)
|
variable_type = self.get_family_or_variable_type(variable)
|
||||||
obj = {
|
obj = {
|
||||||
|
|
@ -943,7 +926,6 @@ class ParserVariable:
|
||||||
value: dict,
|
value: dict,
|
||||||
path: str,
|
path: str,
|
||||||
family_is_dynamic: bool,
|
family_is_dynamic: bool,
|
||||||
version: str,
|
|
||||||
xmlfiles: List[str],
|
xmlfiles: List[str],
|
||||||
*,
|
*,
|
||||||
inside_list: bool = False,
|
inside_list: bool = False,
|
||||||
|
|
@ -956,7 +938,7 @@ class ParserVariable:
|
||||||
calculation_object["attribute_name"] = attribute
|
calculation_object["attribute_name"] = attribute
|
||||||
calculation_object["path"] = path
|
calculation_object["path"] = path
|
||||||
calculation_object["inside_list"] = inside_list
|
calculation_object["inside_list"] = inside_list
|
||||||
calculation_object["version"] = version
|
calculation_object["version"] = self.version
|
||||||
calculation_object["namespace"] = self.namespace
|
calculation_object["namespace"] = self.namespace
|
||||||
calculation_object["xmlfiles"] = xmlfiles
|
calculation_object["xmlfiles"] = xmlfiles
|
||||||
#
|
#
|
||||||
|
|
@ -980,7 +962,7 @@ class ParserVariable:
|
||||||
"type": "any",
|
"type": "any",
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
if version == "1.0" and val["type"] == "suffix":
|
if self.version == "1.0" and val["type"] == "suffix":
|
||||||
val["type"] = "identifier"
|
val["type"] = "identifier"
|
||||||
param_typ = val["type"]
|
param_typ = val["type"]
|
||||||
val["key"] = key
|
val["key"] = key
|
||||||
|
|
@ -1067,6 +1049,7 @@ class RougailConvert(ParserVariable):
|
||||||
) -> None:
|
) -> None:
|
||||||
if namespace_path is None:
|
if namespace_path is None:
|
||||||
namespace_path = self.namespace
|
namespace_path = self.namespace
|
||||||
|
self.version = ""
|
||||||
self.parse_family(
|
self.parse_family(
|
||||||
"",
|
"",
|
||||||
self.namespace,
|
self.namespace,
|
||||||
|
|
@ -1074,7 +1057,6 @@ class RougailConvert(ParserVariable):
|
||||||
{
|
{
|
||||||
"description": namespace_description,
|
"description": namespace_description,
|
||||||
},
|
},
|
||||||
"",
|
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_comment(
|
def get_comment(
|
||||||
|
|
@ -1097,6 +1079,7 @@ class RougailConvert(ParserVariable):
|
||||||
version: str,
|
version: str,
|
||||||
objects: dict,
|
objects: dict,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
self.version = version
|
||||||
for name, obj in objects.items():
|
for name, obj in objects.items():
|
||||||
comment = self.get_comment(name, objects)
|
comment = self.get_comment(name, objects)
|
||||||
self.family_or_variable(
|
self.family_or_variable(
|
||||||
|
|
@ -1104,7 +1087,6 @@ class RougailConvert(ParserVariable):
|
||||||
name,
|
name,
|
||||||
path,
|
path,
|
||||||
obj,
|
obj,
|
||||||
version,
|
|
||||||
comment,
|
comment,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,11 +78,11 @@ class Annotator(Walk):
|
||||||
path = alternative_name
|
path = alternative_name
|
||||||
else:
|
else:
|
||||||
path = variable_path.rsplit(".", 1)[0] + "." + alternative_name
|
path = variable_path.rsplit(".", 1)[0] + "." + alternative_name
|
||||||
|
self.objectspace.version = variable.version
|
||||||
self.objectspace.add_variable(
|
self.objectspace.add_variable(
|
||||||
alternative_name,
|
alternative_name,
|
||||||
{"type": "symlink", "path": path, "opt": variable},
|
{"type": "symlink", "path": path, "opt": variable},
|
||||||
variable.xmlfiles,
|
variable.xmlfiles,
|
||||||
False,
|
False,
|
||||||
False,
|
False,
|
||||||
variable.version,
|
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -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_2 = StrOption(name="var1", doc="a first variable", properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
option_3 = StrOption(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/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"}), informations={'ymlfiles': ['']})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,11 @@
|
||||||
|
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')
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||||
|
option_1 = StrOption(name="var1", doc="a first variable", properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
option_2 = StrOption(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_1)))), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val1",
|
||||||
|
"val2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.dynval1.var": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a value"
|
||||||
|
},
|
||||||
|
"rougail.dynval2.var": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a value"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": [
|
||||||
|
"val1",
|
||||||
|
"val2"
|
||||||
|
],
|
||||||
|
"rougail.dynval1.var": "a value",
|
||||||
|
"rougail.dynval2.var": "a value",
|
||||||
|
"rougail.var2": "a value"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val1",
|
||||||
|
"val2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.dynval1.var": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a value"
|
||||||
|
},
|
||||||
|
"rougail.dynval2.var": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a value"
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a value"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": [
|
||||||
|
"val1",
|
||||||
|
"val2"
|
||||||
|
],
|
||||||
|
"rougail.var2": "a value"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
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 = StrOption(name="var1", doc="A suffix variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
option_4 = BoolOption(name="var", doc="A dynamic variable", default=True, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml'], 'type': 'boolean'})
|
||||||
|
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_4], properties=frozenset({"standard"}), informations={'dynamic_variable': 'rougail.var1', 'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml']})
|
||||||
|
option_5 = BoolOption(name="var2", doc="A variable calculated", default=Calculation(func['calc_value'], Params((ParamDynOption(option_4, ["val1"])))), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml'], 'type': 'boolean'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3, option_5], properties=frozenset({"standard"}), informations={'ymlfiles': ['']})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
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 = StrOption(name="var1", doc="A suffix variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
option_4 = StrOption(name="var", doc="A dynamic variable", multi=True, default=["a value", "a second value"], default_multi="a value", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_4], properties=frozenset({"standard"}), informations={'dynamic_variable': 'rougail.var1', 'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml']})
|
||||||
|
option_5 = StrOption(name="var2", doc="A variable calculated", multi=True, default=Calculation(func['calc_value'], Params((ParamDynOption(option_4, ["val1"])), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml'], 'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3, option_5], properties=frozenset({"standard"}), informations={'ymlfiles': ['']})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
Loading…
Reference in a new issue