Compare commits
4 commits
63f76dc68f
...
b0687fdcc6
| Author | SHA1 | Date | |
|---|---|---|---|
| b0687fdcc6 | |||
| cc5aaf6393 | |||
| df2fcb467f | |||
| 7b9d7ce419 |
81 changed files with 1116 additions and 93 deletions
11
CHANGELOG.md
11
CHANGELOG.md
|
|
@ -1,3 +1,14 @@
|
||||||
|
## 1.2.0a9 (2025-02-10)
|
||||||
|
|
||||||
|
### Feat
|
||||||
|
|
||||||
|
- can change defaut params for an option
|
||||||
|
|
||||||
|
### Fix
|
||||||
|
|
||||||
|
- if no description, generate negative_description too
|
||||||
|
- error messages
|
||||||
|
|
||||||
## 1.2.0a8 (2025-01-04)
|
## 1.2.0a8 (2025-01-04)
|
||||||
|
|
||||||
### Fix
|
### Fix
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ msgid ""
|
||||||
"the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the "
|
"the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the "
|
||||||
"higher family mode \"{2}\""
|
"higher family mode \"{2}\""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"la variable \"{0}\" est obligatoire donc dans le mode \"{1}\" mais la "
|
"la variable \"{0}\" est obligatoire, donc en mode \"{1}\", mais la "
|
||||||
"famille a un mode supérieur \"{2}\""
|
"famille a un mode supérieur \"{2}\""
|
||||||
|
|
||||||
#: src/rougail/annotator/family.py:287
|
#: src/rougail/annotator/family.py:287
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "rougail"
|
name = "rougail"
|
||||||
version = "1.2.0a8"
|
version = "1.2.0a9"
|
||||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
description = "A consistency handling system that was initially designed in the configuration management"
|
description = "A consistency handling system that was initially designed in the configuration management"
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -136,6 +136,7 @@ class Annotator(Walk):
|
||||||
)
|
)
|
||||||
if family.version == "1.0" and "{{ suffix }}" in path:
|
if family.version == "1.0" and "{{ suffix }}" in path:
|
||||||
path = path.replace("{{ suffix }}", "{{ identifier }}")
|
path = path.replace("{{ suffix }}", "{{ identifier }}")
|
||||||
|
self.objectspace.dynamics_variable.setdefault(path, []).append(family.path)
|
||||||
self.objectspace.informations.add(family.path, "dynamic_variable", path)
|
self.objectspace.informations.add(family.path, "dynamic_variable", path)
|
||||||
|
|
||||||
def change_modes(self):
|
def change_modes(self):
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -130,14 +130,7 @@ class Annotator(Walk): # pylint: disable=R0903
|
||||||
):
|
):
|
||||||
return
|
return
|
||||||
# copy type and params
|
# copy type and params
|
||||||
calculated_variable_path = variable.default.variable
|
calculated_variable, identifier = variable.default.get_variable(self.objectspace)
|
||||||
calculated_variable, identifier = self.objectspace.paths.get_with_dynamic(
|
|
||||||
calculated_variable_path,
|
|
||||||
variable.path,
|
|
||||||
variable.version,
|
|
||||||
variable.namespace,
|
|
||||||
variable.xmlfiles,
|
|
||||||
)
|
|
||||||
if calculated_variable is None:
|
if calculated_variable is None:
|
||||||
return
|
return
|
||||||
variable.type = calculated_variable.type
|
variable.type = calculated_variable.type
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -33,6 +33,7 @@ from tiramisu import Config
|
||||||
from ruamel.yaml import YAML
|
from ruamel.yaml import YAML
|
||||||
from .utils import _, load_modules, normalize_family
|
from .utils import _, load_modules, normalize_family
|
||||||
from .convert import RougailConvert
|
from .convert import RougailConvert
|
||||||
|
from .object_model import get_convert_option_types
|
||||||
|
|
||||||
if version_info.major == 3 and version_info.minor:
|
if version_info.major == 3 and version_info.minor:
|
||||||
import rougail.structural_commandline.object_model
|
import rougail.structural_commandline.object_model
|
||||||
|
|
@ -72,27 +73,24 @@ def get_level(module):
|
||||||
|
|
||||||
|
|
||||||
class _RougailConfig:
|
class _RougailConfig:
|
||||||
def __init__(self, backward_compatibility: bool, root, extra_vars: dict):
|
def __init__(self, backward_compatibility: bool,
|
||||||
|
add_extra_options: bool):
|
||||||
self.backward_compatibility = backward_compatibility
|
self.backward_compatibility = backward_compatibility
|
||||||
self.root = root
|
self.add_extra_options = add_extra_options
|
||||||
self.config = Config(
|
self.root = None
|
||||||
self.root,
|
|
||||||
)
|
|
||||||
self.config.property.read_only()
|
|
||||||
self.extra_vars = extra_vars
|
|
||||||
self.not_in_tiramisu = NOT_IN_TIRAMISU | extra_vars
|
|
||||||
for variable, default_value in self.not_in_tiramisu.items():
|
|
||||||
if not isinstance(default_value, str):
|
|
||||||
default_value = default_value.copy()
|
|
||||||
setattr(self, variable, default_value)
|
|
||||||
|
|
||||||
def copy(self):
|
def copy(self):
|
||||||
rougailconfig = _RougailConfig(
|
rougailconfig = _RougailConfig(
|
||||||
self.backward_compatibility, self.root, self.extra_vars
|
self.backward_compatibility,
|
||||||
|
self.add_extra_options,
|
||||||
)
|
)
|
||||||
|
if self.root:
|
||||||
rougailconfig.config.value.importation(self.config.value.exportation())
|
rougailconfig.config.value.importation(self.config.value.exportation())
|
||||||
rougailconfig.config.property.importation(self.config.property.exportation())
|
rougailconfig.config.property.importation(self.config.property.exportation())
|
||||||
rougailconfig.config.property.read_only()
|
rougailconfig.config.property.read_only()
|
||||||
|
rougailconfig.root = self.root
|
||||||
|
rougailconfig.config = self.config
|
||||||
|
rougailconfig.extra_vars = self.extra_vars
|
||||||
for variable in self.not_in_tiramisu:
|
for variable in self.not_in_tiramisu:
|
||||||
value = getattr(self, variable)
|
value = getattr(self, variable)
|
||||||
if not isinstance(value, str):
|
if not isinstance(value, str):
|
||||||
|
|
@ -100,11 +98,27 @@ class _RougailConfig:
|
||||||
setattr(rougailconfig, variable, value)
|
setattr(rougailconfig, variable, value)
|
||||||
return rougailconfig
|
return rougailconfig
|
||||||
|
|
||||||
|
def generate_config(self):
|
||||||
|
root, extra_vars = _rougail_config(self.backward_compatibility, self.add_extra_options)
|
||||||
|
self.root = root
|
||||||
|
self.config = Config(
|
||||||
|
self.root,
|
||||||
|
)
|
||||||
|
self.extra_vars = extra_vars
|
||||||
|
self.not_in_tiramisu = NOT_IN_TIRAMISU | extra_vars
|
||||||
|
for variable, default_value in self.not_in_tiramisu.items():
|
||||||
|
if not isinstance(default_value, str):
|
||||||
|
default_value = default_value.copy()
|
||||||
|
setattr(self, variable, default_value)
|
||||||
|
self.config.property.read_only()
|
||||||
|
|
||||||
def __setitem__(
|
def __setitem__(
|
||||||
self,
|
self,
|
||||||
key,
|
key,
|
||||||
value,
|
value,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if self.root is None:
|
||||||
|
self.generate_config()
|
||||||
if key in self.not_in_tiramisu:
|
if key in self.not_in_tiramisu:
|
||||||
setattr(self, key, value)
|
setattr(self, key, value)
|
||||||
else:
|
else:
|
||||||
|
|
@ -130,6 +144,8 @@ class _RougailConfig:
|
||||||
self,
|
self,
|
||||||
key,
|
key,
|
||||||
) -> None:
|
) -> None:
|
||||||
|
if self.root is None:
|
||||||
|
self.generate_config()
|
||||||
if key in self.not_in_tiramisu:
|
if key in self.not_in_tiramisu:
|
||||||
return getattr(self, key)
|
return getattr(self, key)
|
||||||
if key == "export_with_import":
|
if key == "export_with_import":
|
||||||
|
|
@ -199,11 +215,10 @@ class FakeRougailConvert(RougailConvert):
|
||||||
self.load_unexist_redefine = False
|
self.load_unexist_redefine = False
|
||||||
|
|
||||||
|
|
||||||
def get_rougail_config(
|
def _rougail_config(
|
||||||
*,
|
|
||||||
backward_compatibility: bool = True,
|
backward_compatibility: bool = True,
|
||||||
add_extra_options: bool = True,
|
add_extra_options: bool = True,
|
||||||
) -> _RougailConfig:
|
) -> "OptionDescription":
|
||||||
rougail_options = f"""default_dictionary_format_version:
|
rougail_options = f"""default_dictionary_format_version:
|
||||||
description: Dictionary format version by default, if not specified in dictionary file
|
description: Dictionary format version by default, if not specified in dictionary file
|
||||||
alternative_name: v
|
alternative_name: v
|
||||||
|
|
@ -403,6 +418,23 @@ load_unexist_redefine:
|
||||||
NAME=normalize_family(process),
|
NAME=normalize_family(process),
|
||||||
PROP=prop,
|
PROP=prop,
|
||||||
)
|
)
|
||||||
|
rougail_process += f"""
|
||||||
|
default_params:
|
||||||
|
description: {_("Default parameters for option type")}
|
||||||
|
|
||||||
|
"""
|
||||||
|
for typ, params in get_convert_option_types():
|
||||||
|
rougail_process += f"""
|
||||||
|
{typ}:
|
||||||
|
"""
|
||||||
|
for key, key_type, multi, value in params:
|
||||||
|
rougail_process += f"""
|
||||||
|
{key}:
|
||||||
|
type: {key_type}
|
||||||
|
multi: {multi}
|
||||||
|
mandatory: false
|
||||||
|
default: {value}
|
||||||
|
"""
|
||||||
rougail_options += rougail_process
|
rougail_options += rougail_process
|
||||||
# print(rougail_options)
|
# print(rougail_options)
|
||||||
convert = FakeRougailConvert(add_extra_options)
|
convert = FakeRougailConvert(add_extra_options)
|
||||||
|
|
@ -438,10 +470,17 @@ load_unexist_redefine:
|
||||||
tiram_obj = convert.save()
|
tiram_obj = convert.save()
|
||||||
optiondescription = {}
|
optiondescription = {}
|
||||||
exec(tiram_obj, {}, optiondescription) # pylint: disable=W0122
|
exec(tiram_obj, {}, optiondescription) # pylint: disable=W0122
|
||||||
|
return optiondescription["option_0"], extra_vars
|
||||||
|
|
||||||
|
|
||||||
|
def get_rougail_config(
|
||||||
|
*,
|
||||||
|
backward_compatibility: bool = True,
|
||||||
|
add_extra_options: bool = True,
|
||||||
|
) -> _RougailConfig:
|
||||||
return _RougailConfig(
|
return _RougailConfig(
|
||||||
backward_compatibility,
|
backward_compatibility,
|
||||||
optiondescription["option_0"],
|
add_extra_options,
|
||||||
extra_vars=extra_vars,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -135,7 +135,7 @@ class ParserVariable:
|
||||||
self.reflector_names = {}
|
self.reflector_names = {}
|
||||||
self.leaders = []
|
self.leaders = []
|
||||||
self.followers = []
|
self.followers = []
|
||||||
self.dynamics = []
|
self.dynamics_variable = {}
|
||||||
self.multis = {}
|
self.multis = {}
|
||||||
self.default_multi = {}
|
self.default_multi = {}
|
||||||
self.jinja = {}
|
self.jinja = {}
|
||||||
|
|
@ -176,6 +176,16 @@ class ParserVariable:
|
||||||
self.output = rougailconfig["step.output"]
|
self.output = rougailconfig["step.output"]
|
||||||
self.tiramisu_cache = rougailconfig["tiramisu_cache"]
|
self.tiramisu_cache = rougailconfig["tiramisu_cache"]
|
||||||
self.load_unexist_redefine = rougailconfig["load_unexist_redefine"]
|
self.load_unexist_redefine = rougailconfig["load_unexist_redefine"]
|
||||||
|
# change default initkwargs in CONVERT_OPTION
|
||||||
|
if hasattr(rougailconfig, 'config'):
|
||||||
|
for sub_od in rougailconfig.config.option('default_params'):
|
||||||
|
for option in sub_od:
|
||||||
|
if option.owner.isdefault():
|
||||||
|
continue
|
||||||
|
convert_option = CONVERT_OPTION[sub_od.name()]
|
||||||
|
if "initkwargs" not in convert_option:
|
||||||
|
convert_option["initkwargs"] = {}
|
||||||
|
convert_option["initkwargs"][option.name()] = option.value.get()
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
if self.is_init:
|
if self.is_init:
|
||||||
|
|
@ -389,13 +399,8 @@ class ParserVariable:
|
||||||
# it's just for modify subfamily or subvariable, do not redefine
|
# it's just for modify subfamily or subvariable, do not redefine
|
||||||
if family_obj:
|
if family_obj:
|
||||||
if exists in [None, True] and not obj.pop("redefine", False):
|
if exists in [None, True] and not obj.pop("redefine", False):
|
||||||
raise DictConsistencyError(
|
msg = _('family "{0}" define multiple time').format(path)
|
||||||
_(
|
raise DictConsistencyError(msg, 32, self.paths[path].xmlfiles + [filename])
|
||||||
'The family "{0}" already exists and it is not redefined'
|
|
||||||
).format(path),
|
|
||||||
32,
|
|
||||||
[filename],
|
|
||||||
)
|
|
||||||
# convert to Calculation objects
|
# convert to Calculation objects
|
||||||
self.parse_parameters(
|
self.parse_parameters(
|
||||||
path,
|
path,
|
||||||
|
|
@ -644,14 +649,14 @@ class ParserVariable:
|
||||||
family_is_leadership is True and first_variable is False,
|
family_is_leadership is True and first_variable is False,
|
||||||
version,
|
version,
|
||||||
)
|
)
|
||||||
self.parse_params(path, obj)
|
self.parse_params(path, obj, filename)
|
||||||
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 and exists is False:
|
if not self.load_unexist_redefine and exists is False:
|
||||||
return
|
return
|
||||||
if not obj.pop("redefine", False):
|
if not obj.pop("redefine", False):
|
||||||
msg = f'Variable "{path}" already exists'
|
msg = _('variable "{0}" define multiple time').format(path)
|
||||||
raise DictConsistencyError(msg, 45, [filename])
|
raise DictConsistencyError(msg, 45, self.paths[path].xmlfiles + [filename])
|
||||||
self.paths.add(
|
self.paths.add(
|
||||||
path,
|
path,
|
||||||
self.paths[path].model_copy(update=obj),
|
self.paths[path].model_copy(update=obj),
|
||||||
|
|
@ -748,12 +753,15 @@ class ParserVariable:
|
||||||
f"at index {idx}: {err}"
|
f"at index {idx}: {err}"
|
||||||
) from err
|
) from err
|
||||||
|
|
||||||
def parse_params(self, path, obj):
|
def parse_params(self, path, obj, filename):
|
||||||
"""Parse variable params"""
|
"""Parse variable params"""
|
||||||
if "params" not in obj:
|
if "params" not in obj:
|
||||||
return
|
return
|
||||||
if not isinstance(obj["params"], dict):
|
if not isinstance(obj["params"], dict):
|
||||||
raise Exception(f"params must be a dict for {path}")
|
raise DictConsistencyError(_("params must be a dict for {0}").format(path),
|
||||||
|
55,
|
||||||
|
[filename],
|
||||||
|
)
|
||||||
params = []
|
params = []
|
||||||
for key, val in obj["params"].items():
|
for key, val in obj["params"].items():
|
||||||
try:
|
try:
|
||||||
|
|
@ -766,12 +774,14 @@ class ParserVariable:
|
||||||
is_follower=None,
|
is_follower=None,
|
||||||
attribute=None,
|
attribute=None,
|
||||||
family_is_dynamic=None,
|
family_is_dynamic=None,
|
||||||
xmlfiles=None,
|
xmlfiles=[filename],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
raise Exception(
|
raise DictConsistencyError(
|
||||||
f'"{key}" has an invalid "params" for {path}: {err}'
|
_('"{0}" has an invalid "params" for {1}: {2}').format(key, path, err),
|
||||||
|
54,
|
||||||
|
[filename],
|
||||||
) from err
|
) from err
|
||||||
obj["params"] = params
|
obj["params"] = params
|
||||||
|
|
||||||
|
|
@ -928,11 +938,17 @@ class ParserVariable:
|
||||||
val["is_follower"] = is_follower
|
val["is_follower"] = is_follower
|
||||||
val["attribute"] = attribute
|
val["attribute"] = attribute
|
||||||
val["xmlfiles"] = xmlfiles
|
val["xmlfiles"] = xmlfiles
|
||||||
|
if param_typ not in PARAM_TYPES:
|
||||||
|
raise DictConsistencyError(
|
||||||
|
f'unknown type "{param_typ}" for "{path}"',
|
||||||
|
52,
|
||||||
|
xmlfiles,
|
||||||
|
)
|
||||||
try:
|
try:
|
||||||
params.append(PARAM_TYPES[param_typ](**val))
|
params.append(PARAM_TYPES[param_typ](**val))
|
||||||
except ValidationError as err:
|
except ValidationError as err:
|
||||||
raise DictConsistencyError(
|
raise DictConsistencyError(
|
||||||
f'"{attribute}" has an invalid "{key}" for {path}: {err}',
|
f'"{attribute}" has an invalid "{key}" for "{path}": {err}',
|
||||||
29,
|
29,
|
||||||
xmlfiles,
|
xmlfiles,
|
||||||
) from err
|
) from err
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"""Rougail object model
|
"""Rougail object model
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2023-2024
|
Copyright (C) 2023-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -27,6 +27,7 @@ from pydantic import (
|
||||||
ConfigDict,
|
ConfigDict,
|
||||||
)
|
)
|
||||||
from tiramisu import undefined
|
from tiramisu import undefined
|
||||||
|
import tiramisu
|
||||||
from .utils import get_jinja_variable_to_param
|
from .utils import get_jinja_variable_to_param
|
||||||
from .error import DictConsistencyError, VariableCalculationDependencyError
|
from .error import DictConsistencyError, VariableCalculationDependencyError
|
||||||
|
|
||||||
|
|
@ -105,6 +106,35 @@ CONVERT_OPTION = {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def get_convert_option_types():
|
||||||
|
for typ, datas in CONVERT_OPTION.items():
|
||||||
|
obj = getattr(tiramisu, datas["opttype"])
|
||||||
|
initkwargs = datas.get("initkwargs", {})
|
||||||
|
if obj == tiramisu.SymLinkOption:
|
||||||
|
continue
|
||||||
|
if obj == tiramisu.ChoiceOption:
|
||||||
|
inst = obj('a', 'a', ('a',), **initkwargs)
|
||||||
|
else:
|
||||||
|
inst = obj('a', 'a', **initkwargs)
|
||||||
|
extra = getattr(inst, '_extra', {})
|
||||||
|
if not extra:
|
||||||
|
continue
|
||||||
|
params = []
|
||||||
|
for key, value in extra.items():
|
||||||
|
if key.startswith('_'):
|
||||||
|
continue
|
||||||
|
multi = False
|
||||||
|
if isinstance(value, bool):
|
||||||
|
key_type = 'boolean'
|
||||||
|
elif isinstance(value, str):
|
||||||
|
key_type = 'string'
|
||||||
|
elif isinstance(value, list):
|
||||||
|
key_type = 'string'
|
||||||
|
multi = True
|
||||||
|
params.append((key, key_type, multi, value))
|
||||||
|
yield typ, params
|
||||||
|
|
||||||
|
|
||||||
class Param(BaseModel):
|
class Param(BaseModel):
|
||||||
key: str
|
key: str
|
||||||
model_config = ConfigDict(extra="forbid")
|
model_config = ConfigDict(extra="forbid")
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
"""
|
"""
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"""Annotate to add specify attribute for tiramisu-cmdline
|
"""Annotate to add specify attribute for tiramisu-cmdline
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -91,6 +91,9 @@ class Annotator(Walk):
|
||||||
def manage_negative_description(self, variable) -> None:
|
def manage_negative_description(self, variable) -> None:
|
||||||
if not variable.negative_description:
|
if not variable.negative_description:
|
||||||
if variable.type == "boolean" and not self.objectspace.add_extra_options:
|
if variable.type == "boolean" and not self.objectspace.add_extra_options:
|
||||||
|
if variable.name == variable.description:
|
||||||
|
variable.negative_description = variable.name
|
||||||
|
else:
|
||||||
raise DictConsistencyError(
|
raise DictConsistencyError(
|
||||||
_(
|
_(
|
||||||
'negative_description is mandatory for boolean variable, but "{0}" hasn\'t'
|
'negative_description is mandatory for boolean variable, but "{0}" hasn\'t'
|
||||||
|
|
@ -98,8 +101,7 @@ class Annotator(Walk):
|
||||||
200,
|
200,
|
||||||
variable.xmlfiles,
|
variable.xmlfiles,
|
||||||
)
|
)
|
||||||
return
|
elif variable.type != "boolean":
|
||||||
if variable.type != "boolean":
|
|
||||||
raise DictConsistencyError(
|
raise DictConsistencyError(
|
||||||
_(
|
_(
|
||||||
'negative_description is only available for boolean variable, but "{0}" is "{1}"'
|
'negative_description is only available for boolean variable, but "{0}" is "{1}"'
|
||||||
|
|
@ -107,6 +109,7 @@ class Annotator(Walk):
|
||||||
201,
|
201,
|
||||||
variable.xmlfiles,
|
variable.xmlfiles,
|
||||||
)
|
)
|
||||||
|
if variable.negative_description:
|
||||||
self.objectspace.informations.add(
|
self.objectspace.informations.add(
|
||||||
variable.path, "negative_description", variable.negative_description
|
variable.path, "negative_description", variable.negative_description
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
Config file for Rougail-structural_commandline
|
Config file for Rougail-structural_commandline
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
"""Annotate to add specify attribute for tiramisu-cmdline
|
"""Annotate to add specify attribute for tiramisu-cmdline
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -24,6 +24,8 @@ from ruamel.yaml import YAML
|
||||||
|
|
||||||
from ..utils import normalize_family
|
from ..utils import normalize_family
|
||||||
from ..path import Paths
|
from ..path import Paths
|
||||||
|
from ..error import DictConsistencyError
|
||||||
|
from ..i18n import _
|
||||||
|
|
||||||
|
|
||||||
class Walker:
|
class Walker:
|
||||||
|
|
@ -124,7 +126,7 @@ class Walker:
|
||||||
raise DictConsistencyError(
|
raise DictConsistencyError(
|
||||||
_("duplicate dictionary file name {0}").format(file_path.name),
|
_("duplicate dictionary file name {0}").format(file_path.name),
|
||||||
78,
|
78,
|
||||||
[filenames[file_path.name][1]],
|
[filenames[file_path.name], str(file_path)],
|
||||||
)
|
)
|
||||||
filenames[file_path.name] = str(file_path)
|
filenames[file_path.name] = str(file_path)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2024
|
Copyright (C) 2024-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -27,7 +27,8 @@ def get_rougail_config(
|
||||||
main_namespace_default = "rougail"
|
main_namespace_default = "rougail"
|
||||||
else:
|
else:
|
||||||
main_namespace_default = "null"
|
main_namespace_default = "null"
|
||||||
options = f"""main_dictionaries:
|
options = f"""
|
||||||
|
main_dictionaries:
|
||||||
description: {_("Directories where dictionary files are placed")}
|
description: {_("Directories where dictionary files are placed")}
|
||||||
type: unix_filename
|
type: unix_filename
|
||||||
alternative_name: m
|
alternative_name: m
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -165,7 +165,7 @@ def jinja_to_function(
|
||||||
return values
|
return values
|
||||||
|
|
||||||
|
|
||||||
def variable_to_property(prop, value, when, inverse):
|
def variable_to_property(prop, value, when, inverse, **kwargs):
|
||||||
if isinstance(value, PropertiesOptionError):
|
if isinstance(value, PropertiesOptionError):
|
||||||
raise value from value
|
raise value from value
|
||||||
if inverse:
|
if inverse:
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -402,7 +402,7 @@ class Common:
|
||||||
kwargs = []
|
kwargs = []
|
||||||
if "params" in child:
|
if "params" in child:
|
||||||
for key, value in child["params"].items():
|
for key, value in child["params"].items():
|
||||||
if not key:
|
if key is None:
|
||||||
for val in value:
|
for val in value:
|
||||||
new_args.append(self.populate_param(val))
|
new_args.append(self.populate_param(val))
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
"""
|
"""
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
distribued with GPL-2 or later license
|
distribued with GPL-2 or later license
|
||||||
|
|
||||||
|
|
@ -23,8 +23,9 @@ from typing import List
|
||||||
from re import findall
|
from re import findall
|
||||||
|
|
||||||
from tiramisu import undefined, Calculation
|
from tiramisu import undefined, Calculation
|
||||||
from tiramisu.error import PropertiesOptionError, LeadershipError, ConfigError
|
from tiramisu.error import PropertiesOptionError, LeadershipError, ConfigError, CancelParam
|
||||||
|
|
||||||
|
from .i18n import _
|
||||||
from .object_model import CONVERT_OPTION
|
from .object_model import CONVERT_OPTION
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,8 +49,10 @@ class UserDatas:
|
||||||
def _populate_values(self, user_datas):
|
def _populate_values(self, user_datas):
|
||||||
for datas in user_datas:
|
for datas in user_datas:
|
||||||
options = datas.get("options", {})
|
options = datas.get("options", {})
|
||||||
|
source = datas["source"]
|
||||||
for name, data in datas.get("values", {}).items():
|
for name, data in datas.get("values", {}).items():
|
||||||
self.values[name] = {
|
self.values[name] = {
|
||||||
|
"source": source,
|
||||||
"values": data,
|
"values": data,
|
||||||
"options": options.copy(),
|
"options": options.copy(),
|
||||||
}
|
}
|
||||||
|
|
@ -148,6 +151,9 @@ class UserDatas:
|
||||||
if path not in self.values:
|
if path not in self.values:
|
||||||
continue
|
continue
|
||||||
options = self.values[path].get("options", {})
|
options = self.values[path].get("options", {})
|
||||||
|
if options.get('allow_secrets_variables', True) is False and option.type() == 'password':
|
||||||
|
self.errors.append(_('the variable "{0}" contains secrets and should not be defined in {1}').format(path, self.values[path]["source"]))
|
||||||
|
continue
|
||||||
value = self.values[path]["values"]
|
value = self.values[path]["values"]
|
||||||
needs_convert = options.get("needs_convert", False)
|
needs_convert = options.get("needs_convert", False)
|
||||||
|
|
||||||
|
|
@ -206,13 +212,13 @@ class UserDatas:
|
||||||
option = self.config.option(path)
|
option = self.config.option(path)
|
||||||
if option.isoptiondescription():
|
if option.isoptiondescription():
|
||||||
self.errors.append(
|
self.errors.append(
|
||||||
f'the option "{option.path()}" is an option description'
|
_('the option "{0}" is an option description').format(option.path())
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
value = data["values"]
|
value = data["values"]
|
||||||
if option.isfollower():
|
if option.isfollower():
|
||||||
for index, val in enumerate(value):
|
for index, val in enumerate(value):
|
||||||
if val is undefined:
|
if val is undefined or isinstance(val, CancelParam):
|
||||||
continue
|
continue
|
||||||
self.config.option(path, index).value.set(val)
|
self.config.option(path, index).value.set(val)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
|
||||||
Copyright (C) 2019-2021
|
Copyright (C) 2019-2021
|
||||||
|
|
||||||
Silique (https://www.silique.fr)
|
Silique (https://www.silique.fr)
|
||||||
Copyright (C) 2022-2024
|
Copyright (C) 2022-2025
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify it
|
This program is free software: you can redistribute it and/or modify it
|
||||||
under the terms of the GNU Lesser General Public License as published by the
|
under the terms of the GNU Lesser General Public License as published by the
|
||||||
|
|
@ -114,6 +114,8 @@ def get_jinja_variable_to_param(
|
||||||
jinja_text, current_path, err
|
jinja_text, current_path, err
|
||||||
)
|
)
|
||||||
raise DictConsistencyError(msg, 39, xmlfiles) from err
|
raise DictConsistencyError(msg, 39, xmlfiles) from err
|
||||||
|
except AttributeError:
|
||||||
|
pass
|
||||||
variables = list(variables)
|
variables = list(variables)
|
||||||
variables.sort(reverse=True)
|
variables.sort(reverse=True)
|
||||||
founded_variables = {}
|
founded_variables = {}
|
||||||
|
|
|
||||||
8
tests/default_option_params/structure/00-test.yml
Normal file
8
tests/default_option_params/structure/00-test.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
version: 1.1
|
||||||
|
|
||||||
|
file:
|
||||||
|
type: unix_filename
|
||||||
|
params:
|
||||||
|
allow_relative: true
|
||||||
|
default:
|
||||||
|
test/unknown_file
|
||||||
10
tests/dictionaries/00_6secret/makedict/after.json
Normal file
10
tests/dictionaries/00_6secret/makedict/after.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.secret1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.secret2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value"
|
||||||
|
}
|
||||||
|
}
|
||||||
4
tests/dictionaries/00_6secret/makedict/base.json
Normal file
4
tests/dictionaries/00_6secret/makedict/base.json
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"rougail.secret1": null,
|
||||||
|
"rougail.secret2": "value"
|
||||||
|
}
|
||||||
10
tests/dictionaries/00_6secret/makedict/before.json
Normal file
10
tests/dictionaries/00_6secret/makedict/before.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.secret1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": null
|
||||||
|
},
|
||||||
|
"rougail.secret2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value"
|
||||||
|
}
|
||||||
|
}
|
||||||
1
tests/dictionaries/00_6secret/makedict/mandatory.json
Normal file
1
tests/dictionaries/00_6secret/makedict/mandatory.json
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
["rougail.secret1"]
|
||||||
16
tests/dictionaries/00_6secret/tiramisu/base.py
Normal file
16
tests/dictionaries/00_6secret/tiramisu/base.py
Normal file
|
|
@ -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 = PasswordOption(name="secret1", doc="the first variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'secret'})
|
||||||
|
option_3 = PasswordOption(name="secret2", doc="the second variable", default="value", properties=frozenset({"mandatory", "standard"}), informations={'type': 'secret'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
11
tests/dictionaries/00_6secret/tiramisu/no_namespace.py
Normal file
11
tests/dictionaries/00_6secret/tiramisu/no_namespace.py
Normal file
|
|
@ -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 = PasswordOption(name="secret1", doc="the first variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'secret'})
|
||||||
|
option_2 = PasswordOption(name="secret2", doc="the second variable", default="value", properties=frozenset({"mandatory", "standard"}), informations={'type': 'secret'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"rougail.condition": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"rougail.variable1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": []
|
||||||
|
},
|
||||||
|
"rougail.variable2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"rougail.condition": "no",
|
||||||
|
"rougail.variable1": [],
|
||||||
|
"rougail.variable2": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,14 @@
|
||||||
|
{
|
||||||
|
"rougail.condition": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "no"
|
||||||
|
},
|
||||||
|
"rougail.variable1": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": []
|
||||||
|
},
|
||||||
|
"rougail.variable2": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
["rougail.variable1", "rougail.variable2"]
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
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")
|
||||||
|
dict_env['disabled_rougail.variable1'] = "{% if _.condition == \"yes\" %}\ncondition is yes\n{% endif %}\n"
|
||||||
|
dict_env['disabled_rougail.variable2'] = "{% if _.condition == \"yes\" %}\ncondition is yes\n{% endif %}\n"
|
||||||
|
option_2 = StrOption(name="condition", doc="a conditional variable", default="no", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="variable1", doc="a first variable", multi=True, properties=frozenset({"basic", "mandatory", Calculation(func['jinja_to_property'], Params((ParamValue("disabled")), kwargs={'__internal_jinja': ParamValue("disabled_rougail.variable1"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/04_5disabled_calculation_multi/rougail/00-base.yml']), '__internal_attribute': ParamValue("disabled"), '__internal_variable': ParamValue("rougail.variable1"), 'when': ParamValue(True), 'inverse': ParamValue(False), '_.condition': ParamOption(option_2, notraisepropertyerror=True)}), help_function=func['jinja_to_property_help'])}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="variable2", doc="a second variable", multi=True, properties=frozenset({"basic", "mandatory", Calculation(func['jinja_to_property'], Params((ParamValue("disabled")), kwargs={'__internal_jinja': ParamValue("disabled_rougail.variable2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/04_5disabled_calculation_multi/rougail/00-base.yml']), '__internal_attribute': ParamValue("disabled"), '__internal_variable': ParamValue("rougail.variable2"), 'when': ParamValue(True), 'inverse': ParamValue(False), '_.condition': ParamOption(option_2, notraisepropertyerror=True)}), help_function=func['jinja_to_property_help'])}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3, option_4], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.condition": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"rougail.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"rougail.condition": false,
|
||||||
|
"rougail.variable": []
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"rougail.condition": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": false
|
||||||
|
},
|
||||||
|
"rougail.variable": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
["rougail.variable"]
|
||||||
|
|
@ -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 = BoolOption(name="condition", doc="a condition", default=False, properties=frozenset({"mandatory", "standard"}), informations={'type': 'boolean'})
|
||||||
|
option_3 = StrOption(name="variable", doc="a variable", multi=True, properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((ParamValue("disabled"), ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"basic"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -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 = BoolOption(name="condition", doc="a condition", default=False, properties=frozenset({"mandatory", "standard"}), informations={'type': 'boolean'})
|
||||||
|
option_2 = StrOption(name="variable", doc="a variable", multi=True, properties=frozenset({"basic", "mandatory", Calculation(func['variable_to_property'], Params((ParamValue("disabled"), ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True), 'when': ParamValue(True), 'inverse': ParamValue(False)}), help_function=func['variable_to_property'])}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": [
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value1",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value2",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rougail.calculate": [
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_rougail.calculate'] = "{{ _.leader.follower1[0] }}"
|
||||||
|
option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||||
|
option_6 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_rougail.calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(True), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-follower-first/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("rougail.calculate"), '_.leader.follower1': ParamOption(option_4, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "notunique", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_6], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_calculate'] = "{{ _.leader.follower1[0] }}"
|
||||||
|
option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = Leadership(name="leader", doc="a leadership", children=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||||
|
option_5 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(True), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-follower-first/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("calculate"), '_.leader.follower1': ParamOption(option_3, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "notunique", "standard"}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_5])
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": [
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value1",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value2",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rougail.calculate": [
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_rougail.calculate'] = "{{ _.leader.follower1[-1] }}"
|
||||||
|
option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||||
|
option_6 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_rougail.calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(True), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-follower-last/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("rougail.calculate"), '_.leader.follower1': ParamOption(option_4, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "notunique", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_6], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_calculate'] = "{{ _.leader.follower1[-1] }}"
|
||||||
|
option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = Leadership(name="leader", doc="a leadership", children=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||||
|
option_5 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(True), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-follower-last/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("calculate"), '_.leader.follower1': ParamOption(option_3, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "notunique", "standard"}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_5])
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": [
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value1",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value2",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rougail.calculate": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
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_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||||
|
option_6 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "notunique", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_6], 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 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_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = Leadership(name="leader", doc="a leadership", children=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||||
|
option_5 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "notunique", "standard"}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_5])
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": [
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value1",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value2",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rougail.calculate": "value1"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value1"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_rougail.calculate'] = "{{ _.leader.leader[0] }}"
|
||||||
|
option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||||
|
option_6 = StrOption(name="calculate", doc="a calculated variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_rougail.calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-leader-first/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("rougail.calculate"), '_.leader.leader': ParamOption(option_3, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_6], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_calculate'] = "{{ _.leader.leader[0] }}"
|
||||||
|
option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = Leadership(name="leader", doc="a leadership", children=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||||
|
option_5 = StrOption(name="calculate", doc="a calculated variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-leader-first/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("calculate"), '_.leader.leader': ParamOption(option_2, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_5])
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": [
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value1",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value2",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rougail.calculate": "value2"
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": "value2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_rougail.calculate'] = "{{ _.leader.leader[-1] }}"
|
||||||
|
option_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||||
|
option_6 = StrOption(name="calculate", doc="a calculated variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_rougail.calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-leader-last/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("rougail.calculate"), '_.leader.leader': ParamOption(option_3, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_6], properties=frozenset({"standard"}))
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
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")
|
||||||
|
dict_env['default_calculate'] = "{{ _.leader.leader[-1] }}"
|
||||||
|
option_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = Leadership(name="leader", doc="a leadership", children=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||||
|
option_5 = StrOption(name="calculate", doc="a calculated variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_calculate"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/40_9leadership-calculation-outside-leader-last/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("calculate"), '_.leader.leader': ParamOption(option_2, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_5])
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": [
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value1",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": "value2",
|
||||||
|
"rougail.leader.follower1": "val11",
|
||||||
|
"rougail.leader.follower2": "val21"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"rougail.calculate": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,36 @@
|
||||||
|
{
|
||||||
|
"rougail.leader.leader": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower1": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val11",
|
||||||
|
"val11"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.leader.follower2": {
|
||||||
|
"owner": [
|
||||||
|
"default",
|
||||||
|
"default"
|
||||||
|
],
|
||||||
|
"value": [
|
||||||
|
"val21",
|
||||||
|
"val21"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rougail.calculate": {
|
||||||
|
"owner": "default",
|
||||||
|
"value": [
|
||||||
|
"value1",
|
||||||
|
"value2"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1 @@
|
||||||
|
[]
|
||||||
|
|
@ -0,0 +1,19 @@
|
||||||
|
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_3 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_5 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_2 = Leadership(name="leader", doc="a leadership", children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||||
|
option_6 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, option_6], 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 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_2 = StrOption(name="leader", doc="a leader", multi=True, default=["value1", "value2"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_3 = StrOption(name="follower1", doc="a follower", multi=True, default_multi="val11", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_4 = StrOption(name="follower2", doc="an other follower", multi=True, default_multi="val21", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
optiondescription_1 = Leadership(name="leader", doc="a leadership", children=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||||
|
option_5 = StrOption(name="calculate", doc="a calculated variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||||
|
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, option_5])
|
||||||
|
|
@ -119,7 +119,7 @@ def launch_flattener(test_dir,
|
||||||
mkdir(makedict_dir)
|
mkdir(makedict_dir)
|
||||||
config_dict = dict(option_value(config.value.get()))
|
config_dict = dict(option_value(config.value.get()))
|
||||||
if not isfile(Path(test_dir) / 'tiramisu' / 'base.py'):
|
if not isfile(Path(test_dir) / 'tiramisu' / 'base.py'):
|
||||||
tconfig_dict = {f'rougail.{path}': value for path, value in config_dict.items()}
|
tconfig_dict = config_add_rougail(config_dict)
|
||||||
else:
|
else:
|
||||||
tconfig_dict = config_dict
|
tconfig_dict = config_dict
|
||||||
if not isfile(makedict_file) or debug:
|
if not isfile(makedict_file) or debug:
|
||||||
|
|
@ -127,7 +127,7 @@ def launch_flattener(test_dir,
|
||||||
dump(tconfig_dict, fh, indent=4)
|
dump(tconfig_dict, fh, indent=4)
|
||||||
fh.write('\n')
|
fh.write('\n')
|
||||||
if filename == 'no_namespace':
|
if filename == 'no_namespace':
|
||||||
config_dict = {f'rougail.{path}': value for path, value in config_dict.items()}
|
config_dict = config_add_rougail(config_dict)
|
||||||
elif filename != 'base':
|
elif filename != 'base':
|
||||||
config_dict_prefix = {'1': {}, '2': {}}
|
config_dict_prefix = {'1': {}, '2': {}}
|
||||||
for key, value in config_dict.items():
|
for key, value in config_dict.items():
|
||||||
|
|
@ -165,6 +165,18 @@ def launch_flattener(test_dir,
|
||||||
mandatory(test_dir, mandatory_file, config.value.mandatory(), filename)
|
mandatory(test_dir, mandatory_file, config.value.mandatory(), filename)
|
||||||
|
|
||||||
|
|
||||||
|
def config_add_rougail(config):
|
||||||
|
config_dict = {}
|
||||||
|
for path, value in config.items():
|
||||||
|
if value and isinstance(value, list) and isinstance(value[0], dict):
|
||||||
|
config_dict[f'rougail.{path}'] = []
|
||||||
|
for v in value:
|
||||||
|
config_dict[f'rougail.{path}'].append({f'rougail.{k}': w for k, w in v.items()})
|
||||||
|
else:
|
||||||
|
config_dict[f'rougail.{path}'] = value
|
||||||
|
return config_dict
|
||||||
|
|
||||||
|
|
||||||
def value_owner(test_dir, makedict_value_owner, config, filename):
|
def value_owner(test_dir, makedict_value_owner, config, filename):
|
||||||
ret = {}
|
ret = {}
|
||||||
for key, value in option_value(config.value.get(), True):
|
for key, value in option_value(config.value.get(), True):
|
||||||
|
|
@ -189,7 +201,7 @@ def value_owner(test_dir, makedict_value_owner, config, filename):
|
||||||
'value': value,
|
'value': value,
|
||||||
}
|
}
|
||||||
if not isfile(Path(test_dir) / 'tiramisu' / 'base.py'):
|
if not isfile(Path(test_dir) / 'tiramisu' / 'base.py'):
|
||||||
tret = {f'rougail.{path}': value for path, value in ret.items()}
|
tret = config_add_rougail(ret)
|
||||||
else:
|
else:
|
||||||
tret = ret
|
tret = ret
|
||||||
if not isfile(makedict_value_owner) or debug:
|
if not isfile(makedict_value_owner) or debug:
|
||||||
|
|
@ -197,7 +209,7 @@ def value_owner(test_dir, makedict_value_owner, config, filename):
|
||||||
dump(tret, fh, indent=4)
|
dump(tret, fh, indent=4)
|
||||||
fh.write('\n')
|
fh.write('\n')
|
||||||
if filename == 'no_namespace':
|
if filename == 'no_namespace':
|
||||||
ret = {f'rougail.{path}': value for path, value in ret.items()}
|
ret = config_add_rougail(ret)
|
||||||
elif filename != 'base':
|
elif filename != 'base':
|
||||||
ret_prefix = {'1': {}, '2': {}}
|
ret_prefix = {'1': {}, '2': {}}
|
||||||
for key, value in ret.items():
|
for key, value in ret.items():
|
||||||
|
|
|
||||||
|
|
@ -56,3 +56,17 @@ def test_personalize_annotate_twice():
|
||||||
with raises(DictConsistencyError) as err:
|
with raises(DictConsistencyError) as err:
|
||||||
eolobj.converted.annotate()
|
eolobj.converted.annotate()
|
||||||
assert err.value.errno == 85
|
assert err.value.errno == 85
|
||||||
|
|
||||||
|
|
||||||
|
def test_option_params():
|
||||||
|
RougailConfig['dictionaries_dir'] = ['tests/default_option_params/structure']
|
||||||
|
RougailConfig["default_params.unix_filename.test_existence"] = True
|
||||||
|
eolobj = Rougail()
|
||||||
|
with raises(ValueError):
|
||||||
|
eolobj.get_config()
|
||||||
|
eolobj = Rougail()
|
||||||
|
with raises(ValueError):
|
||||||
|
eolobj.get_config()
|
||||||
|
RougailConfig["default_params.unix_filename.test_existence"] = False
|
||||||
|
eolobj = Rougail()
|
||||||
|
eolobj.get_config()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue