Compare commits

...

4 commits

81 changed files with 1116 additions and 93 deletions

View file

@ -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)
### Fix

View file

@ -45,7 +45,7 @@ msgid ""
"the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the "
"higher family mode \"{2}\""
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}\""
#: src/rougail/annotator/family.py:287

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail"
version = "1.2.0a8"
version = "1.2.0a9"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "A consistency handling system that was initially designed in the configuration management"

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
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:
path = path.replace("{{ suffix }}", "{{ identifier }}")
self.objectspace.dynamics_variable.setdefault(path, []).append(family.path)
self.objectspace.informations.add(family.path, "dynamic_variable", path)
def change_modes(self):

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
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
# copy type and params
calculated_variable_path = variable.default.variable
calculated_variable, identifier = self.objectspace.paths.get_with_dynamic(
calculated_variable_path,
variable.path,
variable.version,
variable.namespace,
variable.xmlfiles,
)
calculated_variable, identifier = variable.default.get_variable(self.objectspace)
if calculated_variable is None:
return
variable.type = calculated_variable.type

View file

@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
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 .utils import _, load_modules, normalize_family
from .convert import RougailConvert
from .object_model import get_convert_option_types
if version_info.major == 3 and version_info.minor:
import rougail.structural_commandline.object_model
@ -72,27 +73,24 @@ def get_level(module):
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.root = root
self.config = Config(
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)
self.add_extra_options = add_extra_options
self.root = None
def copy(self):
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.property.importation(self.config.property.exportation())
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:
value = getattr(self, variable)
if not isinstance(value, str):
@ -100,11 +98,27 @@ class _RougailConfig:
setattr(rougailconfig, variable, value)
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__(
self,
key,
value,
) -> None:
if self.root is None:
self.generate_config()
if key in self.not_in_tiramisu:
setattr(self, key, value)
else:
@ -130,6 +144,8 @@ class _RougailConfig:
self,
key,
) -> None:
if self.root is None:
self.generate_config()
if key in self.not_in_tiramisu:
return getattr(self, key)
if key == "export_with_import":
@ -199,11 +215,10 @@ class FakeRougailConvert(RougailConvert):
self.load_unexist_redefine = False
def get_rougail_config(
*,
def _rougail_config(
backward_compatibility: bool = True,
add_extra_options: bool = True,
) -> _RougailConfig:
) -> "OptionDescription":
rougail_options = f"""default_dictionary_format_version:
description: Dictionary format version by default, if not specified in dictionary file
alternative_name: v
@ -403,6 +418,23 @@ load_unexist_redefine:
NAME=normalize_family(process),
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
# print(rougail_options)
convert = FakeRougailConvert(add_extra_options)
@ -438,10 +470,17 @@ load_unexist_redefine:
tiram_obj = convert.save()
optiondescription = {}
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(
backward_compatibility,
optiondescription["option_0"],
extra_vars=extra_vars,
add_extra_options,
)

View file

@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the
@ -135,7 +135,7 @@ class ParserVariable:
self.reflector_names = {}
self.leaders = []
self.followers = []
self.dynamics = []
self.dynamics_variable = {}
self.multis = {}
self.default_multi = {}
self.jinja = {}
@ -176,6 +176,16 @@ class ParserVariable:
self.output = rougailconfig["step.output"]
self.tiramisu_cache = rougailconfig["tiramisu_cache"]
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):
if self.is_init:
@ -389,13 +399,8 @@ class ParserVariable:
# it's just for modify subfamily or subvariable, do not redefine
if family_obj:
if exists in [None, True] and not obj.pop("redefine", False):
raise DictConsistencyError(
_(
'The family "{0}" already exists and it is not redefined'
).format(path),
32,
[filename],
)
msg = _('family "{0}" define multiple time').format(path)
raise DictConsistencyError(msg, 32, self.paths[path].xmlfiles + [filename])
# convert to Calculation objects
self.parse_parameters(
path,
@ -644,14 +649,14 @@ class ParserVariable:
family_is_leadership is True and first_variable is False,
version,
)
self.parse_params(path, obj)
self.parse_params(path, obj, filename)
exists = obj.pop("exists", None)
if path in self.paths:
if not self.load_unexist_redefine and exists is False:
return
if not obj.pop("redefine", False):
msg = f'Variable "{path}" already exists'
raise DictConsistencyError(msg, 45, [filename])
msg = _('variable "{0}" define multiple time').format(path)
raise DictConsistencyError(msg, 45, self.paths[path].xmlfiles + [filename])
self.paths.add(
path,
self.paths[path].model_copy(update=obj),
@ -748,12 +753,15 @@ class ParserVariable:
f"at index {idx}: {err}"
) from err
def parse_params(self, path, obj):
def parse_params(self, path, obj, filename):
"""Parse variable params"""
if "params" not in obj:
return
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 = []
for key, val in obj["params"].items():
try:
@ -766,12 +774,14 @@ class ParserVariable:
is_follower=None,
attribute=None,
family_is_dynamic=None,
xmlfiles=None,
xmlfiles=[filename],
)
)
except ValidationError as err:
raise Exception(
f'"{key}" has an invalid "params" for {path}: {err}'
raise DictConsistencyError(
_('"{0}" has an invalid "params" for {1}: {2}').format(key, path, err),
54,
[filename],
) from err
obj["params"] = params
@ -928,11 +938,17 @@ class ParserVariable:
val["is_follower"] = is_follower
val["attribute"] = attribute
val["xmlfiles"] = xmlfiles
if param_typ not in PARAM_TYPES:
raise DictConsistencyError(
f'unknown type "{param_typ}" for "{path}"',
52,
xmlfiles,
)
try:
params.append(PARAM_TYPES[param_typ](**val))
except ValidationError as err:
raise DictConsistencyError(
f'"{attribute}" has an invalid "{key}" for {path}: {err}',
f'"{attribute}" has an invalid "{key}" for "{path}": {err}',
29,
xmlfiles,
) from err

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -8,7 +8,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,7 +1,7 @@
"""Rougail object model
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
under the terms of the GNU Lesser General Public License as published by the
@ -27,6 +27,7 @@ from pydantic import (
ConfigDict,
)
from tiramisu import undefined
import tiramisu
from .utils import get_jinja_variable_to_param
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):
key: str
model_config = ConfigDict(extra="forbid")

View file

@ -1,5 +1,5 @@
"""
Copyright (C) 2024
Copyright (C) 2024-2025
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

View file

@ -1,6 +1,6 @@
"""
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,7 +1,7 @@
"""Annotate to add specify attribute for tiramisu-cmdline
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
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:
if not variable.negative_description:
if variable.type == "boolean" and not self.objectspace.add_extra_options:
if variable.name == variable.description:
variable.negative_description = variable.name
else:
raise DictConsistencyError(
_(
'negative_description is mandatory for boolean variable, but "{0}" hasn\'t'
@ -98,8 +101,7 @@ class Annotator(Walk):
200,
variable.xmlfiles,
)
return
if variable.type != "boolean":
elif variable.type != "boolean":
raise DictConsistencyError(
_(
'negative_description is only available for boolean variable, but "{0}" is "{1}"'
@ -107,6 +109,7 @@ class Annotator(Walk):
201,
variable.xmlfiles,
)
if variable.negative_description:
self.objectspace.informations.add(
variable.path, "negative_description", variable.negative_description
)

View file

@ -2,7 +2,7 @@
Config file for Rougail-structural_commandline
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,7 +1,7 @@
"""Annotate to add specify attribute for tiramisu-cmdline
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
under the terms of the GNU Lesser General Public License as published by the

View file

@ -1,6 +1,6 @@
"""
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
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 ..path import Paths
from ..error import DictConsistencyError
from ..i18n import _
class Walker:
@ -124,7 +126,7 @@ class Walker:
raise DictConsistencyError(
_("duplicate dictionary file name {0}").format(file_path.name),
78,
[filenames[file_path.name][1]],
[filenames[file_path.name], str(file_path)],
)
filenames[file_path.name] = str(file_path)

View file

@ -1,6 +1,6 @@
"""
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
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"
else:
main_namespace_default = "null"
options = f"""main_dictionaries:
options = f"""
main_dictionaries:
description: {_("Directories where dictionary files are placed")}
type: unix_filename
alternative_name: m

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the
@ -165,7 +165,7 @@ def jinja_to_function(
return values
def variable_to_property(prop, value, when, inverse):
def variable_to_property(prop, value, when, inverse, **kwargs):
if isinstance(value, PropertiesOptionError):
raise value from value
if inverse:

View file

@ -10,7 +10,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
under the terms of the GNU Lesser General Public License as published by the
@ -402,7 +402,7 @@ class Common:
kwargs = []
if "params" in child:
for key, value in child["params"].items():
if not key:
if key is None:
for val in value:
new_args.append(self.populate_param(val))
else:

View file

@ -1,6 +1,6 @@
"""
Silique (https://www.silique.fr)
Copyright (C) 2022-2024
Copyright (C) 2022-2025
distribued with GPL-2 or later license
@ -23,8 +23,9 @@ from typing import List
from re import findall
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
@ -48,8 +49,10 @@ class UserDatas:
def _populate_values(self, user_datas):
for datas in user_datas:
options = datas.get("options", {})
source = datas["source"]
for name, data in datas.get("values", {}).items():
self.values[name] = {
"source": source,
"values": data,
"options": options.copy(),
}
@ -148,6 +151,9 @@ class UserDatas:
if path not in self.values:
continue
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"]
needs_convert = options.get("needs_convert", False)
@ -206,13 +212,13 @@ class UserDatas:
option = self.config.option(path)
if option.isoptiondescription():
self.errors.append(
f'the option "{option.path()}" is an option description'
_('the option "{0}" is an option description').format(option.path())
)
continue
value = data["values"]
if option.isfollower():
for index, val in enumerate(value):
if val is undefined:
if val is undefined or isinstance(val, CancelParam):
continue
self.config.option(path, index).value.set(val)
else:

View file

@ -9,7 +9,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2019-2021
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
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
)
raise DictConsistencyError(msg, 39, xmlfiles) from err
except AttributeError:
pass
variables = list(variables)
variables.sort(reverse=True)
founded_variables = {}

View file

@ -0,0 +1,8 @@
version: 1.1
file:
type: unix_filename
params:
allow_relative: true
default:
test/unknown_file

View file

@ -0,0 +1,10 @@
{
"rougail.secret1": {
"owner": "default",
"value": null
},
"rougail.secret2": {
"owner": "default",
"value": "value"
}
}

View file

@ -0,0 +1,4 @@
{
"rougail.secret1": null,
"rougail.secret2": "value"
}

View file

@ -0,0 +1,10 @@
{
"rougail.secret1": {
"owner": "default",
"value": null
},
"rougail.secret2": {
"owner": "default",
"value": "value"
}
}

View file

@ -0,0 +1 @@
["rougail.secret1"]

View 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])

View 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])

View file

@ -0,0 +1,14 @@
{
"rougail.condition": {
"owner": "default",
"value": "no"
},
"rougail.variable1": {
"owner": "default",
"value": []
},
"rougail.variable2": {
"owner": "default",
"value": []
}
}

View file

@ -0,0 +1,5 @@
{
"rougail.condition": "no",
"rougail.variable1": [],
"rougail.variable2": []
}

View file

@ -0,0 +1,14 @@
{
"rougail.condition": {
"owner": "default",
"value": "no"
},
"rougail.variable1": {
"owner": "default",
"value": []
},
"rougail.variable2": {
"owner": "default",
"value": []
}
}

View file

@ -0,0 +1 @@
["rougail.variable1", "rougail.variable2"]

View file

@ -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])

View file

@ -0,0 +1,10 @@
{
"rougail.condition": {
"owner": "default",
"value": false
},
"rougail.variable": {
"owner": "default",
"value": []
}
}

View file

@ -0,0 +1,4 @@
{
"rougail.condition": false,
"rougail.variable": []
}

View file

@ -0,0 +1,10 @@
{
"rougail.condition": {
"owner": "default",
"value": false
},
"rougail.variable": {
"owner": "default",
"value": []
}
}

View file

@ -0,0 +1 @@
["rougail.variable"]

View 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 = 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])

View 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 = 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])

View file

@ -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"
]
}
}

View file

@ -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"
]
}

View file

@ -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"
]
}
}

View file

@ -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])

View file

@ -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])

View file

@ -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"
]
}
}

View file

@ -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"
]
}

View file

@ -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"
]
}
}

View file

@ -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])

View file

@ -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])

View file

@ -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"
]
}
}

View file

@ -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"
]
}

View file

@ -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"
]
}
}

View file

@ -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])

View file

@ -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])

View file

@ -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"
}
}

View file

@ -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"
}

View file

@ -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"
}
}

View file

@ -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])

View file

@ -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])

View file

@ -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"
}
}

View file

@ -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"
}

View file

@ -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"
}
}

View file

@ -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])

View file

@ -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])

View file

@ -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"
]
}
}

View file

@ -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"
]
}

View file

@ -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"
]
}
}

View file

@ -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])

View file

@ -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])

View file

@ -119,7 +119,7 @@ def launch_flattener(test_dir,
mkdir(makedict_dir)
config_dict = dict(option_value(config.value.get()))
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:
tconfig_dict = config_dict
if not isfile(makedict_file) or debug:
@ -127,7 +127,7 @@ def launch_flattener(test_dir,
dump(tconfig_dict, fh, indent=4)
fh.write('\n')
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':
config_dict_prefix = {'1': {}, '2': {}}
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)
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):
ret = {}
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,
}
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:
tret = ret
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)
fh.write('\n')
if filename == 'no_namespace':
ret = {f'rougail.{path}': value for path, value in ret.items()}
ret = config_add_rougail(ret)
elif filename != 'base':
ret_prefix = {'1': {}, '2': {}}
for key, value in ret.items():

View file

@ -56,3 +56,17 @@ def test_personalize_annotate_twice():
with raises(DictConsistencyError) as err:
eolobj.converted.annotate()
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()