Compare commits
13 commits
Author | SHA1 | Date | |
---|---|---|---|
688aa8d053 | |||
4c613f6425 | |||
145b7be0a5 | |||
829d7692ad | |||
ea34751e08 | |||
c25a66f0cb | |||
fdfb7ec73b | |||
db768f94af | |||
9782bcde95 | |||
fbb1446fa3 | |||
56659f7ea4 | |||
af3f77c920 | |||
e29c0c8abc |
319 changed files with 3455 additions and 413 deletions
32
CHANGELOG.md
32
CHANGELOG.md
|
@ -1,3 +1,35 @@
|
|||
## 1.2.0a3 (2024-11-28)
|
||||
|
||||
### Fix
|
||||
|
||||
- add user_datas file
|
||||
|
||||
## 1.2.0a2 (2024-11-27)
|
||||
|
||||
### Feat
|
||||
|
||||
- add "exists" attribut for a family
|
||||
|
||||
### Fix
|
||||
|
||||
- separate UserDatas
|
||||
- options could be a list
|
||||
|
||||
## 1.2.0a1 (2024-11-25)
|
||||
|
||||
### Fix
|
||||
|
||||
- dynamic variable could be optional
|
||||
- dynamic variable declare in verion 1.0 has {{ suffix }}
|
||||
- user_data plugins could have annotator function
|
||||
- do not modify a dynamic variable if has default value
|
||||
|
||||
## 1.2.0a0 (2024-11-08)
|
||||
|
||||
### Feat
|
||||
|
||||
- add force_optional option to allow charging structure even if all variables are not available
|
||||
|
||||
## 1.1.1 (2024-11-06)
|
||||
|
||||
### Fix
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: \n"
|
||||
"POT-Creation-Date: 2024-10-30 13:21+0100\n"
|
||||
"PO-Revision-Date: 2024-10-30 13:39+0100\n"
|
||||
"POT-Creation-Date: 2024-11-25 09:10+0100\n"
|
||||
"PO-Revision-Date: 2024-11-25 09:11+0100\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"Language: fr\n"
|
||||
|
@ -16,31 +16,31 @@ msgstr ""
|
|||
"Generated-By: pygettext.py 1.5\n"
|
||||
"X-Generator: Poedit 3.5\n"
|
||||
|
||||
#: src/rougail/annotator/family.py:142
|
||||
#: src/rougail/annotator/family.py:141
|
||||
msgid "default variable mode \"{0}\" is not a valid mode, valid modes are {1}"
|
||||
msgstr ""
|
||||
"le mode d'une variable par défaut \"{0}\" n'est pas un mode valide, les "
|
||||
"modes valides sont {1}"
|
||||
|
||||
#: src/rougail/annotator/family.py:148
|
||||
#: src/rougail/annotator/family.py:147
|
||||
msgid "default family mode \"{0}\" is not a valid mode, valid modes are {1}"
|
||||
msgstr ""
|
||||
"le mode d'une famille par défaut \"{0}\" n'est pas un mode valide, les modes "
|
||||
"valides sont {1}"
|
||||
|
||||
#: src/rougail/annotator/family.py:180
|
||||
#: src/rougail/annotator/family.py:179
|
||||
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, valid modes are {2}"
|
||||
msgstr ""
|
||||
"le mode \"{0}\" pour \"{1}\" n'est pas un mode valide, les modes valides "
|
||||
"sont {2}"
|
||||
|
||||
#: src/rougail/annotator/family.py:184
|
||||
#: src/rougail/annotator/family.py:183
|
||||
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, no modes are available"
|
||||
msgstr ""
|
||||
"le mode \"{0}\" pour \"{1}\" n'est pas un mode valide, aucun mode ne sont "
|
||||
"définis"
|
||||
|
||||
#: src/rougail/annotator/family.py:248
|
||||
#: src/rougail/annotator/family.py:247
|
||||
msgid ""
|
||||
"the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the "
|
||||
"higher family mode \"{2}\""
|
||||
|
@ -48,7 +48,7 @@ msgstr ""
|
|||
"la variable \"{0}\" est obligatoire donc dans le mode \"{1}\" mais la "
|
||||
"famille a un mode supérieur \"{2}\""
|
||||
|
||||
#: src/rougail/annotator/family.py:286
|
||||
#: src/rougail/annotator/family.py:285
|
||||
msgid ""
|
||||
"the follower \"{0}\" is in \"{1}\" mode but leader have the higher mode "
|
||||
"\"{2}\""
|
||||
|
@ -56,7 +56,7 @@ msgstr ""
|
|||
"la variable suiveuse \"{0}\" a le mode \"{1}\" mais la variable leader a un "
|
||||
"mode supérieur \"{2}\""
|
||||
|
||||
#: src/rougail/annotator/family.py:319
|
||||
#: src/rougail/annotator/family.py:318
|
||||
msgid ""
|
||||
"the family \"{0}\" is in \"{1}\" mode but variables and families inside have "
|
||||
"the higher modes \"{2}\""
|
||||
|
@ -64,7 +64,7 @@ msgstr ""
|
|||
"la famille \"{0}\" a le mode \"{1}\" mais les variables et les familles à "
|
||||
"l'intérieur ont des modes supérieurs \"{2}\""
|
||||
|
||||
#: src/rougail/annotator/family.py:337
|
||||
#: src/rougail/annotator/family.py:336
|
||||
msgid ""
|
||||
"the variable \"{0}\" is in \"{1}\" mode but family has the higher family "
|
||||
"mode \"{2}\""
|
||||
|
@ -72,37 +72,37 @@ msgstr ""
|
|||
"la variable \"{0}\" est dans le mode \"{1}\" mais la famille a le mode "
|
||||
"supérieur \"{2}\""
|
||||
|
||||
#: src/rougail/annotator/value.py:80
|
||||
#: src/rougail/annotator/value.py:77
|
||||
msgid "the follower \"{0}\" without multi attribute can only have one value"
|
||||
msgstr ""
|
||||
"la variable suiveuse \"{0}\" sans l'attribut multi peut avoir seulement une "
|
||||
"valeur"
|
||||
|
||||
#: src/rougail/annotator/value.py:96
|
||||
#: src/rougail/annotator/value.py:93
|
||||
msgid "the variable \"{0}\" is multi but has a non list default value"
|
||||
msgstr ""
|
||||
"la variable \"{0}\" est multiple mais a une valeur par défaut sans être une "
|
||||
"liste"
|
||||
|
||||
#: src/rougail/annotator/variable.py:192
|
||||
#: src/rougail/annotator/variable.py:189
|
||||
msgid ""
|
||||
"the variable \"{0}\" has regexp attribut but has not the \"regexp\" type"
|
||||
msgstr ""
|
||||
"la variable \"{0}\" a un attribut regexp mais n'a pas le type \"regexp\""
|
||||
|
||||
#: src/rougail/annotator/variable.py:235
|
||||
#: src/rougail/annotator/variable.py:232
|
||||
msgid ""
|
||||
"the variable \"{0}\" has choices attribut but has not the \"choice\" type"
|
||||
msgstr ""
|
||||
"la variable \"{0}\" a un attribut choices mais n'a pas le type \"choice\""
|
||||
|
||||
#: src/rougail/annotator/variable.py:263
|
||||
#: src/rougail/annotator/variable.py:260
|
||||
msgid ""
|
||||
"the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}"
|
||||
msgstr ""
|
||||
"la variable \"{0}\" a la valeur par défaut invalide \"{1}\" devrait être {2}"
|
||||
|
||||
#: src/rougail/convert.py:268
|
||||
#: src/rougail/convert.py:281
|
||||
msgid ""
|
||||
"A variable or a family located in the \"{0}\" namespace shall not be used in "
|
||||
"the \"{1}\" namespace"
|
||||
|
@ -110,38 +110,38 @@ msgstr ""
|
|||
"Une variable ou une famille localisé dans l'espace de nom \"{0}\" ne devrait "
|
||||
"pas être utilisé dans l'espace de nom \"{1}\""
|
||||
|
||||
#: src/rougail/convert.py:462
|
||||
#: src/rougail/convert.py:477
|
||||
msgid "unknown type {0} for {1}"
|
||||
msgstr "type {0} inconnu pour {1}"
|
||||
|
||||
#: src/rougail/convert.py:1323
|
||||
#: src/rougail/convert.py:1347
|
||||
msgid "duplicate dictionary file name {0}"
|
||||
msgstr "nom de fichier {0} de dictionnaire dupliqué"
|
||||
|
||||
#: src/rougail/convert.py:1370
|
||||
#: src/rougail/convert.py:1394
|
||||
msgid "Cannot execute annotate multiple time"
|
||||
msgstr "Ne peut exécuter l'annotation plusieurs fois"
|
||||
|
||||
#: src/rougail/error.py:70
|
||||
#: src/rougail/error.py:67
|
||||
msgid "{0} in {1}"
|
||||
msgstr "{0} dans {1}"
|
||||
|
||||
#: src/rougail/structural_commandline/annotator.py:70
|
||||
#: src/rougail/structural_commandline/annotator.py:67
|
||||
msgid "alternative_name \"{0}\" conflict with \"--help\""
|
||||
msgstr "alternative_name \"{0}\" est en conflit avec \"--help\""
|
||||
|
||||
#: src/rougail/structural_commandline/annotator.py:73
|
||||
#: src/rougail/structural_commandline/annotator.py:72
|
||||
msgid "conflict alternative_name \"{0}\": \"{1}\" and \"{2}\""
|
||||
msgstr "conflit dans les \"alternative_name\" \"{0}\": \"{1}\" et \"{2}\""
|
||||
|
||||
#: src/rougail/structural_commandline/annotator.py:96
|
||||
#: src/rougail/structural_commandline/annotator.py:95
|
||||
msgid ""
|
||||
"negative_description is mandatory for boolean variable, but \"{0}\" hasn't"
|
||||
msgstr ""
|
||||
"l'attribut negative_description est obligatoire pour des variables "
|
||||
"\"boolean\", mais \"{0}\" n'en a pas"
|
||||
|
||||
#: src/rougail/structural_commandline/annotator.py:105
|
||||
#: src/rougail/structural_commandline/annotator.py:104
|
||||
msgid ""
|
||||
"negative_description is only available for boolean variable, but \"{0}\" is "
|
||||
"\"{1}\""
|
||||
|
@ -149,11 +149,11 @@ msgstr ""
|
|||
"l'attribut negative_description est seulement valide pour des variables "
|
||||
"\"boolean\", mais \"{0}\" est \"{1}\""
|
||||
|
||||
#: src/rougail/update/update.py:741
|
||||
#: src/rougail/update/update.py:738
|
||||
msgid "not a XML file: {0}"
|
||||
msgstr "fichier XML invalid : {0}"
|
||||
|
||||
#: src/rougail/utils.py:58
|
||||
#: src/rougail/utils.py:55
|
||||
msgid ""
|
||||
"invalid variable or family name \"{0}\" must only contains lowercase ascii "
|
||||
"character, number or _"
|
||||
|
@ -161,6 +161,6 @@ msgstr ""
|
|||
"nom invalide pour la variable ou famille \"{0}\" doit seulement contenir des "
|
||||
"caractères ascii minuscule, nombre or _"
|
||||
|
||||
#: src/rougail/utils.py:120
|
||||
#: src/rougail/utils.py:117
|
||||
msgid "error in jinja \"{0}\" for the variable \"{1}\": {2}"
|
||||
msgstr "erreur dans Jinja \"{0}\" pour la variable \"{1}\": {2}"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"POT-Creation-Date: 2024-11-04 12:04+0100\n"
|
||||
"POT-Creation-Date: 2024-11-25 09:10+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
|
@ -15,35 +15,35 @@ msgstr ""
|
|||
"Generated-By: pygettext.py 1.5\n"
|
||||
|
||||
|
||||
#: src/rougail/annotator/family.py:139
|
||||
#: src/rougail/annotator/family.py:141
|
||||
msgid "default variable mode \"{0}\" is not a valid mode, valid modes are {1}"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:145
|
||||
#: src/rougail/annotator/family.py:147
|
||||
msgid "default family mode \"{0}\" is not a valid mode, valid modes are {1}"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:177
|
||||
#: src/rougail/annotator/family.py:179
|
||||
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, valid modes are {2}"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:181
|
||||
#: src/rougail/annotator/family.py:183
|
||||
msgid "mode \"{0}\" for \"{1}\" is not a valid mode, no modes are available"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:245
|
||||
#: src/rougail/annotator/family.py:247
|
||||
msgid "the variable \"{0}\" is mandatory so in \"{1}\" mode but family has the higher family mode \"{2}\""
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:283
|
||||
#: src/rougail/annotator/family.py:285
|
||||
msgid "the follower \"{0}\" is in \"{1}\" mode but leader have the higher mode \"{2}\""
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:316
|
||||
#: src/rougail/annotator/family.py:318
|
||||
msgid "the family \"{0}\" is in \"{1}\" mode but variables and families inside have the higher modes \"{2}\""
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/annotator/family.py:334
|
||||
#: src/rougail/annotator/family.py:336
|
||||
msgid "the variable \"{0}\" is in \"{1}\" mode but family has the higher family mode \"{2}\""
|
||||
msgstr ""
|
||||
|
||||
|
@ -71,15 +71,15 @@ msgstr ""
|
|||
msgid "A variable or a family located in the \"{0}\" namespace shall not be used in the \"{1}\" namespace"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/convert.py:475
|
||||
#: src/rougail/convert.py:477
|
||||
msgid "unknown type {0} for {1}"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/convert.py:1345
|
||||
#: src/rougail/convert.py:1347
|
||||
msgid "duplicate dictionary file name {0}"
|
||||
msgstr ""
|
||||
|
||||
#: src/rougail/convert.py:1392
|
||||
#: src/rougail/convert.py:1394
|
||||
msgid "Cannot execute annotate multiple time"
|
||||
msgstr ""
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
|||
|
||||
[project]
|
||||
name = "rougail"
|
||||
version = "1.1.1"
|
||||
version = "1.2.0a3"
|
||||
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
|
||||
readme = "README.md"
|
||||
description = "A consistency handling system that was initially designed in the configuration management"
|
||||
|
|
|
@ -25,17 +25,15 @@ You should have received a copy of the GNU Lesser General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from tiramisu import Config, undefined
|
||||
from tiramisu.error import PropertiesOptionError, LeadershipError, ConfigError
|
||||
from tiramisu import Config
|
||||
from warnings import warn
|
||||
from typing import List
|
||||
from re import compile, findall
|
||||
|
||||
from .convert import RougailConvert
|
||||
from .config import RougailConfig
|
||||
from .update import RougailUpgrade
|
||||
from .object_model import CONVERT_OPTION
|
||||
from .utils import normalize_family
|
||||
from .object_model import CONVERT_OPTION
|
||||
from .user_datas import UserDatas
|
||||
|
||||
|
||||
def tiramisu_display_name(
|
||||
|
@ -58,7 +56,7 @@ def tiramisu_display_name(
|
|||
return f"{path}{comment}"
|
||||
|
||||
|
||||
class Rougail:
|
||||
class Rougail(UserDatas):
|
||||
"""Main Rougail object"""
|
||||
|
||||
def __init__(
|
||||
|
@ -104,223 +102,5 @@ class Rougail:
|
|||
)
|
||||
return self.run()
|
||||
|
||||
def user_datas(self, user_datas: List[dict]):
|
||||
values = {}
|
||||
errors = []
|
||||
warnings = []
|
||||
for datas in user_datas:
|
||||
options = datas.get("options", {})
|
||||
for name, data in datas.get("values", {}).items():
|
||||
values[name] = {
|
||||
"values": data,
|
||||
"options": options.copy(),
|
||||
}
|
||||
errors.extend(datas.get("errors", []))
|
||||
warnings.extend(datas.get("warnings", []))
|
||||
self._auto_configure_dynamics(values)
|
||||
while values:
|
||||
value_is_set = False
|
||||
for option in self._get_variable(self.config):
|
||||
path = option.path()
|
||||
if path not in values:
|
||||
path = path.upper()
|
||||
options = values.get(path, {}).get("options", {})
|
||||
if path not in values or options.get("upper") is not True:
|
||||
continue
|
||||
else:
|
||||
options = values[path].get("options", {})
|
||||
value = values[path]["values"]
|
||||
if option.ismulti():
|
||||
if options.get("multi_separator") and not isinstance(value, list):
|
||||
value = value.split(options["multi_separator"])
|
||||
values[path]["values"] = value
|
||||
if options.get("needs_convert"):
|
||||
value = [convert_value(option, val) for val in value]
|
||||
values[path]["values"] = value
|
||||
values[path]["options"]["needs_convert"] = False
|
||||
elif options.get("needs_convert"):
|
||||
value = convert_value(option, value)
|
||||
index = option.index()
|
||||
if index is not None:
|
||||
if not isinstance(value, list) or index >= len(value):
|
||||
continue
|
||||
value = value[index]
|
||||
try:
|
||||
option.value.set(value)
|
||||
value_is_set = True
|
||||
if index is not None:
|
||||
values[path]["values"][index] = undefined
|
||||
if set(values[path]["values"]) == {undefined}:
|
||||
values.pop(path)
|
||||
else:
|
||||
values.pop(path)
|
||||
except Exception as err:
|
||||
if path != option.path():
|
||||
values[option.path()] = values.pop(path)
|
||||
if not value_is_set:
|
||||
break
|
||||
for path, data in values.items():
|
||||
try:
|
||||
option = self.config.option(path)
|
||||
value = data["values"]
|
||||
if option.isfollower():
|
||||
for index, val in enumerate(value):
|
||||
if val is undefined:
|
||||
continue
|
||||
self.config.option(path, index).value.set(val)
|
||||
else:
|
||||
option.value.set(value)
|
||||
except AttributeError as err:
|
||||
errors.append(str(err))
|
||||
except (ValueError, LeadershipError) as err:
|
||||
# errors.append(str(err).replace('"', "'"))
|
||||
errors.append(str(err))
|
||||
except PropertiesOptionError as err:
|
||||
# warnings.append(f'"{err}" but is defined in "{self.filename}"')
|
||||
warnings.append(str(err))
|
||||
return {
|
||||
"errors": errors,
|
||||
"warnings": warnings,
|
||||
}
|
||||
|
||||
def _get_variable(self, config):
|
||||
for subconfig in config:
|
||||
if subconfig.isoptiondescription():
|
||||
yield from self._get_variable(subconfig)
|
||||
else:
|
||||
yield subconfig
|
||||
|
||||
def _auto_configure_dynamics(
|
||||
self,
|
||||
values,
|
||||
):
|
||||
cache = {}
|
||||
added = []
|
||||
for path, data in list(values.items()):
|
||||
value = data["values"]
|
||||
# for value in data['values'].items():
|
||||
try:
|
||||
option = self.config.option(path)
|
||||
option.name()
|
||||
except (ConfigError, PropertiesOptionError):
|
||||
pass
|
||||
except AttributeError:
|
||||
config = self.config
|
||||
current_path = ""
|
||||
identifiers = []
|
||||
for name in path.split(".")[:-1]:
|
||||
if current_path:
|
||||
current_path += "."
|
||||
current_path += name
|
||||
if current_path in cache:
|
||||
config, identifier = cache[current_path]
|
||||
identifiers.append(identifier)
|
||||
else:
|
||||
tconfig = config.option(name)
|
||||
try:
|
||||
tconfig.group_type()
|
||||
config = tconfig
|
||||
except AttributeError:
|
||||
for tconfig in config.list(uncalculated=True):
|
||||
if tconfig.isdynamic(only_self=True):
|
||||
identifier = self._get_identifier(
|
||||
tconfig.name(), name
|
||||
)
|
||||
if identifier is None:
|
||||
continue
|
||||
dynamic_variable = tconfig.information.get(
|
||||
"dynamic_variable",
|
||||
None,
|
||||
)
|
||||
if not dynamic_variable:
|
||||
continue
|
||||
option_type = self.config.option(
|
||||
dynamic_variable
|
||||
).information.get("type")
|
||||
if identifiers:
|
||||
for s in identifiers:
|
||||
dynamic_variable = dynamic_variable.replace(
|
||||
"{{ identifier }}", str(s), 1
|
||||
)
|
||||
if dynamic_variable not in values:
|
||||
values[dynamic_variable] = {"values": []}
|
||||
added.append(dynamic_variable)
|
||||
elif dynamic_variable not in added:
|
||||
continue
|
||||
config = tconfig
|
||||
# option_type = option.information.get('type')
|
||||
typ = CONVERT_OPTION.get(option_type, {}).get(
|
||||
"func"
|
||||
)
|
||||
if typ:
|
||||
identifier = typ(identifier)
|
||||
if (
|
||||
identifier
|
||||
not in values[dynamic_variable]["values"]
|
||||
):
|
||||
values[dynamic_variable]["values"].append(
|
||||
identifier
|
||||
)
|
||||
identifiers.append(identifier)
|
||||
cache[current_path] = config, identifier
|
||||
break
|
||||
else:
|
||||
if option.isdynamic():
|
||||
parent_option = self.config.option(path.rsplit(".", 1)[0])
|
||||
identifiers = self._get_identifier(
|
||||
parent_option.name(uncalculated=True),
|
||||
parent_option.name(),
|
||||
)
|
||||
dynamic_variable = None
|
||||
while True:
|
||||
dynamic_variable = parent_option.information.get(
|
||||
"dynamic_variable",
|
||||
None,
|
||||
)
|
||||
if dynamic_variable:
|
||||
break
|
||||
parent_option = self.config.option(
|
||||
parent_option.path().rsplit(".", 1)[0]
|
||||
)
|
||||
if "." not in parent_option.path():
|
||||
parent_option = None
|
||||
break
|
||||
if not parent_option:
|
||||
continue
|
||||
identifiers = parent_option.identifiers()
|
||||
for identifier in identifiers:
|
||||
dynamic_variable = dynamic_variable.replace(
|
||||
"{{ identifier }}", str(identifier), 1
|
||||
)
|
||||
if dynamic_variable not in values:
|
||||
values[dynamic_variable] = {"values": []}
|
||||
added.append(dynamic_variable)
|
||||
elif dynamic_variable not in added:
|
||||
continue
|
||||
option_type = option.information.get("type")
|
||||
typ = CONVERT_OPTION.get(option_type, {}).get("func")
|
||||
if typ:
|
||||
identifier = typ(identifier)
|
||||
if identifier not in values[dynamic_variable]["values"]:
|
||||
values[dynamic_variable]["values"].append(identifier)
|
||||
cache[option.path()] = option, identifier
|
||||
|
||||
def _get_identifier(self, true_name, name) -> str:
|
||||
regexp = true_name.replace("{{ identifier }}", "(.*)")
|
||||
finded = findall(regexp, name)
|
||||
if len(finded) != 1 or not finded[0]:
|
||||
return
|
||||
return finded[0]
|
||||
|
||||
|
||||
def convert_value(option, value):
|
||||
if value == "":
|
||||
return None
|
||||
option_type = option.information.get("type")
|
||||
func = CONVERT_OPTION.get(option_type, {}).get("func")
|
||||
if func:
|
||||
return func(value)
|
||||
return value
|
||||
|
||||
|
||||
__all__ = ("Rougail", "RougailConfig", "RougailUpgrade")
|
||||
|
|
|
@ -71,6 +71,11 @@ class SpaceAnnotator: # pylint: disable=R0903
|
|||
if extra_annotator in ANNOTATORS:
|
||||
continue
|
||||
get_annotators(ANNOTATORS, extra_annotator)
|
||||
for user_data in objectspace.user_datas:
|
||||
try:
|
||||
get_annotators(ANNOTATORS, f"rougail.user_data_{user_data}", "annotator")
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
for plugin in objectspace.plugins:
|
||||
try:
|
||||
get_annotators(ANNOTATORS, f"rougail.{plugin}", "annotator")
|
||||
|
@ -81,6 +86,8 @@ class SpaceAnnotator: # pylint: disable=R0903
|
|||
annotators.extend(ANNOTATORS[extra_annotator])
|
||||
for plugin in objectspace.plugins:
|
||||
annotators.extend(ANNOTATORS[f"rougail.{plugin}.annotator"])
|
||||
for user_data in objectspace.user_datas:
|
||||
annotators.extend(ANNOTATORS[f"rougail.user_data_{user_data}.annotator"])
|
||||
annotators = sorted(annotators, key=get_level)
|
||||
functions = {}
|
||||
functions_files = objectspace.functions_files
|
||||
|
|
|
@ -129,6 +129,8 @@ class Annotator(Walk):
|
|||
family.dynamic.variable,
|
||||
family.path,
|
||||
)
|
||||
if family.version == '1.0' and "{{ suffix }}" in path:
|
||||
path = path.replace("{{ suffix }}", "{{ identifier }}")
|
||||
self.objectspace.informations.add(family.path, "dynamic_variable", path)
|
||||
|
||||
def change_modes(self):
|
||||
|
|
|
@ -120,7 +120,7 @@ class Annotator(Walk):
|
|||
else:
|
||||
value = []
|
||||
for calculation in frozen:
|
||||
calculation_copy = calculation.copy()
|
||||
calculation_copy = calculation.model_copy()
|
||||
calculation_copy.attribute_name = "frozen"
|
||||
calculation_copy.ori_path = calculation_copy.path
|
||||
calculation_copy.path = path
|
||||
|
|
|
@ -26,12 +26,16 @@ You should have received a copy of the GNU Lesser General Public License
|
|||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
"""
|
||||
|
||||
from sys import version_info
|
||||
|
||||
from pathlib import Path
|
||||
from tiramisu import Config
|
||||
from ruamel.yaml import YAML
|
||||
from .utils import _, load_modules, normalize_family
|
||||
from .convert import RougailConvert
|
||||
|
||||
if version_info.major == 3 and version_info.minor:
|
||||
import rougail.structural_commandline.object_model
|
||||
|
||||
RENAMED = {
|
||||
"dictionaries_dir": "main_dictionaries",
|
||||
|
@ -182,7 +186,9 @@ class FakeRougailConvert(RougailConvert):
|
|||
self.base_option_name = "baseoption"
|
||||
self.export_with_import = True
|
||||
self.internal_functions = []
|
||||
self.force_optional = False
|
||||
self.plugins = ["structural_commandline"]
|
||||
self.user_datas = []
|
||||
self.add_extra_options = self.add_extra_options
|
||||
|
||||
|
||||
|
@ -387,6 +393,11 @@ suffix:
|
|||
default: ''
|
||||
mandatory: false
|
||||
commandline: false
|
||||
|
||||
force_optional:
|
||||
description: Every variable in calculation are optional
|
||||
negative_description: Variable in calculation are not optional by default
|
||||
default: False
|
||||
"""
|
||||
processes = {
|
||||
"structural": [],
|
||||
|
@ -477,12 +488,17 @@ suffix:
|
|||
extra_vars |= obj["extra_vars"]
|
||||
if not "options" in obj:
|
||||
continue
|
||||
convert.parse_root_file(
|
||||
f'rougail.config.{obj["name"]}',
|
||||
"",
|
||||
"1.1",
|
||||
YAML().load(obj["options"]),
|
||||
)
|
||||
if not isinstance(obj["options"], list):
|
||||
options = [obj["options"]]
|
||||
else:
|
||||
options = obj["options"]
|
||||
for option in options:
|
||||
convert.parse_root_file(
|
||||
f'rougail.config.{obj["name"]}',
|
||||
"",
|
||||
"1.1",
|
||||
YAML().load(option),
|
||||
)
|
||||
|
||||
tiram_obj = convert.save(None)
|
||||
optiondescription = {}
|
||||
|
|
|
@ -390,9 +390,11 @@ class ParserVariable:
|
|||
self.base_option_name = rougailconfig["base_option_name"]
|
||||
self.export_with_import = rougailconfig["export_with_import"]
|
||||
self.internal_functions = rougailconfig["internal_functions"]
|
||||
self.force_optional = rougailconfig["force_optional"]
|
||||
self.add_extra_options = rougailconfig[
|
||||
"structural_commandline.add_extra_options"
|
||||
]
|
||||
self.user_datas = rougailconfig["step.user_data"]
|
||||
self.plugins = rougailconfig["plugins"]
|
||||
|
||||
def _init(self):
|
||||
|
@ -426,7 +428,7 @@ class ParserVariable:
|
|||
# FIXME: only for format 1.0
|
||||
self.family_types = hint["type"].__args__ # pylint: disable=W0201
|
||||
self.family_attrs = frozenset( # pylint: disable=W0201
|
||||
set(hint) - {"name", "path", "xmlfiles"} | {"redefine"}
|
||||
set(hint) - {"name", "path", "xmlfiles"} | {"redefine", "exists"}
|
||||
)
|
||||
self.family_calculations = self.search_calculation( # pylint: disable=W0201
|
||||
hint
|
||||
|
@ -588,6 +590,10 @@ class ParserVariable:
|
|||
return
|
||||
family_obj = {}
|
||||
subfamily_obj = {}
|
||||
if version != '1.0':
|
||||
exists = obj.pop("exists", None)
|
||||
else:
|
||||
exists = None
|
||||
force_to_attrs = list(self.list_attributes(obj))
|
||||
for key, value in obj.items():
|
||||
if key in force_to_attrs:
|
||||
|
@ -599,9 +605,9 @@ class ParserVariable:
|
|||
if path in self.paths:
|
||||
# it's just for modify subfamily or subvariable, do not redefine
|
||||
if family_obj:
|
||||
if not obj.pop("redefine", False):
|
||||
if exists in [None, True] and not obj.pop("redefine", False):
|
||||
raise DictConsistencyError(
|
||||
f'The family "{path}" already exists and it is not redefined',
|
||||
_('The family "{0}" already exists and it is not redefined').format(path),
|
||||
32,
|
||||
[filename],
|
||||
)
|
||||
|
@ -615,20 +621,21 @@ class ParserVariable:
|
|||
version,
|
||||
typ="family",
|
||||
)
|
||||
self.paths.add(
|
||||
path,
|
||||
self.paths[path].model_copy(update=obj),
|
||||
family_is_dynamic,
|
||||
parent_dynamic,
|
||||
force=True,
|
||||
)
|
||||
if exists in [None, True]:
|
||||
self.paths.add(
|
||||
path,
|
||||
self.paths[path].model_copy(update=obj),
|
||||
family_is_dynamic,
|
||||
parent_dynamic,
|
||||
force=True,
|
||||
)
|
||||
self.paths[path].xmlfiles.append(filename)
|
||||
force_not_first = True
|
||||
if self.paths[path].type == "dynamic":
|
||||
family_is_dynamic = True
|
||||
parent_dynamic = path
|
||||
else:
|
||||
if "redefine" in obj and obj["redefine"]:
|
||||
if exists is None and "redefine" in obj and obj["redefine"]:
|
||||
raise Exception(
|
||||
f'cannot redefine the inexisting family "{path}" in {filename}'
|
||||
)
|
||||
|
|
|
@ -332,6 +332,7 @@ class JinjaCalculation(Calculation):
|
|||
}
|
||||
if self.version != "1.0":
|
||||
default["params"][true_path]["propertyerror"] = False
|
||||
default["params"][true_path]["optional"] = True
|
||||
if identifier:
|
||||
default["params"][true_path]["identifier"] = identifier
|
||||
return default
|
||||
|
@ -432,13 +433,17 @@ class _VariableCalculation(Calculation):
|
|||
needs_multi: Optional[bool] = None,
|
||||
):
|
||||
if not variable:
|
||||
msg = f'Variable not found "{self.variable}" for attribut "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 88, self.xmlfiles)
|
||||
if not objectspace.force_optional:
|
||||
msg = f'Variable not found "{self.variable}" for attribut "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 88, self.xmlfiles)
|
||||
return {None: [['example']]}
|
||||
param = {
|
||||
"type": "variable",
|
||||
"variable": variable,
|
||||
"propertyerror": self.propertyerror,
|
||||
}
|
||||
if isinstance(self, VariableCalculation) and self.optional:
|
||||
param["optional"] = self.optional
|
||||
if identifier:
|
||||
param["identifier"] = identifier
|
||||
params = {None: [param]}
|
||||
|
@ -488,6 +493,12 @@ class _VariableCalculation(Calculation):
|
|||
raise DictConsistencyError(msg, 21, self.xmlfiles)
|
||||
else:
|
||||
params[None][0]["index"] = {"index": {"type": "index"}}
|
||||
if self.path in objectspace.followers:
|
||||
multi = objectspace.multis[self.path] == "submulti"
|
||||
else:
|
||||
multi = self.path in objectspace.multis
|
||||
if multi:
|
||||
params["__internal_multi"] = True
|
||||
return params
|
||||
|
||||
|
||||
|
@ -503,7 +514,7 @@ class VariableCalculation(_VariableCalculation):
|
|||
msg = f'"{self.attribute_name}" variable shall not have an "optional" attribute for variable "{self.variable}"'
|
||||
raise DictConsistencyError(msg, 33, self.xmlfiles)
|
||||
variable, identifier = self.get_variable(objectspace)
|
||||
if not variable and self.optional:
|
||||
if not variable and self.optional or (objectspace.force_optional and self.attribute_name == "default"):
|
||||
raise VariableCalculationDependencyError()
|
||||
params = self.get_params(
|
||||
objectspace,
|
||||
|
@ -517,7 +528,8 @@ class VariableCalculation(_VariableCalculation):
|
|||
|
||||
|
||||
class VariablePropertyCalculation(_VariableCalculation):
|
||||
attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||
# For python 3.9 attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||
attribute_name: Literal["frozen", "hidden", "disabled", "mandatory"]
|
||||
when: Any = undefined
|
||||
when_not: Any = undefined
|
||||
|
||||
|
@ -532,30 +544,31 @@ class VariablePropertyCalculation(_VariableCalculation):
|
|||
identifier,
|
||||
needs_multi=False,
|
||||
)
|
||||
variable = params[None][0]["variable"]
|
||||
if self.when is not undefined:
|
||||
if self.version == "1.0":
|
||||
msg = f'when is not allowed in format version 1.0 for attribute "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 103, variable.xmlfiles)
|
||||
if self.when_not is not undefined:
|
||||
msg = f'the variable "{self.path}" has an invalid attribute "{self.attribute_name}", when and when_not cannot set together'
|
||||
raise DictConsistencyError(msg, 31, variable.xmlfiles)
|
||||
when = self.when
|
||||
inverse = False
|
||||
elif self.when_not is not undefined:
|
||||
if self.version == "1.0":
|
||||
msg = f'when_not is not allowed in format version 1.0 for attribute "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 104, variable.xmlfiles)
|
||||
when = self.when_not
|
||||
inverse = True
|
||||
else:
|
||||
if variable.type != "boolean":
|
||||
raise Exception("only boolean!")
|
||||
when = True
|
||||
inverse = False
|
||||
if params[None] and "variable" in params[None][0]:
|
||||
variable = params[None][0]["variable"]
|
||||
if self.when is not undefined:
|
||||
if self.version == "1.0":
|
||||
msg = f'when is not allowed in format version 1.0 for attribute "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 103, variable.xmlfiles)
|
||||
if self.when_not is not undefined:
|
||||
msg = f'the variable "{self.path}" has an invalid attribute "{self.attribute_name}", when and when_not cannot set together'
|
||||
raise DictConsistencyError(msg, 31, variable.xmlfiles)
|
||||
when = self.when
|
||||
inverse = False
|
||||
elif self.when_not is not undefined:
|
||||
if self.version == "1.0":
|
||||
msg = f'when_not is not allowed in format version 1.0 for attribute "{self.attribute_name}" for variable "{self.path}"'
|
||||
raise DictConsistencyError(msg, 104, variable.xmlfiles)
|
||||
when = self.when_not
|
||||
inverse = True
|
||||
else:
|
||||
if variable.type != "boolean":
|
||||
raise Exception("only boolean!")
|
||||
when = True
|
||||
inverse = False
|
||||
params["when"] = when
|
||||
params["inverse"] = inverse
|
||||
params[None].insert(0, self.attribute_name)
|
||||
params["when"] = when
|
||||
params["inverse"] = inverse
|
||||
return {
|
||||
"function": "variable_to_property",
|
||||
"params": params,
|
||||
|
@ -593,9 +606,15 @@ class InformationCalculation(Calculation):
|
|||
self.namespace,
|
||||
self.xmlfiles,
|
||||
)
|
||||
if variable is None or identifier is not None:
|
||||
raise Exception("pfff")
|
||||
params[None][0]["variable"] = variable
|
||||
if variable is None:
|
||||
if not objectspace.force_optional:
|
||||
msg = f'cannot find variable "{self.variable}" for the information "{self.information}" when calculating "{self.attribute_name}"'
|
||||
raise DictConsistencyError(msg, 40, variable.xmlfiles)
|
||||
if identifier is not None:
|
||||
msg = f'identifier not allowed for the information "{self.information}" when calculating "{self.attribute_name}"'
|
||||
raise DictConsistencyError(msg, 41, variable.xmlfiles)
|
||||
if variable:
|
||||
params[None][0]["variable"] = variable
|
||||
if self.default_values:
|
||||
params["__default_value"] = self.default_values
|
||||
return {
|
||||
|
@ -631,7 +650,8 @@ class IdentifierCalculation(_IdentifierCalculation):
|
|||
|
||||
|
||||
class IdentifierPropertyCalculation(_IdentifierCalculation):
|
||||
attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||
# for python 3.9 attribute_name: Literal[*PROPERTY_ATTRIBUTE]
|
||||
attribute_name: Literal["frozen", "hidden", "disabled", "mandatory"]
|
||||
when: Any = undefined
|
||||
when_not: Any = undefined
|
||||
|
||||
|
|
|
@ -27,10 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
|
||||
from typing import Any
|
||||
|
||||
try:
|
||||
from tiramisu5 import DynOptionDescription, calc_value
|
||||
except ModuleNotFoundError:
|
||||
from tiramisu import DynOptionDescription, calc_value
|
||||
from importlib.machinery import SourceFileLoader as _SourceFileLoader
|
||||
from importlib.util import (
|
||||
spec_from_loader as _spec_from_loader,
|
||||
|
@ -40,8 +36,8 @@ from jinja2 import StrictUndefined, DictLoader
|
|||
from jinja2.sandbox import SandboxedEnvironment
|
||||
from rougail.object_model import CONVERT_OPTION
|
||||
from rougail.error import display_xmlfiles
|
||||
from tiramisu import function_waiting_for_error
|
||||
from tiramisu.error import ValueWarning, ConfigError, PropertiesOptionError
|
||||
from tiramisu import DynOptionDescription, calc_value, function_waiting_for_error
|
||||
from tiramisu.error import ValueWarning, ConfigError, PropertiesOptionError, CancelParam
|
||||
from .utils import normalize_family
|
||||
|
||||
|
||||
|
@ -102,8 +98,10 @@ def load_functions(path):
|
|||
func[function] = getattr(func_, function)
|
||||
|
||||
|
||||
def rougail_calc_value(*args, __default_value=None, **kwargs):
|
||||
def rougail_calc_value(*args, __default_value=None, __internal_multi=False, **kwargs):
|
||||
values = calc_value(*args, **kwargs)
|
||||
if values is None and __internal_multi:
|
||||
values = []
|
||||
if __default_value is not None and values in [None, []]:
|
||||
return __default_value
|
||||
return values
|
||||
|
@ -128,9 +126,13 @@ def jinja_to_function(
|
|||
if "." in key:
|
||||
c_kw = kw
|
||||
path, var = key.rsplit(".", 1)
|
||||
if isinstance(value, CancelParam):
|
||||
count_o_path = value.origin_path.count('.') - value.current_path.count('.')
|
||||
path = path.rsplit(".", count_o_path)[0]
|
||||
for subkey in path.split("."):
|
||||
c_kw = c_kw.setdefault(subkey, {})
|
||||
c_kw[var] = value
|
||||
if not isinstance(value, CancelParam):
|
||||
c_kw[var] = value
|
||||
else:
|
||||
if key in kw:
|
||||
raise ConfigError(
|
||||
|
|
|
@ -339,6 +339,7 @@ class Common:
|
|||
return self.build_option_param(
|
||||
param["variable"],
|
||||
param.get("propertyerror", True),
|
||||
param.get("optional", False),
|
||||
param.get("identifier"),
|
||||
param.get("dynamic"),
|
||||
param.get("whole", False),
|
||||
|
@ -355,6 +356,7 @@ class Common:
|
|||
self,
|
||||
variable,
|
||||
propertyerror,
|
||||
optional: bool,
|
||||
identifier: Optional[str],
|
||||
dynamic,
|
||||
whole: bool,
|
||||
|
@ -377,6 +379,8 @@ class Common:
|
|||
ident = self.convert_str(ident)
|
||||
identifiers.append(str(ident))
|
||||
params.append("[" + ", ".join(identifiers) + "]")
|
||||
if optional:
|
||||
params.append("optional=True")
|
||||
else:
|
||||
param_type = "ParamOption"
|
||||
if not propertyerror:
|
||||
|
|
253
src/rougail/user_datas.py
Normal file
253
src/rougail/user_datas.py
Normal file
|
@ -0,0 +1,253 @@
|
|||
"""
|
||||
Silique (https://www.silique.fr)
|
||||
Copyright (C) 2024
|
||||
|
||||
distribued with GPL-2 or later license
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
"""
|
||||
from typing import List
|
||||
from re import findall
|
||||
|
||||
from tiramisu import undefined
|
||||
from tiramisu.error import PropertiesOptionError, LeadershipError, ConfigError
|
||||
|
||||
from .object_model import CONVERT_OPTION
|
||||
|
||||
|
||||
class UserDatas:
|
||||
def __init__(self, config) -> None:
|
||||
self.config = config
|
||||
|
||||
def user_datas(self, user_datas: List[dict]):
|
||||
values = {}
|
||||
errors = []
|
||||
warnings = []
|
||||
for datas in user_datas:
|
||||
options = datas.get("options", {})
|
||||
for name, data in datas.get("values", {}).items():
|
||||
values[name] = {
|
||||
"values": data,
|
||||
"options": options.copy(),
|
||||
}
|
||||
errors.extend(datas.get("errors", []))
|
||||
warnings.extend(datas.get("warnings", []))
|
||||
self._auto_configure_dynamics(values)
|
||||
while values:
|
||||
value_is_set = False
|
||||
for option in self._get_variable(self.config):
|
||||
path = option.path()
|
||||
if path not in values:
|
||||
continue
|
||||
options = values[path].get("options", {})
|
||||
value = values[path]["values"]
|
||||
|
||||
# converted value
|
||||
if option.ismulti():
|
||||
if options.get("multi_separator") and not isinstance(value, list):
|
||||
value = value.split(options["multi_separator"])
|
||||
values[path]["values"] = value
|
||||
if option.issubmulti():
|
||||
value = [[val] for val in value]
|
||||
if options.get("needs_convert"):
|
||||
if option.issubmulti():
|
||||
for idx, val in enumerate(value):
|
||||
value[idx] = [convert_value(option, v) for v in val]
|
||||
else:
|
||||
value = [convert_value(option, val) for val in value]
|
||||
values[path]["values"] = value
|
||||
values[path]["options"]["needs_convert"] = False
|
||||
elif options.get("needs_convert"):
|
||||
value = convert_value(option, value)
|
||||
index = option.index()
|
||||
if index is not None:
|
||||
if not isinstance(value, list) or index >= len(value):
|
||||
continue
|
||||
value = value[index]
|
||||
try:
|
||||
option.value.set(value)
|
||||
value_is_set = True
|
||||
# value is correctly set, remove variable to the set
|
||||
if index is not None:
|
||||
# if it's a follower waiting for all followers are sets
|
||||
values[path]["values"][index] = undefined
|
||||
if set(values[path]["values"]) == {undefined}:
|
||||
values.pop(path)
|
||||
else:
|
||||
values.pop(path)
|
||||
except Exception:
|
||||
if path != option.path():
|
||||
values[option.path()] = values.pop(path)
|
||||
if not value_is_set:
|
||||
break
|
||||
# we don't find variable, apply value just to get error or warning messages
|
||||
for path, data in values.items():
|
||||
try:
|
||||
option = self.config.option(path)
|
||||
value = data["values"]
|
||||
if option.isfollower():
|
||||
for index, val in enumerate(value):
|
||||
if val is undefined:
|
||||
continue
|
||||
self.config.option(path, index).value.set(val)
|
||||
else:
|
||||
option.value.set(value)
|
||||
except AttributeError as err:
|
||||
errors.append(str(err))
|
||||
except (ValueError, LeadershipError) as err:
|
||||
errors.append(str(err))
|
||||
except PropertiesOptionError as err:
|
||||
warnings.append(str(err))
|
||||
return {
|
||||
"errors": errors,
|
||||
"warnings": warnings,
|
||||
}
|
||||
|
||||
def _get_variable(self, config):
|
||||
for subconfig in config:
|
||||
if subconfig.isoptiondescription():
|
||||
yield from self._get_variable(subconfig)
|
||||
else:
|
||||
yield subconfig
|
||||
|
||||
def _auto_configure_dynamics(
|
||||
self,
|
||||
values,
|
||||
):
|
||||
cache = {}
|
||||
added = []
|
||||
for path, data in list(values.items()):
|
||||
value = data["values"]
|
||||
try:
|
||||
option = self.config.option(path)
|
||||
option.name()
|
||||
except (ConfigError, PropertiesOptionError):
|
||||
pass
|
||||
except AttributeError:
|
||||
config = self.config
|
||||
current_path = ""
|
||||
for name in path.split(".")[:-1]:
|
||||
if current_path:
|
||||
current_path += "."
|
||||
current_path += name
|
||||
if current_path in cache:
|
||||
config, identifier = cache[current_path]
|
||||
else:
|
||||
tconfig = config.option(name)
|
||||
try:
|
||||
tconfig.group_type()
|
||||
config = tconfig
|
||||
except AttributeError:
|
||||
for tconfig in config.list(uncalculated=True):
|
||||
if tconfig.isdynamic(only_self=True):
|
||||
identifier = self._get_identifier(
|
||||
tconfig.name(), name
|
||||
)
|
||||
if identifier is None:
|
||||
continue
|
||||
dynamic_variable = tconfig.information.get(
|
||||
"dynamic_variable",
|
||||
None,
|
||||
)
|
||||
if not dynamic_variable:
|
||||
continue
|
||||
option_type = self.config.option(
|
||||
dynamic_variable
|
||||
).information.get("type")
|
||||
identifiers = tconfig.identifiers()
|
||||
if identifiers:
|
||||
for s in identifiers:
|
||||
dynamic_variable = dynamic_variable.replace(
|
||||
"{{ identifier }}", str(s), 1
|
||||
)
|
||||
if dynamic_variable not in values and not self.config.option(dynamic_variable).get().impl_getdefault():
|
||||
values[dynamic_variable] = {"values": []}
|
||||
added.append(dynamic_variable)
|
||||
elif dynamic_variable not in added:
|
||||
continue
|
||||
config = tconfig
|
||||
typ = CONVERT_OPTION.get(option_type, {}).get(
|
||||
"func"
|
||||
)
|
||||
if typ:
|
||||
identifier = typ(identifier)
|
||||
if (
|
||||
identifier
|
||||
not in values[dynamic_variable]["values"]
|
||||
):
|
||||
values[dynamic_variable]["values"].append(
|
||||
identifier
|
||||
)
|
||||
cache[current_path] = config, identifier
|
||||
break
|
||||
else:
|
||||
if option.isdynamic():
|
||||
parent_option = self.config.option(path.rsplit(".", 1)[0])
|
||||
identifier = self._get_identifier(
|
||||
parent_option.name(uncalculated=True),
|
||||
parent_option.name(),
|
||||
)
|
||||
dynamic_variable = None
|
||||
while True:
|
||||
dynamic_variable = parent_option.information.get(
|
||||
"dynamic_variable",
|
||||
None,
|
||||
)
|
||||
if dynamic_variable:
|
||||
break
|
||||
parent_option = self.config.option(
|
||||
parent_option.path().rsplit(".", 1)[0]
|
||||
)
|
||||
if "." not in parent_option.path():
|
||||
parent_option = None
|
||||
break
|
||||
if not parent_option:
|
||||
continue
|
||||
identifiers = parent_option.identifiers()
|
||||
for identifier in identifiers:
|
||||
dynamic_variable = dynamic_variable.replace(
|
||||
"{{ identifier }}", str(identifier), 1
|
||||
)
|
||||
if dynamic_variable not in values and not self.config.option(dynamic_variable).get().impl_getdefault():
|
||||
values[dynamic_variable] = {"values": []}
|
||||
added.append(dynamic_variable)
|
||||
elif dynamic_variable not in added:
|
||||
continue
|
||||
option_type = option.information.get("type")
|
||||
typ = CONVERT_OPTION.get(option_type, {}).get("func")
|
||||
if typ:
|
||||
identifier = typ(identifier)
|
||||
if identifier not in values[dynamic_variable]["values"]:
|
||||
values[dynamic_variable]["values"].append(identifier)
|
||||
cache[option.path()] = option, identifier
|
||||
|
||||
def _get_identifier(self, true_name, name) -> str:
|
||||
if true_name == "{{ identifier }}":
|
||||
return name
|
||||
regexp = true_name.replace("{{ identifier }}", "(.*)")
|
||||
finded = findall(regexp, name)
|
||||
if len(finded) != 1 or not finded[0]:
|
||||
return None
|
||||
return finded[0]
|
||||
|
||||
|
||||
def convert_value(option, value):
|
||||
if value == "":
|
||||
return None
|
||||
option_type = option.information.get("type")
|
||||
func = CONVERT_OPTION.get(option_type, {}).get("func")
|
||||
if func:
|
||||
return func(value)
|
||||
return value
|
|
@ -11,6 +11,6 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = DomainnameOption(name="var1", doc="a first variable", multi=True, type="domainname", allow_ip=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'domainname'})
|
||||
option_3 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
option_3 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
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,11 +11,11 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = DomainnameOption(name="var1", doc="a first variable", multi=True, type="domainname", allow_ip=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'domainname'})
|
||||
option_4 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)))), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
option_4 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, option_4], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_7 = DomainnameOption(name="var1", doc="a first variable", multi=True, type="domainname", allow_ip=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'domainname'})
|
||||
option_8 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_7)))), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
option_8 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_7)), kwargs={'__internal_multi': ParamValue(True)})), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_7, option_8], properties=frozenset({"basic"}))
|
||||
optiondescription_5 = OptionDescription(name="2", doc="2", children=[optiondescription_6], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_5])
|
||||
|
|
|
@ -7,5 +7,5 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = DomainnameOption(name="var1", doc="a first variable", multi=True, type="domainname", allow_ip=True, properties=frozenset({"basic", "mandatory"}), informations={'type': 'domainname'})
|
||||
option_2 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_1)))), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
option_2 = DomainnameOption(name="var2", doc="a second variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True)})), type="domainname", allow_ip=True, properties=frozenset({"mandatory", "standard"}), informations={'type': 'domainname'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||
|
|
|
@ -11,6 +11,6 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_2))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -11,11 +11,11 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_3))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_3)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, option_4], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_7 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_7))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_7)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_7)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_7)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_7, option_8], properties=frozenset({"standard"}))
|
||||
optiondescription_5 = OptionDescription(name="2", doc="2", children=[optiondescription_6], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_5])
|
||||
|
|
|
@ -7,5 +7,5 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_1))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_1)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||
|
|
|
@ -11,6 +11,6 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_2))))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)}))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -11,11 +11,11 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_3))))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)}))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, option_4], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_7 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_7))))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_7)), kwargs={'__internal_multi': ParamValue(True)}))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_7, option_8], properties=frozenset({"standard"}))
|
||||
optiondescription_5 = OptionDescription(name="2", doc="2", children=[optiondescription_6], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_5])
|
||||
|
|
|
@ -7,5 +7,5 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(name="my_variable", doc="my_variable", default="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_1))))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True)}))], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||
|
|
|
@ -11,6 +11,6 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -11,11 +11,11 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, option_4], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_7 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_7)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_7)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_6 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_7, option_8], properties=frozenset({"standard"}))
|
||||
optiondescription_5 = OptionDescription(name="2", doc="2", children=[optiondescription_6], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_5])
|
||||
|
|
|
@ -7,5 +7,5 @@ ALLOWED_LEADER_PROPERTIES.add("basic")
|
|||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(name="my_variable", doc="my_variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_1)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="my_calculated_variable", doc="my_calculated_variable", multi=True, default=Calculation(func['calc_value'], Params((ParamOption(option_1)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])
|
||||
|
|
|
@ -3,4 +3,6 @@ version: '1.1'
|
|||
var1:
|
||||
description: the second variable
|
||||
empty: false
|
||||
default: ['value', None]
|
||||
default:
|
||||
- 'value'
|
||||
- null
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"owner": "default",
|
||||
"value": [
|
||||
"value",
|
||||
"None"
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"rougail.var1": [
|
||||
"value",
|
||||
"None"
|
||||
null
|
||||
]
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"owner": "default",
|
||||
"value": [
|
||||
"value",
|
||||
"None"
|
||||
null
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
[]
|
||||
["rougail.var1"]
|
|
@ -10,6 +10,6 @@ except:
|
|||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", "None"], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", None], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -10,10 +10,10 @@ except:
|
|||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", "None"], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", None], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_6 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", "None"], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
option_6 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", None], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_5 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_6], properties=frozenset({"standard"}))
|
||||
optiondescription_4 = OptionDescription(name="2", doc="2", children=[optiondescription_5], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_4])
|
||||
|
|
|
@ -6,5 +6,5 @@ load_functions('tests/dictionaries/../eosfunc/test.py')
|
|||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", "None"], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
option_1 = StrOption(name="var1", doc="the second variable", multi=True, default=["value", None], default_multi="value", properties=frozenset({"mandatory", "notempty", "standard"}), informations={'type': 'string'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1])
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
version: '1.1'
|
||||
|
||||
family1: # a family
|
||||
|
||||
variable1: # a variable
|
||||
|
||||
family2: # a second family
|
||||
|
||||
variable2: # a second variable
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
version: '1.1'
|
||||
|
||||
family1:
|
||||
exists: true
|
||||
redefine: true
|
||||
description: new description
|
||||
|
||||
family2:
|
||||
exists: false
|
||||
description: new description
|
||||
|
||||
family3:
|
||||
exists: true
|
||||
redefine: true
|
||||
description: new description
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.family1.variable1": {
|
||||
"owner": "default",
|
||||
"value": null
|
||||
},
|
||||
"rougail.family2.variable2": {
|
||||
"owner": "default",
|
||||
"value": null
|
||||
}
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"rougail.family1.variable1": null,
|
||||
"rougail.family2.variable2": null
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"rougail.family1.variable1": {
|
||||
"owner": "default",
|
||||
"value": null
|
||||
},
|
||||
"rougail.family2.variable2": {
|
||||
"owner": "default",
|
||||
"value": null
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
["rougail.family1.variable1", "rougail.family2.variable2"]
|
|
@ -0,0 +1,18 @@
|
|||
from tiramisu import *
|
||||
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
|
||||
from re import compile as re_compile
|
||||
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
|
||||
load_functions('tests/dictionaries/../eosfunc/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="variable1", doc="a variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="family1", doc="new description", children=[option_3], properties=frozenset({"basic"}))
|
||||
option_5 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_4 = OptionDescription(name="family2", doc="a second family", children=[option_5], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2, optiondescription_4], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -0,0 +1,25 @@
|
|||
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('tests/dictionaries/../eosfunc/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_4 = StrOption(name="variable1", doc="a variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_3 = OptionDescription(name="family1", doc="new description", children=[option_4], properties=frozenset({"basic"}))
|
||||
option_6 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_5 = OptionDescription(name="family2", doc="a second family", children=[option_6], properties=frozenset({"basic"}))
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_3, optiondescription_5], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_10 = StrOption(name="variable1", doc="a variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_9 = OptionDescription(name="family1", doc="new description", children=[option_10], properties=frozenset({"basic"}))
|
||||
option_12 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_11 = OptionDescription(name="family2", doc="a second family", children=[option_12], properties=frozenset({"basic"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_9, optiondescription_11], properties=frozenset({"basic"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_7])
|
|
@ -0,0 +1,13 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="variable1", doc="a variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="family1", doc="new description", children=[option_2], properties=frozenset({"basic"}))
|
||||
option_4 = StrOption(name="variable2", doc="a second variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_3 = OptionDescription(name="family2", doc="a second family", children=[option_4], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_3])
|
|
@ -13,7 +13,7 @@ ALLOWED_LEADER_PROPERTIES.add("advanced")
|
|||
dict_env['validators_rougail.general.int'] = "{% if _.int == int2 %}\nint and int2 must be different\n{% endif %}\n"
|
||||
dict_env['validators_rougail.general.int_0'] = "{% if int3 is defined and _.int == int3 %}\nint and int3 must be different\n{% endif %}\n"
|
||||
option_4 = IntOption(name="int2", doc="a second number", default=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_3 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.general.int"), 'int2': ParamOption(option_4), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
option_3 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.general.int"), 'int2': ParamOption(option_4), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
optiondescription_2 = OptionDescription(name="general", doc="a family", children=[option_3, option_4], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -15,12 +15,12 @@ dict_env['validators_1.rougail.general.int_0'] = "{% if int3 is defined and _.in
|
|||
dict_env['validators_2.rougail.general.int'] = "{% if _.int == int2 %}\nint and int2 must be different\n{% endif %}\n"
|
||||
dict_env['validators_2.rougail.general.int_0'] = "{% if int3 is defined and _.int == int3 %}\nint and int3 must be different\n{% endif %}\n"
|
||||
option_5 = IntOption(name="int2", doc="a second number", default=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_4 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_1.rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("1.rougail.general.int"), 'int2': ParamOption(option_5), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_1.rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("1.rougail.general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
option_4 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_1.rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("1.rougail.general.int"), 'int2': ParamOption(option_5), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_1.rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("1.rougail.general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
optiondescription_3 = OptionDescription(name="general", doc="a family", children=[option_4, option_5], properties=frozenset({"basic"}))
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_3], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_10 = IntOption(name="int2", doc="a second number", default=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_9 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_2.rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("2.rougail.general.int"), 'int2': ParamOption(option_10), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_2.rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("2.rougail.general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
option_9 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_2.rougail.general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("2.rougail.general.int"), 'int2': ParamOption(option_10), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_2.rougail.general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("2.rougail.general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
optiondescription_8 = OptionDescription(name="general", doc="a family", children=[option_9, option_10], properties=frozenset({"basic"}))
|
||||
optiondescription_7 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_8], properties=frozenset({"basic"}))
|
||||
optiondescription_6 = OptionDescription(name="2", doc="2", children=[optiondescription_7], properties=frozenset({"basic"}))
|
|
@ -9,6 +9,6 @@ ALLOWED_LEADER_PROPERTIES.add("advanced")
|
|||
dict_env['validators_general.int'] = "{% if _.int == int2 %}\nint and int2 must be different\n{% endif %}\n"
|
||||
dict_env['validators_general.int_0'] = "{% if int3 is defined and _.int == int3 %}\nint and int3 must be different\n{% endif %}\n"
|
||||
option_3 = IntOption(name="int2", doc="a second number", default=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_2 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("general.int"), 'int2': ParamOption(option_3), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/04_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
option_2 = IntOption(name="int", doc="a first number", validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_general.int"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("general.int"), 'int2': ParamOption(option_3), '_.int': ParamSelfOption(whole=False)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_general.int_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/24_7validators_variable_optional/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("general.int"), '_.int': ParamSelfOption(whole=False)}))], properties=frozenset({"basic", "mandatory"}), informations={'type': 'number', 'test': (5,)})
|
||||
optiondescription_1 = OptionDescription(name="general", doc="a family", children=[option_2, option_3], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -12,7 +12,7 @@ ALLOWED_LEADER_PROPERTIES.add("standard")
|
|||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="leader", doc="the leader", multi=True, default=["leader"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="follower1", doc="the follower1", multi=submulti, default_multi=["value"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_5 = StrOption(name="follower2", doc="the follower2", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_4)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_5 = StrOption(name="follower2", doc="the follower2", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)})), 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"}))
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -12,13 +12,13 @@ ALLOWED_LEADER_PROPERTIES.add("standard")
|
|||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_4 = StrOption(name="leader", doc="the leader", multi=True, default=["leader"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_5 = StrOption(name="follower1", doc="the follower1", multi=submulti, default_multi=["value"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_6 = StrOption(name="follower2", doc="the follower2", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_5)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_6 = StrOption(name="follower2", doc="the follower2", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_5)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_3 = Leadership(name="leader", doc="a leadership", children=[option_4, option_5, option_6], properties=frozenset({"standard"}))
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_3], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_10 = StrOption(name="leader", doc="the leader", multi=True, default=["leader"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_11 = StrOption(name="follower1", doc="the follower1", multi=submulti, default_multi=["value"], properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_12 = StrOption(name="follower2", doc="the follower2", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_11)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_12 = StrOption(name="follower2", doc="the follower2", multi=submulti, default=Calculation(func['calc_value'], Params((ParamOption(option_11)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_9 = Leadership(name="leader", doc="a leadership", children=[option_10, option_11, option_12], properties=frozenset({"standard"}))
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[optiondescription_9], properties=frozenset({"standard"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8], properties=frozenset({"standard"}))
|
||||
|
|
|
@ -12,6 +12,6 @@ ALLOWED_LEADER_PROPERTIES.add("standard")
|
|||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_3 = StrOption(name="var2", doc="a second variable", default="no", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="var3", doc="a third variable", default="yes", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_3)))), Calculation(func['calc_value'], Params((ParamOption(option_4))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_3)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_2 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)})), Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=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=[option_2, option_3, option_4], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -12,12 +12,12 @@ ALLOWED_LEADER_PROPERTIES.add("standard")
|
|||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_4 = StrOption(name="var2", doc="a second variable", default="no", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_5 = StrOption(name="var3", doc="a third variable", default="yes", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_4)))), Calculation(func['calc_value'], Params((ParamOption(option_5))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_4)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)})), Calculation(func['calc_value'], Params((ParamOption(option_5)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_4)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, option_4, option_5], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_9 = StrOption(name="var2", doc="a second variable", default="no", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_10 = StrOption(name="var3", doc="a third variable", default="yes", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_9)))), Calculation(func['calc_value'], Params((ParamOption(option_10))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_9)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_8 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_9)), kwargs={'__internal_multi': ParamValue(True)})), Calculation(func['calc_value'], Params((ParamOption(option_10)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_9)), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_7 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_8, option_9, option_10], properties=frozenset({"standard"}))
|
||||
optiondescription_6 = OptionDescription(name="2", doc="2", children=[optiondescription_7], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_6])
|
||||
|
|
|
@ -8,5 +8,5 @@ ALLOWED_LEADER_PROPERTIES.add("standard")
|
|||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="var2", doc="a second variable", default="no", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="var3", doc="a third variable", default="yes", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_1 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_2)))), Calculation(func['calc_value'], Params((ParamOption(option_3))))], default_multi=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_1 = StrOption(name="var", doc="a first variable", multi=True, default=[Calculation(func['calc_value'], Params((ParamOption(option_2)), kwargs={'__internal_multi': ParamValue(True)})), Calculation(func['calc_value'], Params((ParamOption(option_3)), kwargs={'__internal_multi': ParamValue(True)}))], default_multi=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=[option_1, option_2, option_3])
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
version: '1.0'
|
||||
var:
|
||||
description: A suffix variable
|
||||
multi: true
|
||||
mandatory: false
|
||||
test:
|
||||
- val1
|
||||
- val2
|
||||
dyn:
|
||||
type: dynamic
|
||||
variable: rougail.var
|
||||
vardyn:
|
||||
description: Dynamic variable
|
||||
mandatory: false
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.var": []
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,17 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_4 = StrOption(name="vardyn", doc="Dynamic variable", properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_4], properties=frozenset({"standard"}), informations={'dynamic_variable': 'rougail.var'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -0,0 +1,23 @@
|
|||
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('tests/dictionaries/../eosfunc/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="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_5 = StrOption(name="vardyn", doc="Dynamic variable", properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
optiondescription_4 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_3, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_5], properties=frozenset({"standard"}), informations={'dynamic_variable': '1.var'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, optiondescription_4], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_8 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_10 = StrOption(name="vardyn", doc="Dynamic variable", properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
optiondescription_9 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_8, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_10], properties=frozenset({"standard"}), informations={'dynamic_variable': '2.var'})
|
||||
optiondescription_7 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_8, optiondescription_9], properties=frozenset({"standard"}))
|
||||
optiondescription_6 = OptionDescription(name="2", doc="2", children=[optiondescription_7], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_6])
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
version: '1.0'
|
||||
var:
|
||||
description: A suffix variable
|
||||
multi: true
|
||||
mandatory: false
|
||||
test:
|
||||
- val1
|
||||
- val2
|
||||
dyn:
|
||||
_type: dynamic
|
||||
variable: rougail.var
|
||||
vardyn:
|
||||
description: A dyn variable
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.var": []
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,17 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_4 = StrOption(name="vardyn", doc="A dyn variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_4], properties=frozenset({"basic"}), informations={'dynamic_variable': 'rougail.var'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -0,0 +1,23 @@
|
|||
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('tests/dictionaries/../eosfunc/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="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_5 = StrOption(name="vardyn", doc="A dyn variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_4 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_3, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_5], properties=frozenset({"basic"}), informations={'dynamic_variable': '1.var'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, optiondescription_4], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_8 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_10 = StrOption(name="vardyn", doc="A dyn variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_9 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_8, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_10], properties=frozenset({"basic"}), informations={'dynamic_variable': '2.var'})
|
||||
optiondescription_7 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_8, optiondescription_9], properties=frozenset({"basic"}))
|
||||
optiondescription_6 = OptionDescription(name="2", doc="2", children=[optiondescription_7], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_6])
|
|
@ -0,0 +1,15 @@
|
|||
---
|
||||
version: '1.1'
|
||||
var:
|
||||
description: A suffix variable
|
||||
multi: true
|
||||
mandatory: false
|
||||
test:
|
||||
- val1
|
||||
- val2
|
||||
dyn:
|
||||
type: dynamic
|
||||
description: A dynamic family
|
||||
variable: _.var
|
||||
vardyn:
|
||||
description: A dynamic variable
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.var": []
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
[]
|
|
@ -0,0 +1,17 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_4 = StrOption(name="vardyn", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_4], properties=frozenset({"basic"}), informations={'dynamic_variable': 'rougail.var'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -0,0 +1,23 @@
|
|||
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('tests/dictionaries/../eosfunc/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="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_5 = StrOption(name="vardyn", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_4 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_3, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_5], properties=frozenset({"basic"}), informations={'dynamic_variable': '1.rougail.var'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, optiondescription_4], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_8 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_10 = StrOption(name="vardyn", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_9 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_8, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_10], properties=frozenset({"basic"}), informations={'dynamic_variable': '2.rougail.var'})
|
||||
optiondescription_7 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_8, optiondescription_9], properties=frozenset({"basic"}))
|
||||
optiondescription_6 = OptionDescription(name="2", doc="2", children=[optiondescription_7], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_6])
|
|
@ -0,0 +1,12 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string', 'test': ('val1', 'val2')})
|
||||
option_3 = StrOption(name="vardyn", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_2 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_1, notraisepropertyerror=True)), kwargs={'allow_none': ParamValue(True)})), children=[option_3], properties=frozenset({"basic"}), informations={'dynamic_variable': 'var'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, optiondescription_2])
|
0
tests/dictionaries/60_0family_dynamic_empty/__init__.py
Normal file
0
tests/dictionaries/60_0family_dynamic_empty/__init__.py
Normal file
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
version: '1.1'
|
||||
|
||||
var:
|
||||
description: A suffix variable
|
||||
mandatory: false
|
||||
multi: true
|
||||
|
||||
"dyn{{ identifier }}":
|
||||
description: A dynamic family
|
||||
dynamic:
|
||||
variable: _.var
|
||||
var: # A dynamic variable
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"rougail.var": []
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
{
|
||||
"rougail.var": {
|
||||
"owner": "default",
|
||||
"value": []
|
||||
}
|
||||
}
|
|
@ -0,0 +1 @@
|
|||
[]
|
17
tests/dictionaries/60_0family_dynamic_empty/tiramisu/base.py
Normal file
17
tests/dictionaries/60_0family_dynamic_empty/tiramisu/base.py
Normal file
|
@ -0,0 +1,17 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
try:
|
||||
groups.namespace
|
||||
except:
|
||||
groups.addgroup('namespace')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_2 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
option_4 = StrOption(name="var", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_4], properties=frozenset({"basic"}), informations={'dynamic_variable': 'rougail.var'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
|
@ -0,0 +1,23 @@
|
|||
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('tests/dictionaries/../eosfunc/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="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
option_5 = StrOption(name="var", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_4 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"basic"}), informations={'dynamic_variable': '1.rougail.var'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, optiondescription_4], properties=frozenset({"basic"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"basic"}))
|
||||
option_8 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
option_10 = StrOption(name="var", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_9 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_8)))), children=[option_10], properties=frozenset({"basic"}), informations={'dynamic_variable': '2.rougail.var'})
|
||||
optiondescription_7 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_8, optiondescription_9], properties=frozenset({"basic"}))
|
||||
optiondescription_6 = OptionDescription(name="2", doc="2", children=[optiondescription_7], properties=frozenset({"basic"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_6])
|
|
@ -0,0 +1,12 @@
|
|||
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('tests/dictionaries/../eosfunc/test.py')
|
||||
ALLOWED_LEADER_PROPERTIES.add("basic")
|
||||
ALLOWED_LEADER_PROPERTIES.add("standard")
|
||||
ALLOWED_LEADER_PROPERTIES.add("advanced")
|
||||
option_1 = StrOption(name="var", doc="A suffix variable", multi=True, properties=frozenset({"standard"}), informations={'type': 'string'})
|
||||
option_3 = StrOption(name="var", doc="A dynamic variable", properties=frozenset({"basic", "mandatory"}), informations={'type': 'string'})
|
||||
optiondescription_2 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="A dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_1)))), children=[option_3], properties=frozenset({"basic"}), informations={'dynamic_variable': 'var'})
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, optiondescription_2])
|
|
@ -14,6 +14,6 @@ dict_env['default_rougail.var2'] = "{{ rougail.dyn1.var }}\n"
|
|||
option_2 = IntOption(name="var", doc="a suffix variable", multi=True, default=[1, 2], default_multi=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_4 = StrOption(name="var", doc="a variable inside dynamic family", default="val", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="a dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_4], properties=frozenset({"standard"}), informations={'dynamic_variable': 'rougail.var'})
|
||||
option_5 = StrOption(name="var2", doc="a variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/60_0family_dynamic_jinja_number/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("rougail.var2"), 'rougail.dyn1.var': ParamDynOption(option_4, ["1"], notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_5 = StrOption(name="var2", doc="a variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/60_0family_dynamic_jinja_number/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("rougail.var2"), 'rougail.dyn1.var': ParamDynOption(option_4, ["1"], optional=True, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3, option_5], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])
|
||||
|
|
|
@ -15,13 +15,13 @@ dict_env['default_2.rougail.var2'] = "{{ rougail.dyn1.var }}\n"
|
|||
option_3 = IntOption(name="var", doc="a suffix variable", multi=True, default=[1, 2], default_multi=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_5 = StrOption(name="var", doc="a variable inside dynamic family", default="val", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_4 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="a dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_3)))), children=[option_5], properties=frozenset({"standard"}), informations={'dynamic_variable': '1.rougail.var'})
|
||||
option_6 = StrOption(name="var2", doc="a variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_1.rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/60_0family_dynamic_jinja_number/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("1.rougail.var2"), 'rougail.dyn1.var': ParamDynOption(option_5, ["1"], notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_6 = StrOption(name="var2", doc="a variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_1.rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/60_0family_dynamic_jinja_number/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("1.rougail.var2"), 'rougail.dyn1.var': ParamDynOption(option_5, ["1"], optional=True, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_2 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_3, optiondescription_4, option_6], properties=frozenset({"standard"}))
|
||||
optiondescription_1 = OptionDescription(name="1", doc="1", children=[optiondescription_2], properties=frozenset({"standard"}))
|
||||
option_9 = IntOption(name="var", doc="a suffix variable", multi=True, default=[1, 2], default_multi=1, properties=frozenset({"mandatory", "standard"}), informations={'type': 'number'})
|
||||
option_11 = StrOption(name="var", doc="a variable inside dynamic family", default="val", properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_10 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="a dynamic family", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_9)))), children=[option_11], properties=frozenset({"standard"}), informations={'dynamic_variable': '2.rougail.var'})
|
||||
option_12 = StrOption(name="var2", doc="a variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_2.rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/60_0family_dynamic_jinja_number/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("2.rougail.var2"), 'rougail.dyn1.var': ParamDynOption(option_11, ["1"], notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
option_12 = StrOption(name="var2", doc="a variable", default=Calculation(func['jinja_to_function'], Params((), kwargs={'__internal_jinja': ParamValue("default_2.rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['tests/dictionaries/60_0family_dynamic_jinja_number/dictionaries/rougail/00-base.yml']), '__internal_attribute': ParamValue("default"), '__internal_variable': ParamValue("2.rougail.var2"), 'rougail.dyn1.var': ParamDynOption(option_11, ["1"], optional=True, notraisepropertyerror=True)})), properties=frozenset({"mandatory", "standard"}), informations={'type': 'string'})
|
||||
optiondescription_8 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_9, optiondescription_10, option_12], properties=frozenset({"standard"}))
|
||||
optiondescription_7 = OptionDescription(name="2", doc="2", children=[optiondescription_8], properties=frozenset({"standard"}))
|
||||
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1, optiondescription_7])
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
---
|
||||
version: '1.1'
|
||||
var:
|
||||
description: a suffix variable
|
||||
multi: true
|
||||
mandatory: false
|
||||
type: number
|
||||
test:
|
||||
- 1
|
||||
- 2
|
||||
"dyn{{ identifier }}":
|
||||
description: a dynamic family
|
||||
dynamic:
|
||||
variable: _.var
|
||||
var: val # a variable inside dynamic family
|
||||
var2:
|
||||
description: a variable
|
||||
default:
|
||||
jinja: |
|
||||
{% if rougail.dyn1 is defined %}
|
||||
{{ rougail.dyn1.var }}
|
||||
{% endif %}
|
||||
description: get the value of rougail.dyn1.var
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue