add information in tiramisu option for doc
This commit is contained in:
parent
d1db967dd5
commit
220726600c
3042 changed files with 9125 additions and 21387 deletions
|
@ -314,21 +314,6 @@ class Annotator(Walk):
|
||||||
if not variable.mode:
|
if not variable.mode:
|
||||||
variable.mode = variable_mode
|
variable.mode = variable_mode
|
||||||
|
|
||||||
def dynamic_families(self):
|
|
||||||
"""link dynamic families to object"""
|
|
||||||
for family in self.get_families():
|
|
||||||
if family.type != "dynamic":
|
|
||||||
continue
|
|
||||||
for variable in self.objectspace.parents[family.path]:
|
|
||||||
if (
|
|
||||||
isinstance(variable, self.objectspace.family)
|
|
||||||
and not variable.leadership
|
|
||||||
):
|
|
||||||
msg = _(
|
|
||||||
f'dynamic family "{family.name}" cannot contains another family'
|
|
||||||
)
|
|
||||||
raise DictConsistencyError(msg, 22, family.xmlfiles)
|
|
||||||
|
|
||||||
def convert_help(self):
|
def convert_help(self):
|
||||||
"""Convert variable help"""
|
"""Convert variable help"""
|
||||||
for family in self.get_families():
|
for family in self.get_families():
|
||||||
|
|
|
@ -48,6 +48,8 @@ from ruamel.yaml import YAML
|
||||||
from ruamel.yaml.comments import CommentedMap
|
from ruamel.yaml.comments import CommentedMap
|
||||||
from pydantic import ValidationError
|
from pydantic import ValidationError
|
||||||
|
|
||||||
|
from warnings import warn
|
||||||
|
|
||||||
from tiramisu.error import display_list
|
from tiramisu.error import display_list
|
||||||
|
|
||||||
from .i18n import _
|
from .i18n import _
|
||||||
|
@ -67,7 +69,7 @@ from .object_model import (
|
||||||
PARAM_TYPES,
|
PARAM_TYPES,
|
||||||
AnyParam,
|
AnyParam,
|
||||||
)
|
)
|
||||||
from .error import DictConsistencyError
|
from .error import DictConsistencyError, display_xmlfiles
|
||||||
|
|
||||||
|
|
||||||
property_types = Union[Literal[True], Calculation]
|
property_types = Union[Literal[True], Calculation]
|
||||||
|
@ -100,7 +102,7 @@ class Property:
|
||||||
|
|
||||||
|
|
||||||
class Paths:
|
class Paths:
|
||||||
_regexp_relative = compile(r"^_*\.(.*)$")
|
regexp_relative = compile(r"^_*\.(.*)$")
|
||||||
|
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
default_namespace: str,
|
default_namespace: str,
|
||||||
|
@ -126,6 +128,16 @@ class Paths:
|
||||||
if not force and is_dynamic:
|
if not force and is_dynamic:
|
||||||
self._dynamics[path] = dynamic
|
self._dynamics[path] = dynamic
|
||||||
|
|
||||||
|
def get_relative_path(self,
|
||||||
|
path: str,
|
||||||
|
current_path: str,
|
||||||
|
):
|
||||||
|
relative, subpath = path.split(".", 1)
|
||||||
|
relative_len = len(relative)
|
||||||
|
path_len = current_path.count(".")
|
||||||
|
parent_path = current_path.rsplit(".", relative_len)[0]
|
||||||
|
return parent_path + "." + subpath
|
||||||
|
|
||||||
def get_with_dynamic(
|
def get_with_dynamic(
|
||||||
self,
|
self,
|
||||||
path: str,
|
path: str,
|
||||||
|
@ -136,12 +148,10 @@ class Paths:
|
||||||
xmlfiles: List[str],
|
xmlfiles: List[str],
|
||||||
) -> Any:
|
) -> Any:
|
||||||
suffix = None
|
suffix = None
|
||||||
if version != '1.0' and self._regexp_relative.search(path):
|
if version != '1.0' and self.regexp_relative.search(path):
|
||||||
relative, subpath = path.split(".", 1)
|
path = self.get_relative_path(path,
|
||||||
relative_len = len(relative)
|
current_path,
|
||||||
path_len = current_path.count(".")
|
)
|
||||||
parent_path = current_path.rsplit(".", relative_len)[0]
|
|
||||||
path = parent_path + "." + subpath
|
|
||||||
else:
|
else:
|
||||||
path = get_realpath(path, suffix_path)
|
path = get_realpath(path, suffix_path)
|
||||||
dynamic = None
|
dynamic = None
|
||||||
|
@ -263,7 +273,7 @@ class Informations:
|
||||||
if path not in self._data:
|
if path not in self._data:
|
||||||
self._data[path] = {}
|
self._data[path] = {}
|
||||||
if key in self._data[path]:
|
if key in self._data[path]:
|
||||||
raise Exception(f"already key {key} in {path}")
|
raise Exception(f'an information "{key}" is already present in "{path}"')
|
||||||
self._data[path][key] = data
|
self._data[path][key] = data
|
||||||
|
|
||||||
def get(
|
def get(
|
||||||
|
@ -467,7 +477,7 @@ class ParserVariable:
|
||||||
return
|
return
|
||||||
family_obj = {}
|
family_obj = {}
|
||||||
subfamily_obj = {}
|
subfamily_obj = {}
|
||||||
force_to_attrs = list(self.list_attributes(obj, version))
|
force_to_attrs = list(self.list_attributes(obj))
|
||||||
for key, value in obj.items():
|
for key, value in obj.items():
|
||||||
if key in force_to_attrs:
|
if key in force_to_attrs:
|
||||||
if key.startswith("_"):
|
if key.startswith("_"):
|
||||||
|
@ -505,10 +515,11 @@ class ParserVariable:
|
||||||
if self.get_family_or_variable_type(family_obj) == "dynamic":
|
if self.get_family_or_variable_type(family_obj) == "dynamic":
|
||||||
family_is_dynamic = True
|
family_is_dynamic = True
|
||||||
parent_dynamic = path
|
parent_dynamic = path
|
||||||
if version == '1.0' and '{{ suffix }}' not in name:
|
if '{{ suffix }}' not in name:
|
||||||
|
if "variable" in family_obj:
|
||||||
name += '{{ suffix }}'
|
name += '{{ suffix }}'
|
||||||
path += '{{ suffix }}'
|
path += '{{ suffix }}'
|
||||||
if '{{ suffix }}' not in name:
|
else:
|
||||||
msg = f'dynamic family name must have "{{{{ suffix }}}}" in his name for "{path}"'
|
msg = f'dynamic family name must have "{{{{ suffix }}}}" in his name for "{path}"'
|
||||||
raise DictConsistencyError(msg, 13, [filename])
|
raise DictConsistencyError(msg, 13, [filename])
|
||||||
if version != '1.0' and not family_obj and comment:
|
if version != '1.0' and not family_obj and comment:
|
||||||
|
@ -545,7 +556,6 @@ class ParserVariable:
|
||||||
def list_attributes(
|
def list_attributes(
|
||||||
self,
|
self,
|
||||||
obj: Dict[str, Any],
|
obj: Dict[str, Any],
|
||||||
version: str,
|
|
||||||
) -> Iterator[str]:
|
) -> Iterator[str]:
|
||||||
"""List attributes"""
|
"""List attributes"""
|
||||||
force_to_variable = []
|
force_to_variable = []
|
||||||
|
@ -568,7 +578,8 @@ class ParserVariable:
|
||||||
):
|
):
|
||||||
# it's a dict, so a new variables!
|
# it's a dict, so a new variables!
|
||||||
continue
|
continue
|
||||||
if version == '1.0' and key == "variable" and obj.get("type") != "dynamic" and obj.get("_type") != "dynamic":
|
# 'variable' for compatibility to format 1.0
|
||||||
|
if key == "variable" and obj.get("type") != "dynamic" and obj.get("_type") != "dynamic":
|
||||||
continue
|
continue
|
||||||
if key in self.family_attrs:
|
if key in self.family_attrs:
|
||||||
yield key
|
yield key
|
||||||
|
@ -586,6 +597,7 @@ class ParserVariable:
|
||||||
"""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["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":
|
||||||
|
@ -603,6 +615,9 @@ class ParserVariable:
|
||||||
'allow_none': True,
|
'allow_none': True,
|
||||||
}
|
}
|
||||||
del family['variable']
|
del family['variable']
|
||||||
|
if version != "1.0":
|
||||||
|
warning = f'"variable" attribute in dynamic family "{ path }" is depreciated in {filename}'
|
||||||
|
warn(warning)
|
||||||
if "variable" in family:
|
if "variable" in family:
|
||||||
raise Exception(f'dynamic family must not have "variable" attribute for "{family["path"]}" in {family["xmlfiles"]}')
|
raise Exception(f'dynamic family must not have "variable" attribute for "{family["path"]}" in {family["xmlfiles"]}')
|
||||||
else:
|
else:
|
||||||
|
@ -691,7 +706,7 @@ class ParserVariable:
|
||||||
# so do nothing
|
# so do nothing
|
||||||
return
|
return
|
||||||
if "redefine" in obj and obj["redefine"]:
|
if "redefine" in obj and obj["redefine"]:
|
||||||
msg = f'cannot redefine the inexisting variable "{path}" in {filename}'
|
msg = f'cannot redefine the inexisting variable "{path}"'
|
||||||
raise DictConsistencyError(msg, 46, [filename])
|
raise DictConsistencyError(msg, 46, [filename])
|
||||||
obj["path"] = path
|
obj["path"] = path
|
||||||
self.add_variable(
|
self.add_variable(
|
||||||
|
@ -1003,7 +1018,7 @@ class RougailConvert(ParserVariable):
|
||||||
"",
|
"",
|
||||||
False,
|
False,
|
||||||
None,
|
None,
|
||||||
None,
|
'',
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
root_parent = "."
|
root_parent = "."
|
||||||
|
|
|
@ -51,40 +51,45 @@ def convert_boolean(value: str) -> bool:
|
||||||
|
|
||||||
|
|
||||||
CONVERT_OPTION = {
|
CONVERT_OPTION = {
|
||||||
"string": dict(opttype="StrOption"),
|
"string": dict(opttype="StrOption", example="xxx"),
|
||||||
"number": dict(opttype="IntOption", func=int),
|
"number": dict(opttype="IntOption", func=int, example=42),
|
||||||
"float": dict(opttype="FloatOption", func=float),
|
"float": dict(opttype="FloatOption", func=float, example=1.42),
|
||||||
"boolean": dict(opttype="BoolOption", func=convert_boolean),
|
"boolean": dict(opttype="BoolOption", func=convert_boolean),
|
||||||
"secret": dict(opttype="PasswordOption"),
|
"secret": dict(opttype="PasswordOption", example="xxx"),
|
||||||
"mail": dict(opttype="EmailOption"),
|
"mail": dict(opttype="EmailOption", example="user@example.net"),
|
||||||
"unix_filename": dict(opttype="FilenameOption"),
|
"unix_filename": dict(opttype="FilenameOption", example="/tmp/myfile.txt"),
|
||||||
"date": dict(opttype="DateOption"),
|
"date": dict(opttype="DateOption", example="2000-01-01"),
|
||||||
"unix_user": dict(opttype="UsernameOption"),
|
"unix_user": dict(opttype="UsernameOption", example="xxx"),
|
||||||
"ip": dict(opttype="IPOption", initkwargs={"allow_reserved": True}),
|
"ip": dict(opttype="IPOption", initkwargs={"allow_reserved": True}, example="1.1.1.1"),
|
||||||
"cidr": dict(opttype="IPOption", initkwargs={"cidr": True}),
|
"cidr": dict(opttype="IPOption", initkwargs={"cidr": True}, example="1.1.1.0/24"),
|
||||||
"netmask": dict(opttype="NetmaskOption"),
|
"netmask": dict(opttype="NetmaskOption", example="255.255.255.0"),
|
||||||
"network": dict(opttype="NetworkOption"),
|
"network": dict(opttype="NetworkOption", example="1.1.1.0"),
|
||||||
"network_cidr": dict(opttype="NetworkOption", initkwargs={"cidr": True}),
|
"network_cidr": dict(opttype="NetworkOption", initkwargs={"cidr": True}, example="1.1.1.0/24"),
|
||||||
"broadcast": dict(opttype="BroadcastOption"),
|
"broadcast": dict(opttype="BroadcastOption", example="1.1.1.255"),
|
||||||
"netbios": dict(
|
"netbios": dict(
|
||||||
opttype="DomainnameOption",
|
opttype="DomainnameOption",
|
||||||
initkwargs={"type": "netbios", "warnings_only": True},
|
initkwargs={"type": "netbios", "warnings_only": True},
|
||||||
|
example="example"
|
||||||
),
|
),
|
||||||
"domainname": dict(
|
"domainname": dict(
|
||||||
opttype="DomainnameOption", initkwargs={"type": "domainname", "allow_ip": False}
|
opttype="DomainnameOption", initkwargs={"type": "domainname", "allow_ip": False},
|
||||||
|
example="example.net"
|
||||||
),
|
),
|
||||||
"hostname": dict(
|
"hostname": dict(
|
||||||
opttype="DomainnameOption", initkwargs={"type": "hostname", "allow_ip": False}
|
opttype="DomainnameOption", initkwargs={"type": "hostname", "allow_ip": False},
|
||||||
|
example="example"
|
||||||
),
|
),
|
||||||
"web_address": dict(
|
"web_address": dict(
|
||||||
opttype="URLOption", initkwargs={"allow_ip": False, "allow_without_dot": True}
|
opttype="URLOption", initkwargs={"allow_ip": False, "allow_without_dot": True},
|
||||||
|
example="https://example.net"
|
||||||
),
|
),
|
||||||
"port": dict(opttype="PortOption", initkwargs={"allow_private": True}),
|
"port": dict(opttype="PortOption", initkwargs={"allow_private": True}, example="111"),
|
||||||
"mac": dict(opttype="MACOption"),
|
"mac": dict(opttype="MACOption", example="00:00:00:00:00"),
|
||||||
"unix_permissions": dict(
|
"unix_permissions": dict(
|
||||||
opttype="PermissionsOption", initkwargs={"warnings_only": True}, func=int
|
opttype="PermissionsOption", initkwargs={"warnings_only": True}, func=int,
|
||||||
|
example="644"
|
||||||
),
|
),
|
||||||
"choice": dict(opttype="ChoiceOption"),
|
"choice": dict(opttype="ChoiceOption", example="xxx"),
|
||||||
#
|
#
|
||||||
"symlink": dict(opttype="SymLinkOption"),
|
"symlink": dict(opttype="SymLinkOption"),
|
||||||
}
|
}
|
||||||
|
@ -164,6 +169,7 @@ class Calculation(BaseModel):
|
||||||
path: str
|
path: str
|
||||||
inside_list: bool
|
inside_list: bool
|
||||||
version: str
|
version: str
|
||||||
|
default_values: Any=None
|
||||||
namespace: str
|
namespace: str
|
||||||
xmlfiles: List[str]
|
xmlfiles: List[str]
|
||||||
|
|
||||||
|
@ -219,6 +225,7 @@ class JinjaCalculation(Calculation):
|
||||||
jinja: StrictStr
|
jinja: StrictStr
|
||||||
params: Optional[List[Param]] = None
|
params: Optional[List[Param]] = None
|
||||||
return_type: BASETYPE = None
|
return_type: BASETYPE = None
|
||||||
|
description: Optional[StrictStr] = None
|
||||||
|
|
||||||
def _jinja_to_function(
|
def _jinja_to_function(
|
||||||
self,
|
self,
|
||||||
|
@ -245,6 +252,8 @@ class JinjaCalculation(Calculation):
|
||||||
"__internal_multi": multi,
|
"__internal_multi": multi,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
if self.default_values:
|
||||||
|
default["params"]['__default_value'] = self.default_values
|
||||||
if add_help:
|
if add_help:
|
||||||
default["help"] = function + "_help"
|
default["help"] = function + "_help"
|
||||||
if self.params:
|
if self.params:
|
||||||
|
@ -357,17 +366,20 @@ class VariableCalculation(Calculation):
|
||||||
"variable": variable,
|
"variable": variable,
|
||||||
"propertyerror": self.propertyerror,
|
"propertyerror": self.propertyerror,
|
||||||
}
|
}
|
||||||
if suffix:
|
|
||||||
param["suffix"] = suffix
|
|
||||||
params = {None: [param]}
|
params = {None: [param]}
|
||||||
function = "calc_value"
|
if self.default_values:
|
||||||
help_function = None
|
params['__default_value'] = self.default_values
|
||||||
if self.attribute_name in PROPERTY_ATTRIBUTE:
|
if self.attribute_name in PROPERTY_ATTRIBUTE:
|
||||||
function = "variable_to_property"
|
function = "variable_to_property"
|
||||||
help_function = "variable_to_property"
|
help_function = "variable_to_property"
|
||||||
if variable.type != "boolean":
|
if variable.type != "boolean":
|
||||||
raise Exception("only boolean!")
|
raise Exception("only boolean!")
|
||||||
params[None].insert(0, self.attribute_name)
|
params[None].insert(0, self.attribute_name)
|
||||||
|
else:
|
||||||
|
function = "calc_value"
|
||||||
|
help_function = None
|
||||||
|
if suffix:
|
||||||
|
param["suffix"] = suffix
|
||||||
if self.allow_none:
|
if self.allow_none:
|
||||||
params["allow_none"] = True
|
params["allow_none"] = True
|
||||||
# current variable is a multi
|
# current variable is a multi
|
||||||
|
@ -377,7 +389,16 @@ class VariableCalculation(Calculation):
|
||||||
needs_multi = True
|
needs_multi = True
|
||||||
else:
|
else:
|
||||||
needs_multi = self.path in objectspace.multis
|
needs_multi = self.path in objectspace.multis
|
||||||
calc_variable_is_multi = variable.path in objectspace.multis or (variable.path in objectspace.paths._dynamics and (suffix is None or suffix[-1] is None) and objectspace.paths._dynamics[variable.path] != objectspace.paths._dynamics.get(self.path))
|
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):
|
||||||
|
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}.'):
|
||||||
|
calc_variable_is_multi = True
|
||||||
|
else:
|
||||||
|
calc_variable_is_multi = True
|
||||||
if needs_multi:
|
if needs_multi:
|
||||||
if calc_variable_is_multi:
|
if calc_variable_is_multi:
|
||||||
if self.inside_list:
|
if self.inside_list:
|
||||||
|
@ -410,9 +431,10 @@ class InformationCalculation(Calculation):
|
||||||
self,
|
self,
|
||||||
objectspace,
|
objectspace,
|
||||||
) -> dict:
|
) -> dict:
|
||||||
param = {
|
params = {None: [{
|
||||||
"type": "information",
|
"type": "information",
|
||||||
"information": self.information,
|
"information": self.information,
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
if self.variable:
|
if self.variable:
|
||||||
variable, suffix = objectspace.paths.get_with_dynamic(
|
variable, suffix = objectspace.paths.get_with_dynamic(
|
||||||
|
@ -420,10 +442,12 @@ class InformationCalculation(Calculation):
|
||||||
)
|
)
|
||||||
if variable is None or suffix is not None:
|
if variable is None or suffix is not None:
|
||||||
raise Exception("pfff")
|
raise Exception("pfff")
|
||||||
param["variable"] = variable
|
params[None][0]["variable"] = variable
|
||||||
|
if self.default_values:
|
||||||
|
params['__default_value'] = self.default_values
|
||||||
return {
|
return {
|
||||||
"function": "calc_value",
|
"function": "calc_value",
|
||||||
"params": {None: [param]},
|
"params": params,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -480,14 +504,15 @@ class Family(BaseModel):
|
||||||
hidden: Union[bool, Calculation] = False
|
hidden: Union[bool, Calculation] = False
|
||||||
disabled: Union[bool, Calculation] = False
|
disabled: Union[bool, Calculation] = False
|
||||||
namespace: Optional[str]
|
namespace: Optional[str]
|
||||||
|
version: str
|
||||||
xmlfiles: List[str] = []
|
xmlfiles: List[str] = []
|
||||||
|
|
||||||
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
model_config = ConfigDict(extra="forbid", arbitrary_types_allowed=True)
|
||||||
|
|
||||||
|
|
||||||
class Dynamic(Family):
|
class Dynamic(Family):
|
||||||
variable: str=None
|
|
||||||
# None only for format 1.0
|
# None only for format 1.0
|
||||||
|
variable: str=None
|
||||||
dynamic: Union[List[Union[StrictStr, Calculation]], Calculation]
|
dynamic: Union[List[Union[StrictStr, Calculation]], Calculation]
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ from .utils import normalize_family
|
||||||
|
|
||||||
|
|
||||||
global func
|
global func
|
||||||
func = {'calc_value': calc_value}
|
func = {}
|
||||||
dict_env = {}
|
dict_env = {}
|
||||||
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
ENV = SandboxedEnvironment(loader=DictLoader(dict_env), undefined=StrictUndefined)
|
||||||
ENV.filters = func
|
ENV.filters = func
|
||||||
|
@ -60,7 +60,14 @@ def load_functions(path):
|
||||||
func[function] = getattr(func_, function)
|
func[function] = getattr(func_, function)
|
||||||
|
|
||||||
|
|
||||||
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwargs):
|
def rougail_calc_value(*args, __default_value=None, **kwargs):
|
||||||
|
values = calc_value(*args, **kwargs)
|
||||||
|
if __default_value is not None and values in [None, []]:
|
||||||
|
return __default_value
|
||||||
|
return values
|
||||||
|
|
||||||
|
|
||||||
|
def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, __default_value=None, **kwargs):
|
||||||
global ENV, CONVERT_OPTION
|
global ENV, CONVERT_OPTION
|
||||||
kw = {}
|
kw = {}
|
||||||
for key, value in kwargs.items():
|
for key, value in kwargs.items():
|
||||||
|
@ -75,9 +82,15 @@ def jinja_to_function(__internal_jinja, __internal_type, __internal_multi, **kwa
|
||||||
values = ENV.get_template(__internal_jinja).render(kw, **func).strip()
|
values = ENV.get_template(__internal_jinja).render(kw, **func).strip()
|
||||||
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
convert = CONVERT_OPTION[__internal_type].get('func', str)
|
||||||
if __internal_multi:
|
if __internal_multi:
|
||||||
return [convert(val) for val in values.split()]
|
values = [convert(val) for val in values.split()]
|
||||||
|
if not values and __default_value is not None:
|
||||||
|
return __default_value
|
||||||
|
return values
|
||||||
values = convert(values)
|
values = convert(values)
|
||||||
return values if values != '' and values != 'None' else None
|
values = values if values != '' and values != 'None' else None
|
||||||
|
if values is None and __default_value is not None:
|
||||||
|
return __default_value
|
||||||
|
return values
|
||||||
|
|
||||||
|
|
||||||
def variable_to_property(prop, value):
|
def variable_to_property(prop, value):
|
||||||
|
@ -104,6 +117,7 @@ def valid_with_jinja(warnings_only=False, **kwargs):
|
||||||
raise ValueError(value)
|
raise ValueError(value)
|
||||||
|
|
||||||
|
|
||||||
|
func['calc_value'] = rougail_calc_value
|
||||||
func['jinja_to_function'] = jinja_to_function
|
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
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
---
|
||||||
|
_version: '1.1'
|
||||||
|
version: # a variable
|
10
tests/dictionaries/00_0version_underscore/tiramisu/base.py
Normal file
10
tests/dictionaries/00_0version_underscore/tiramisu/base.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
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_2 = StrOption(name="version", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
14
tests/dictionaries/00_0version_underscore/tiramisu/multi.py
Normal file
14
tests/dictionaries/00_0version_underscore/tiramisu/multi.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
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_3 = StrOption(name="version", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
optiondescription_2 = OptionDescription(name="rougail", doc="rougail", children=[option_3], properties=frozenset({"basic"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||||
|
option_6 = StrOption(name="version", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
optiondescription_5 = OptionDescription(name="rougail", doc="rougail", children=[option_6], properties=frozenset({"basic"}))
|
||||||
|
optiondescription_4 = OptionDescription(name="2", doc="2", children=[optiondescription_5], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_4])
|
3
tests/dictionaries/00_1empty_variable/makedict/base.json
Normal file
3
tests/dictionaries/00_1empty_variable/makedict/base.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"rougail.empty": null
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
var1: "no" # a first variable
|
||||||
|
var2:
|
||||||
|
description: a second variable
|
||||||
|
multi: true
|
||||||
|
default:
|
||||||
|
type: jinja
|
||||||
|
jinja: |
|
||||||
|
{{ _.val1 }}
|
||||||
|
description: the value of var1
|
|
@ -0,0 +1,16 @@
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
var1: # a first variable
|
||||||
|
- 'no'
|
||||||
|
- 'yes'
|
||||||
|
- maybe
|
||||||
|
var2:
|
||||||
|
description: a second variable
|
||||||
|
multi: true
|
||||||
|
default:
|
||||||
|
type: jinja
|
||||||
|
jinja: |
|
||||||
|
{% for val in _.var1 %}
|
||||||
|
{{ val }}
|
||||||
|
{% endfor %}
|
||||||
|
description: the value of _.var1
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
version: '1.0'
|
||||||
|
var1:
|
||||||
|
description: a variable
|
|
@ -0,0 +1,4 @@
|
||||||
|
---
|
||||||
|
version: "1.0"
|
||||||
|
var2:
|
||||||
|
description: a variable
|
10
tests/dictionaries/00_4load_subfolder/makedict/after.json
Normal file
10
tests/dictionaries/00_4load_subfolder/makedict/after.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
}
|
4
tests/dictionaries/00_4load_subfolder/makedict/base.json
Normal file
4
tests/dictionaries/00_4load_subfolder/makedict/base.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": null,
|
||||||
|
"rougail.var2": null
|
||||||
|
}
|
10
tests/dictionaries/00_4load_subfolder/makedict/before.json
Normal file
10
tests/dictionaries/00_4load_subfolder/makedict/before.json
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1 @@
|
||||||
|
["rougail.var1", "rougail.var2"]
|
11
tests/dictionaries/00_4load_subfolder/tiramisu/base.py
Normal file
11
tests/dictionaries/00_4load_subfolder/tiramisu/base.py
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
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_2 = StrOption(name="var1", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_3 = StrOption(name="var2", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
16
tests/dictionaries/00_4load_subfolder/tiramisu/multi.py
Normal file
16
tests/dictionaries/00_4load_subfolder/tiramisu/multi.py
Normal file
|
@ -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_3 = StrOption(name="var1", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_4 = StrOption(name="var2", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
optiondescription_2 = OptionDescription(name="rougail", doc="rougail", children=[option_3, option_4], properties=frozenset({"basic"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||||
|
option_7 = StrOption(name="var1", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_8 = StrOption(name="var2", doc="a variable", properties=frozenset({"basic", "mandatory"}))
|
||||||
|
optiondescription_6 = OptionDescription(name="rougail", doc="rougail", children=[option_7, option_8], properties=frozenset({"basic"}))
|
||||||
|
optiondescription_5 = OptionDescription(name="2", doc="2", children=[optiondescription_6], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_5])
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
version: '1.0'
|
||||||
|
without_type:
|
||||||
|
description: a variable
|
||||||
|
default: non
|
6
tests/dictionaries/00_5load_notype/makedict/after.json
Normal file
6
tests/dictionaries/00_5load_notype/makedict/after.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.without_type": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
}
|
||||||
|
}
|
3
tests/dictionaries/00_5load_notype/makedict/base.json
Normal file
3
tests/dictionaries/00_5load_notype/makedict/base.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"rougail.without_type": "non"
|
||||||
|
}
|
6
tests/dictionaries/00_5load_notype/makedict/before.json
Normal file
6
tests/dictionaries/00_5load_notype/makedict/before.json
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.without_type": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "non"
|
||||||
|
}
|
||||||
|
}
|
10
tests/dictionaries/00_5load_notype/tiramisu/base.py
Normal file
10
tests/dictionaries/00_5load_notype/tiramisu/base.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
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_2 = StrOption(name="without_type", doc="a variable", default="non", properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
14
tests/dictionaries/00_5load_notype/tiramisu/multi.py
Normal file
14
tests/dictionaries/00_5load_notype/tiramisu/multi.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
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_3 = StrOption(name="without_type", doc="a variable", default="non", properties=frozenset({"mandatory", "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="without_type", doc="a variable", default="non", properties=frozenset({"mandatory", "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])
|
|
@ -0,0 +1,18 @@
|
||||||
|
---
|
||||||
|
version: '1.1'
|
||||||
|
var1: true # the first variable
|
||||||
|
var2:
|
||||||
|
description: the second variable
|
||||||
|
default: true
|
||||||
|
var3:
|
||||||
|
description: the third variable
|
||||||
|
type: boolean
|
||||||
|
default: true
|
||||||
|
var4: false # the forth variable
|
||||||
|
var5:
|
||||||
|
description: the fifth variable
|
||||||
|
default: false
|
||||||
|
var6:
|
||||||
|
description: the sixth variable
|
||||||
|
type: boolean
|
||||||
|
default: false
|
26
tests/dictionaries/00_6boolean/makedict/after.json
Normal file
26
tests/dictionaries/00_6boolean/makedict/after.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"rougail.var3": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"rougail.var4": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"rougail.var5": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"rougail.var6": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
}
|
||||||
|
}
|
8
tests/dictionaries/00_6boolean/makedict/base.json
Normal file
8
tests/dictionaries/00_6boolean/makedict/base.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": true,
|
||||||
|
"rougail.var2": true,
|
||||||
|
"rougail.var3": true,
|
||||||
|
"rougail.var4": false,
|
||||||
|
"rougail.var5": false,
|
||||||
|
"rougail.var6": false
|
||||||
|
}
|
26
tests/dictionaries/00_6boolean/makedict/before.json
Normal file
26
tests/dictionaries/00_6boolean/makedict/before.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"rougail.var3": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
},
|
||||||
|
"rougail.var4": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"rougail.var5": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"rougail.var6": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
}
|
||||||
|
}
|
15
tests/dictionaries/00_6boolean/tiramisu/base.py
Normal file
15
tests/dictionaries/00_6boolean/tiramisu/base.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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_2 = BoolOption(name="var1", doc="the first variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_3 = BoolOption(name="var2", doc="the second variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_4 = BoolOption(name="var3", doc="the third variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_5 = BoolOption(name="var4", doc="the forth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_6 = BoolOption(name="var5", doc="the fifth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_7 = BoolOption(name="var6", doc="the sixth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4, option_5, option_6, option_7], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
24
tests/dictionaries/00_6boolean/tiramisu/multi.py
Normal file
24
tests/dictionaries/00_6boolean/tiramisu/multi.py
Normal file
|
@ -0,0 +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')
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||||
|
option_3 = BoolOption(name="var1", doc="the first variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_4 = BoolOption(name="var2", doc="the second variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_5 = BoolOption(name="var3", doc="the third variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_6 = BoolOption(name="var4", doc="the forth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_7 = BoolOption(name="var5", doc="the fifth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_8 = BoolOption(name="var6", doc="the sixth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_2 = OptionDescription(name="rougail", doc="rougail", children=[option_3, option_4, option_5, option_6, option_7, option_8], properties=frozenset({"standard"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||||
|
option_11 = BoolOption(name="var1", doc="the first variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_12 = BoolOption(name="var2", doc="the second variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_13 = BoolOption(name="var3", doc="the third variable", default=True, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_14 = BoolOption(name="var4", doc="the forth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_15 = BoolOption(name="var5", doc="the fifth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_16 = BoolOption(name="var6", doc="the sixth variable", default=False, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_10 = OptionDescription(name="rougail", doc="rougail", children=[option_11, option_12, option_13, option_14, option_15, option_16], properties=frozenset({"standard"}))
|
||||||
|
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_9])
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
version: '1.1'
|
||||||
|
variable:
|
||||||
|
description: a variable
|
||||||
|
type: boolean
|
||||||
|
mandatory: false
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"rougail.variable": true
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
{
|
||||||
|
"rougail.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
10
tests/dictionaries/00_6boolean_no_mandatory/tiramisu/base.py
Normal file
10
tests/dictionaries/00_6boolean_no_mandatory/tiramisu/base.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
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_2 = BoolOption(name="variable", doc="a family", default=True, properties=frozenset({"standard"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -0,0 +1,14 @@
|
||||||
|
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_3 = BoolOption(name="variable", doc="a family", default=True, properties=frozenset({"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 = BoolOption(name="variable", doc="a family", default=True, properties=frozenset({"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])
|
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
version: '1.1'
|
||||||
|
var1:
|
||||||
|
description: the first variable
|
||||||
|
choices:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
var2:
|
||||||
|
description: the second variable
|
||||||
|
choices:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
var3:
|
||||||
|
description: the third variable
|
||||||
|
choices:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
mandatory: false
|
||||||
|
var4:
|
||||||
|
description: the forth variable
|
||||||
|
choices:
|
||||||
|
- null
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
mandatory: false
|
||||||
|
var5:
|
||||||
|
description: the fifth variable
|
||||||
|
choices:
|
||||||
|
- a
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
default: a
|
||||||
|
var6:
|
||||||
|
description: the sixth variable
|
||||||
|
choices:
|
||||||
|
- 1
|
||||||
|
- 2
|
||||||
|
- 3
|
||||||
|
default: 1
|
26
tests/dictionaries/00_6choice/makedict/after.json
Normal file
26
tests/dictionaries/00_6choice/makedict/after.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var3": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var4": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var5": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a"
|
||||||
|
},
|
||||||
|
"rougail.var6": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": 1
|
||||||
|
}
|
||||||
|
}
|
8
tests/dictionaries/00_6choice/makedict/base.json
Normal file
8
tests/dictionaries/00_6choice/makedict/base.json
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": null,
|
||||||
|
"rougail.var2": null,
|
||||||
|
"rougail.var3": null,
|
||||||
|
"rougail.var4": null,
|
||||||
|
"rougail.var5": "a",
|
||||||
|
"rougail.var6": 1
|
||||||
|
}
|
26
tests/dictionaries/00_6choice/makedict/before.json
Normal file
26
tests/dictionaries/00_6choice/makedict/before.json
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
{
|
||||||
|
"rougail.var1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var3": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var4": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.var5": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "a"
|
||||||
|
},
|
||||||
|
"rougail.var6": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": 1
|
||||||
|
}
|
||||||
|
}
|
1
tests/dictionaries/00_6choice/makedict/mandatory.json
Normal file
1
tests/dictionaries/00_6choice/makedict/mandatory.json
Normal file
|
@ -0,0 +1 @@
|
||||||
|
["rougail.var1", "rougail.var2"]
|
15
tests/dictionaries/00_6choice/tiramisu/base.py
Normal file
15
tests/dictionaries/00_6choice/tiramisu/base.py
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
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_2 = ChoiceOption(name="var1", doc="the first variable", values=("a", "b", "c"), properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_3 = ChoiceOption(name="var2", doc="the second variable", values=("a", "b", "c"), properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_4 = ChoiceOption(name="var3", doc="the third variable", values=("a", "b", "c", None), properties=frozenset({"standard"}))
|
||||||
|
option_5 = ChoiceOption(name="var4", doc="the forth variable", values=(None, "b", "c"), properties=frozenset({"standard"}))
|
||||||
|
option_6 = ChoiceOption(name="var5", doc="the fifth variable", values=("a", "b", "c"), default="a", properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_7 = ChoiceOption(name="var6", doc="the sixth variable", values=(1, 2, 3), default=1, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="rougail", children=[option_2, option_3, option_4, option_5, option_6, option_7], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
24
tests/dictionaries/00_6choice/tiramisu/multi.py
Normal file
24
tests/dictionaries/00_6choice/tiramisu/multi.py
Normal file
|
@ -0,0 +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')
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||||
|
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||||
|
option_3 = ChoiceOption(name="var1", doc="the first variable", values=("a", "b", "c"), properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_4 = ChoiceOption(name="var2", doc="the second variable", values=("a", "b", "c"), properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_5 = ChoiceOption(name="var3", doc="the third variable", values=("a", "b", "c", None), properties=frozenset({"standard"}))
|
||||||
|
option_6 = ChoiceOption(name="var4", doc="the forth variable", values=(None, "b", "c"), properties=frozenset({"standard"}))
|
||||||
|
option_7 = ChoiceOption(name="var5", doc="the fifth variable", values=("a", "b", "c"), default="a", properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_8 = ChoiceOption(name="var6", doc="the sixth variable", values=(1, 2, 3), default=1, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_2 = OptionDescription(name="rougail", doc="rougail", children=[option_3, option_4, option_5, option_6, option_7, option_8], properties=frozenset({"basic"}))
|
||||||
|
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||||
|
option_11 = ChoiceOption(name="var1", doc="the first variable", values=("a", "b", "c"), properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_12 = ChoiceOption(name="var2", doc="the second variable", values=("a", "b", "c"), properties=frozenset({"basic", "mandatory"}))
|
||||||
|
option_13 = ChoiceOption(name="var3", doc="the third variable", values=("a", "b", "c", None), properties=frozenset({"standard"}))
|
||||||
|
option_14 = ChoiceOption(name="var4", doc="the forth variable", values=(None, "b", "c"), properties=frozenset({"standard"}))
|
||||||
|
option_15 = ChoiceOption(name="var5", doc="the fifth variable", values=("a", "b", "c"), default="a", properties=frozenset({"mandatory", "standard"}))
|
||||||
|
option_16 = ChoiceOption(name="var6", doc="the sixth variable", values=(1, 2, 3), default=1, properties=frozenset({"mandatory", "standard"}))
|
||||||
|
optiondescription_10 = OptionDescription(name="rougail", doc="rougail", children=[option_11, option_12, option_13, option_14, option_15, option_16], properties=frozenset({"basic"}))
|
||||||
|
optiondescription_9 = OptionDescription(name="2", doc="2", children=[optiondescription_10], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_9])
|
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
version: 1.1
|
||||||
|
var:
|
||||||
|
description: a variable
|
||||||
|
default: 9
|
||||||
|
choices:
|
||||||
|
type: jinja
|
||||||
|
jinja: |
|
||||||
|
{% for n in trange(0, 10) %}
|
||||||
|
{{ n }}
|
||||||
|
{% endfor %}
|
||||||
|
return_type: 'number'
|
||||||
|
description: choices is 0 to 9
|
|
@ -0,0 +1,12 @@
|
||||||
|
---
|
||||||
|
version: '1.1'
|
||||||
|
var1: # a second variable
|
||||||
|
- a
|
||||||
|
- b
|
||||||
|
- c
|
||||||
|
var2:
|
||||||
|
description: a first variable
|
||||||
|
default: a
|
||||||
|
choices:
|
||||||
|
type: variable
|
||||||
|
variable: _.var1
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue