Compare commits

...

6 commits

51 changed files with 560 additions and 129 deletions

View file

@ -1,3 +1,13 @@
## 1.2.0a23 (2025-05-09)
### Fix
- add_quotes
- tiramisu_display_name could display only description
- use own undefined
- support of default_dictionary_format_version file in tests
- simplify version support
## 1.2.0a22 (2025-05-05)
### Fix

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-05-03 22:50+0200\n"
"PO-Revision-Date: 2025-05-03 22:50+0200\n"
"POT-Creation-Date: 2025-05-08 21:35+0200\n"
"PO-Revision-Date: 2025-05-08 21:37+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -135,6 +135,12 @@ msgid ""
msgstr ""
"la variable \"{0}\" a la valeur par défaut invalide \"{1}\" devrait être {2}"
#: src/rougail/config.py:226
msgid "Structure format version by default, if not specified in structure file"
msgstr ""
"La version du format de la structure par défaut, si non spécifier dans le "
"fichier de structure"
#: src/rougail/config.py:234
msgid "File with functions"
msgstr "Fichier avec les fonctions"
@ -193,39 +199,47 @@ msgstr "Le patron de secret pour construire le nom de l'élément dans Bitwarden
msgid "The pattern is in Jinja format"
msgstr "Le patron est au format Jinja"
#: src/rougail/config.py:458
#: src/rougail/config.py:378
msgid "Select for {0}"
msgstr "Sélection pour {0}"
#: src/rougail/config.py:457
msgid "Override default parameters for option type"
msgstr "Sur charger les paramètre par défaut pour le type d'option"
#: src/rougail/config.py:460
msgid "Default parameters for option type"
msgstr "Paramètre par défaut pour le type d'option"
#: src/rougail/convert.py:281
#: src/rougail/convert.py:280
msgid "unknown type {0} for {1}"
msgstr "type {0} inconnu pour {1}"
#: src/rougail/convert.py:416
#: src/rougail/convert.py:411
msgid "family \"{0}\" define multiple time"
msgstr "la famille \"{0}\" est définit plusieurs fois"
#: src/rougail/convert.py:679
#: src/rougail/convert.py:667
msgid "variable \"{0}\" define multiple time"
msgstr "la variable \"{0}\" est définit plusieurs fois"
#: src/rougail/convert.py:782
#: src/rougail/convert.py:767
msgid "params must be a dict for {0}"
msgstr "params doit être une dict pour {0}"
#: src/rougail/convert.py:803
#: src/rougail/convert.py:788
msgid "\"{0}\" has an invalid \"params\" for {1}: {2}"
msgstr "\"{0}\" a un attribut \"params\" invalide pour {1}: {2}"
#: src/rougail/convert.py:817
#: src/rougail/convert.py:802
msgid "secret_manager must be a dict for {0}"
msgstr "secret_manager doit être une dict pour {0}"
#: src/rougail/convert.py:1147
#: src/rougail/convert.py:1129
msgid "Cannot execute annotate multiple time"
msgstr "Ne peut exécuter l'annotation plusieurs fois"
#: src/rougail/convert.py:1154
#: src/rougail/convert.py:1136
msgid ""
"invalid \"structural\" definition ({0}), we cannot load any structural file!"
msgstr ""
@ -237,45 +251,45 @@ msgstr ""
msgid "{0} in {1}"
msgstr "{0} dans {1}"
#: src/rougail/object_model.py:51
#: src/rougail/object_model.py:50
msgid "unknown boolean value \"{0}\""
msgstr "valeur du booléen inconnue \"{0}\""
#: src/rougail/object_model.py:182
#: src/rougail/object_model.py:181
msgid "cannot find variable \"{0}\" defined in attribute \"{1}\" for \"{2}\""
msgstr ""
"ne peut trouver la variable \"{0}\" défini dans l'attribut \"{1}\" pour "
"\"{2}\""
#: src/rougail/object_model.py:186
#: src/rougail/object_model.py:185
msgid ""
"the variable \"{0}\" is in fact a family in attribute \"{1}\" for \"{2}\""
msgstr ""
"la variable \"{0}\" est en faite une famille dans l'attribut \"{1}\" pour "
"\"{2}\""
#: src/rougail/object_model.py:189 src/rougail/object_model.py:479
#: src/rougail/object_model.py:188 src/rougail/object_model.py:478
msgid "unknown object \"{0}\" in attribute \"{1}\" for \"{2}\""
msgstr "objet inconnu \"{0}\" dans l'attribut \"{1}\" pour \"{2}\""
#: src/rougail/object_model.py:206
#: src/rougail/object_model.py:205
msgid ""
"identifier parameter for \"{0}\" in \"{1}\" cannot be set none dynamic family"
msgstr ""
"le paramètre identifier pour \"{0}\" dans \"{1}\" ne peut être placé pour "
"une famille non dynamique"
#: src/rougail/object_model.py:229
#: src/rougail/object_model.py:228
msgid "cannot find variable \"{0}\" defined in \"{1}\" for \"{2}\""
msgstr "ne peut trouver la variable \"{0}\" défini dans \"{1}\" pour \"{2}\""
#: src/rougail/object_model.py:232
#: src/rougail/object_model.py:231
msgid "variable \"{0}\" defined in \"{1}\" for \"{2}\" is a dynamic variable"
msgstr ""
"la variable \"{0}\" défini dans \"{1}\" pour \"{2}\" est une variable "
"dynamique"
#: src/rougail/object_model.py:243
#: src/rougail/object_model.py:242
msgid ""
"the variable \"{0}\" is not a follower, so cannot have index type for param "
"in \"{1}\""
@ -283,7 +297,7 @@ msgstr ""
"la variable \"{0}\" n'est pas suiveuse, donc ne peut avoir de type index "
"comme paramètre dans \"{1}\""
#: src/rougail/object_model.py:476
#: src/rougail/object_model.py:475
msgid ""
"a variable \"{0}\" is needs in attribute \"{1}\" for \"{2}\" but it's a "
"family"
@ -291,7 +305,7 @@ msgstr ""
"une variable \"{0}\" est nécessaire pour l'attribut \"{1}\" pour \"{2}\" "
"mais c'est une famille"
#: src/rougail/object_model.py:496
#: src/rougail/object_model.py:495
msgid ""
"variable \"{0}\" has an attribute \"{1}\" calculated with the unknown "
"variable \"{2}\""
@ -299,7 +313,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\" calculé avec la variable "
"inconnue \"{2}\""
#: src/rougail/object_model.py:532
#: src/rougail/object_model.py:531
msgid ""
"the variable \"{0}\" has an invalid \"{1}\" the variable \"{2}\" is in a sub "
"dynamic option"
@ -307,14 +321,14 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable \"{2}\" est "
"dans une sous option dynamique"
#: src/rougail/object_model.py:535
#: src/rougail/object_model.py:534
msgid ""
"the leader \"{0}\" has an invalid \"{1}\" the follower \"{2}\" is a multi"
msgstr ""
"la variable meneuse \"{0}\" a un attribut invalide \"{1}\", la variable "
"suiveuse \"{2}\" est multiple"
#: src/rougail/object_model.py:551
#: src/rougail/object_model.py:550
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" "
"must not be multi"
@ -322,7 +336,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable \"{2}\" ne "
"doit pas être multiple"
#: src/rougail/object_model.py:556
#: src/rougail/object_model.py:555
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable must not "
"be a multi or the variable \"{2}\" must be multi"
@ -330,7 +344,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable ne doit pas "
"être multiple ou la variable \"{2}\" doit être multiple"
#: src/rougail/object_model.py:561
#: src/rougail/object_model.py:560
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable must be "
"a multi or the variable \"{2}\" must not be multi"
@ -338,7 +352,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable doit être "
"multiple ou la variable \"{2}\" ne doit pas être multiple"
#: src/rougail/object_model.py:566
#: src/rougail/object_model.py:565
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" "
"is multi but is inside a list"
@ -362,7 +376,7 @@ msgstr ""
"la variable \"{0}\" a une valeur par défaut calculé a partir de \"{1}\" "
"laquelle a un type incompatible"
#: src/rougail/object_model.py:628
#: src/rougail/object_model.py:629
msgid ""
"\"when\" is not allowed in format version 1.0 for attribute \"{0}\" for "
"variable \"{1}\""
@ -370,7 +384,7 @@ msgstr ""
"\"when\" n'est pas autorisé avec le format en version 1.0 pour l'attribut "
"\"{0}\" pour la variable \"{1}\""
#: src/rougail/object_model.py:631
#: src/rougail/object_model.py:632
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", \"when\" and "
"\"when_not\" cannot set together"
@ -378,7 +392,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", \"when\" et \"when_not\" "
"ne peuvent pas être défini ensemble"
#: src/rougail/object_model.py:637
#: src/rougail/object_model.py:638
msgid ""
"\"when_not\" is not allowed in format version 1.0 for attribute \"{0}\" for "
"variable \"{1}\""
@ -386,7 +400,7 @@ msgstr ""
"\"when_not\" n'est pas autorisé au format 1.0 pour l'attribut \"{0}\" pour "
"la variable variable \"{1}\""
#: src/rougail/object_model.py:691
#: src/rougail/object_model.py:693
msgid ""
"cannot find variable \"{0}\" for the information \"{1}\" when calculating "
"\"{2}\""
@ -394,18 +408,18 @@ msgstr ""
"ne peut trouver la variable \"{0}\" pour l'information \"{1}\" lors du "
"calcul de \"{2}\""
#: src/rougail/object_model.py:694
#: src/rougail/object_model.py:696
msgid ""
"identifier not allowed for the information \"{0}\" when calculating \"{1}\""
msgstr ""
"identifier n'est pas autorisé pour l'information \"{0}\" lors du calcul de "
"\"{1}\""
#: src/rougail/object_model.py:743
#: src/rougail/object_model.py:747
msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\""
msgstr "\"when\" n'est pas autorisé au format 1.0 pour l'attribut \"{0}\""
#: src/rougail/object_model.py:747 src/rougail/object_model.py:755
#: src/rougail/object_model.py:751 src/rougail/object_model.py:759
msgid ""
"the identifier has an invalid attribute \"{0}\", \"when\" and \"when_not\" "
"cannot set together"
@ -413,7 +427,7 @@ msgstr ""
"l'identifiant a un attribut invalide \"{0}\", \"when\" et \"when_not\" ne "
"peuvent pas être défini ensemble"
#: src/rougail/object_model.py:777
#: src/rougail/object_model.py:782
msgid ""
"the variable \"{0}\" is not a follower, so cannot have index type for \"{1}\""
msgstr ""

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-05-03 22:50+0200\n"
"POT-Creation-Date: 2025-05-08 21:37+0200\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"
@ -87,6 +87,10 @@ msgstr ""
msgid "the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}"
msgstr ""
#: src/rougail/config.py:226
msgid "Structure format version by default, if not specified in structure file"
msgstr ""
#: src/rougail/config.py:234
msgid "File with functions"
msgstr ""
@ -143,39 +147,47 @@ msgstr ""
msgid "The pattern is in Jinja format"
msgstr ""
#: src/rougail/config.py:458
#: src/rougail/config.py:378
msgid "Select for {0}"
msgstr ""
#: src/rougail/config.py:457
msgid "Override default parameters for option type"
msgstr ""
#: src/rougail/config.py:460
msgid "Default parameters for option type"
msgstr ""
#: src/rougail/convert.py:281
#: src/rougail/convert.py:280
msgid "unknown type {0} for {1}"
msgstr ""
#: src/rougail/convert.py:416
#: src/rougail/convert.py:411
msgid "family \"{0}\" define multiple time"
msgstr ""
#: src/rougail/convert.py:679
#: src/rougail/convert.py:667
msgid "variable \"{0}\" define multiple time"
msgstr ""
#: src/rougail/convert.py:782
#: src/rougail/convert.py:767
msgid "params must be a dict for {0}"
msgstr ""
#: src/rougail/convert.py:803
#: src/rougail/convert.py:788
msgid "\"{0}\" has an invalid \"params\" for {1}: {2}"
msgstr ""
#: src/rougail/convert.py:817
#: src/rougail/convert.py:802
msgid "secret_manager must be a dict for {0}"
msgstr ""
#: src/rougail/convert.py:1147
#: src/rougail/convert.py:1129
msgid "Cannot execute annotate multiple time"
msgstr ""
#: src/rougail/convert.py:1154
#: src/rougail/convert.py:1136
msgid "invalid \"structural\" definition ({0}), we cannot load any structural file!"
msgstr ""
@ -184,67 +196,67 @@ msgstr ""
msgid "{0} in {1}"
msgstr ""
#: src/rougail/object_model.py:51
#: src/rougail/object_model.py:50
msgid "unknown boolean value \"{0}\""
msgstr ""
#: src/rougail/object_model.py:182
#: src/rougail/object_model.py:181
msgid "cannot find variable \"{0}\" defined in attribute \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/object_model.py:186
#: src/rougail/object_model.py:185
msgid "the variable \"{0}\" is in fact a family in attribute \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/object_model.py:189 src/rougail/object_model.py:479
#: src/rougail/object_model.py:188 src/rougail/object_model.py:478
msgid "unknown object \"{0}\" in attribute \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/object_model.py:206
#: src/rougail/object_model.py:205
msgid "identifier parameter for \"{0}\" in \"{1}\" cannot be set none dynamic family"
msgstr ""
#: src/rougail/object_model.py:229
#: src/rougail/object_model.py:228
msgid "cannot find variable \"{0}\" defined in \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/object_model.py:232
#: src/rougail/object_model.py:231
msgid "variable \"{0}\" defined in \"{1}\" for \"{2}\" is a dynamic variable"
msgstr ""
#: src/rougail/object_model.py:243
#: src/rougail/object_model.py:242
msgid "the variable \"{0}\" is not a follower, so cannot have index type for param in \"{1}\""
msgstr ""
#: src/rougail/object_model.py:476
#: src/rougail/object_model.py:475
msgid "a variable \"{0}\" is needs in attribute \"{1}\" for \"{2}\" but it's a family"
msgstr ""
#: src/rougail/object_model.py:496
#: src/rougail/object_model.py:495
msgid "variable \"{0}\" has an attribute \"{1}\" calculated with the unknown variable \"{2}\""
msgstr ""
#: src/rougail/object_model.py:532
#: src/rougail/object_model.py:531
msgid "the variable \"{0}\" has an invalid \"{1}\" the variable \"{2}\" is in a sub dynamic option"
msgstr ""
#: src/rougail/object_model.py:535
#: src/rougail/object_model.py:534
msgid "the leader \"{0}\" has an invalid \"{1}\" the follower \"{2}\" is a multi"
msgstr ""
#: src/rougail/object_model.py:551
#: src/rougail/object_model.py:550
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" must not be multi"
msgstr ""
#: src/rougail/object_model.py:556
#: src/rougail/object_model.py:555
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable must not be a multi or the variable \"{2}\" must be multi"
msgstr ""
#: src/rougail/object_model.py:561
#: src/rougail/object_model.py:560
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable must be a multi or the variable \"{2}\" must not be multi"
msgstr ""
#: src/rougail/object_model.py:566
#: src/rougail/object_model.py:565
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" is multi but is inside a list"
msgstr ""
@ -256,35 +268,35 @@ msgstr ""
msgid "variable \"{0}\" has a default value calculated with \"{1}\" which has incompatible type"
msgstr ""
#: src/rougail/object_model.py:628
#: src/rougail/object_model.py:629
msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\" for variable \"{1}\""
msgstr ""
#: src/rougail/object_model.py:631
#: src/rougail/object_model.py:632
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", \"when\" and \"when_not\" cannot set together"
msgstr ""
#: src/rougail/object_model.py:637
#: src/rougail/object_model.py:638
msgid "\"when_not\" is not allowed in format version 1.0 for attribute \"{0}\" for variable \"{1}\""
msgstr ""
#: src/rougail/object_model.py:691
#: src/rougail/object_model.py:693
msgid "cannot find variable \"{0}\" for the information \"{1}\" when calculating \"{2}\""
msgstr ""
#: src/rougail/object_model.py:694
#: src/rougail/object_model.py:696
msgid "identifier not allowed for the information \"{0}\" when calculating \"{1}\""
msgstr ""
#: src/rougail/object_model.py:743
#: src/rougail/object_model.py:747
msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\""
msgstr ""
#: src/rougail/object_model.py:747 src/rougail/object_model.py:755
#: src/rougail/object_model.py:751 src/rougail/object_model.py:759
msgid "the identifier has an invalid attribute \"{0}\", \"when\" and \"when_not\" cannot set together"
msgstr ""
#: src/rougail/object_model.py:777
#: src/rougail/object_model.py:782
msgid "the variable \"{0}\" is not a follower, so cannot have index type for \"{1}\""
msgstr ""

View file

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

View file

@ -42,15 +42,28 @@ def tiramisu_display_name(
with_quote: bool = False,
) -> str:
"""Replace the Tiramisu display_name function to display path + description"""
doc = kls._get_information(subconfig, "doc", None)
comment = f" ({doc})" if doc and doc != kls.impl_getname() else ""
config_bag = subconfig.config_bag
context = config_bag.context
values = context.get_values()
context_subconfig = context.get_root(config_bag)
doc = values.get_information(subconfig, "doc", None)
comment = doc if doc and doc != kls.impl_getname() else ""
if "{{ identifier }}" in comment and subconfig.identifiers:
comment = comment.replace("{{ identifier }}", str(subconfig.identifiers[-1]))
path = kls.impl_getpath()
if "{{ identifier }}" in path and subconfig.identifiers:
path = path.replace(
"{{ identifier }}", normalize_family(str(subconfig.identifiers[-1]))
)
path_in_description = values.get_information(context_subconfig, 'path_in_description', True)
if path_in_description or not comment:
comment = f" ({comment})" if comment else ""
if path_in_description is False:
path = kls.impl_getname()
else:
path = kls.impl_getpath()
if "{{ identifier }}" in path and subconfig.identifiers:
path = path.replace(
"{{ identifier }}", normalize_family(str(subconfig.identifiers[-1]))
)
else:
path = comment
comment = ""
if with_quote:
return f'"{path}"{comment}'
return f"{path}{comment}"

View file

@ -1 +1 @@
__version__ = "1.2.0a22"
__version__ = "1.2.0a23"

View file

@ -223,7 +223,7 @@ def _rougail_config(
add_extra_options: bool = True,
) -> "OptionDescription":
rougail_options = f"""default_dictionary_format_version:
description: Dictionary format version by default, if not specified in dictionary file
description: {_('Structure format version by default, if not specified in structure file')}
alternative_name: v
choices:
- '1.0'
@ -370,13 +370,13 @@ secret_manager:
for process in processes:
if processes[process]:
objects = processes[process]
rougail_process += """
process_name = normalize_family(process)
tr_process_name = _(process_name)
rougail_process += f"""
{NAME}:
description: Select for {NAME}
""".format(
NAME=normalize_family(process),
)
{process_name}:
description: {_('Select for {0}').format(tr_process_name)}
"""
if process != "structural":
rougail_process += """
alternative_name: {NAME[0]}
@ -454,8 +454,13 @@ secret_manager:
PROP=prop,
)
rougail_process += f"""
define_default_params: false # {_('Override default parameters for option type')}
default_params:
description: {_("Default parameters for option type")}
disabled:
variable: _.define_default_params
when: false
"""
for typ, params in get_convert_option_types():

View file

@ -259,7 +259,6 @@ class ParserVariable:
path: str,
obj: dict,
family_is_leadership: bool,
version: str,
filename: str,
) -> Literal["variable", "family"]:
"""Check object to determine if it's a variable or a family"""
@ -303,7 +302,7 @@ class ParserVariable:
else:
return "variable"
else:
if version == "1.0":
if self.version == "1.0":
msg = f'Invalid value for the variable "{path}": "{obj}"'
raise DictConsistencyError(msg, 102, [filename])
return "variable"
@ -332,7 +331,6 @@ class ParserVariable:
name: str,
subpath: str,
obj: dict,
version: str,
comment: Optional[str],
*,
first_variable: bool = False,
@ -347,14 +345,13 @@ class ParserVariable:
path = name
else:
path = f"{subpath}.{name}"
if version == "0.1" and not isinstance(obj, dict) and obj is not None:
if self.version == "0.1" and not isinstance(obj, dict) and obj is not None:
msg = f'the variable "{path}" has a wrong type "{type(obj)}"'
raise DictConsistencyError(msg, 17, [filename])
typ = self.is_family_or_variable(
path,
obj,
family_is_leadership,
version,
filename,
)
logging.info("family_or_variable: %s is a %s", path, typ)
@ -367,7 +364,6 @@ class ParserVariable:
name,
path,
obj,
version,
comment=comment,
first_variable=first_variable,
family_is_leadership=family_is_leadership,
@ -381,7 +377,6 @@ class ParserVariable:
name: str,
path: str,
obj: Optional[Dict[str, Any]],
version: str,
*,
comment: Optional[str] = None,
first_variable: bool = False,
@ -394,7 +389,7 @@ class ParserVariable:
obj = {}
family_obj = {}
subfamily_obj = {}
if version != "1.0":
if self.version != "1.0":
exists = obj.pop("exists", None)
else:
exists = None
@ -406,7 +401,7 @@ class ParserVariable:
family_obj[key] = value
else:
subfamily_obj[key] = value
if version != "1.0" and not family_obj and comment:
if self.version != "1.0" and not family_obj and comment:
family_obj["description"] = comment
if path in self.paths:
@ -423,7 +418,6 @@ class ParserVariable:
obj,
filename,
family_is_dynamic,
version,
typ="family",
)
if self.load_unexist_redefine or exists in [None, True]:
@ -481,7 +475,6 @@ class ParserVariable:
filename,
family_is_dynamic,
parent_dynamic,
version,
)
force_not_first = False
if self.paths[path].type == "leadership":
@ -495,7 +488,6 @@ class ParserVariable:
key,
path,
value,
version,
comment,
first_variable=first_variable,
family_is_leadership=family_is_leadership,
@ -553,17 +545,16 @@ class ParserVariable:
filename: str,
family_is_dynamic: bool,
parent_dynamic: str,
version: str,
) -> None:
"""Add a new family"""
family["path"] = path
family["namespace"] = self.namespace
family["version"] = version
family["version"] = self.version
family["xmlfiles"] = [filename]
obj_type = self.get_family_or_variable_type(family)
if obj_type == "dynamic":
family_obj = self.dynamic
if version == "1.0":
if self.version == "1.0":
if "variable" not in family:
raise DictConsistencyError(
f'dynamic family must have "variable" attribute for "{path}"',
@ -592,7 +583,7 @@ class ParserVariable:
"allow_none": True,
}
del family["variable"]
if version != "1.0":
if self.version != "1.0":
warning = f'"variable" attribute in dynamic family "{ path }" is depreciated in {filename}'
warn(warning)
if "variable" in family:
@ -607,7 +598,6 @@ class ParserVariable:
family,
filename,
family_is_dynamic,
version,
typ="family",
)
try:
@ -637,7 +627,6 @@ class ParserVariable:
name: str,
path: str,
obj: Optional[Dict[str, Any]],
version: str,
*,
comment: Optional[str] = None,
first_variable: bool = False,
@ -646,7 +635,7 @@ class ParserVariable:
parent_dynamic: Optional[str] = None,
) -> None:
"""Parse variable"""
if version == "1.0" or isinstance(obj, dict):
if self.version == "1.0" or isinstance(obj, dict):
if obj is None:
obj = {}
extra_attrs = set(obj) - self.variable_attrs
@ -666,10 +655,9 @@ class ParserVariable:
obj,
filename,
family_is_dynamic,
version,
)
self.parse_params(path, obj, filename)
self.parse_secret_manager(path, obj, filename, version, family_is_dynamic)
self.parse_secret_manager(path, obj, filename, family_is_dynamic)
exists = obj.pop("exists", None)
if path in self.paths:
if not self.load_unexist_redefine:
@ -700,7 +688,7 @@ class ParserVariable:
raise DictConsistencyError(msg, 46, [filename])
obj["path"] = path
self.add_variable(
name, obj, filename, family_is_dynamic, parent_dynamic, version
name, obj, filename, family_is_dynamic, parent_dynamic
)
if family_is_leadership:
if first_variable:
@ -714,7 +702,6 @@ class ParserVariable:
obj: dict,
filename: str,
family_is_dynamic: bool,
version: str,
*,
typ: str = "variable",
):
@ -737,7 +724,6 @@ class ParserVariable:
value,
path,
family_is_dynamic,
version,
[filename],
)
except ValidationError as err:
@ -762,7 +748,6 @@ class ParserVariable:
val,
path,
family_is_dynamic,
version,
[filename],
inside_list=True,
index=idx,
@ -808,7 +793,7 @@ class ParserVariable:
) from err
obj["params"] = params
def parse_secret_manager(self, path, obj, filename, version, family_is_dynamic):
def parse_secret_manager(self, path, obj, filename, family_is_dynamic):
"""Parse variable secret_manager"""
if "secret_manager" not in obj:
return
@ -828,7 +813,6 @@ class ParserVariable:
secret_manager,
path,
family_is_dynamic,
version,
[filename],
)
@ -839,7 +823,6 @@ class ParserVariable:
filename: str,
family_is_dynamic: bool,
parent_dynamic: Optional[str],
version: str,
) -> None:
if "{ suffix" in variable["path"]:
raise Exception()
@ -848,7 +831,7 @@ class ParserVariable:
filename = [filename]
variable["namespace"] = self.namespace
variable["version"] = version
variable["version"] = self.version
variable["xmlfiles"] = filename
variable_type = self.get_family_or_variable_type(variable)
obj = {
@ -943,7 +926,6 @@ class ParserVariable:
value: dict,
path: str,
family_is_dynamic: bool,
version: str,
xmlfiles: List[str],
*,
inside_list: bool = False,
@ -956,7 +938,7 @@ class ParserVariable:
calculation_object["attribute_name"] = attribute
calculation_object["path"] = path
calculation_object["inside_list"] = inside_list
calculation_object["version"] = version
calculation_object["version"] = self.version
calculation_object["namespace"] = self.namespace
calculation_object["xmlfiles"] = xmlfiles
#
@ -980,7 +962,7 @@ class ParserVariable:
"type": "any",
}
else:
if version == "1.0" and val["type"] == "suffix":
if self.version == "1.0" and val["type"] == "suffix":
val["type"] = "identifier"
param_typ = val["type"]
val["key"] = key
@ -1067,6 +1049,7 @@ class RougailConvert(ParserVariable):
) -> None:
if namespace_path is None:
namespace_path = self.namespace
self.version = ""
self.parse_family(
"",
self.namespace,
@ -1074,7 +1057,6 @@ class RougailConvert(ParserVariable):
{
"description": namespace_description,
},
"",
)
def get_comment(
@ -1097,6 +1079,7 @@ class RougailConvert(ParserVariable):
version: str,
objects: dict,
) -> None:
self.version = version
for name, obj in objects.items():
comment = self.get_comment(name, objects)
self.family_or_variable(
@ -1104,7 +1087,6 @@ class RougailConvert(ParserVariable):
name,
path,
obj,
version,
comment,
)

View file

@ -26,10 +26,9 @@ from pydantic import (
StrictStr,
ConfigDict,
)
from tiramisu import undefined
import tiramisu
from tiramisu.config import get_common_path
from .utils import get_jinja_variable_to_param, calc_multi_for_type_variable
from .utils import get_jinja_variable_to_param, calc_multi_for_type_variable, undefined
from .i18n import _
from .error import DictConsistencyError, VariableCalculationDependencyError
@ -270,7 +269,6 @@ PARAM_TYPES = {
class Calculation(BaseModel):
path: str
description: Optional[StrictStr] = None
inside_list: bool
version: str
ori_path: Optional[str] = None
@ -312,6 +310,7 @@ class JinjaCalculation(Calculation):
jinja: StrictStr
params: Optional[List[Param]] = None
return_type: BASETYPE = None
description: Optional[StrictStr] = None
def _jinja_to_function(
self,
@ -570,6 +569,7 @@ class _VariableCalculation(Calculation):
class VariableCalculation(_VariableCalculation):
attribute_name: Literal["default", "choices", "dynamic"]
optional: bool = False
description: Optional[StrictStr] = None
def to_function(
self,
@ -607,6 +607,7 @@ class VariablePropertyCalculation(_VariableCalculation):
attribute_name: Literal["frozen", "hidden", "disabled", "mandatory"]
when: Any = undefined
when_not: Any = undefined
description: Optional[StrictStr] = None
def to_function(
self,
@ -661,6 +662,7 @@ class InformationCalculation(Calculation):
attribute_name: Literal["default", "choice", "dynamic"]
information: StrictStr
variable: Optional[StrictStr]
description: Optional[StrictStr] = None
def to_function(
self,
@ -715,6 +717,7 @@ class _IdentifierCalculation(Calculation):
class IdentifierCalculation(_IdentifierCalculation):
attribute_name: Literal["default", "choice", "dynamic"]
description: Optional[StrictStr] = None
def to_function(
self,
@ -734,6 +737,7 @@ class IdentifierPropertyCalculation(_IdentifierCalculation):
attribute_name: Literal["frozen", "hidden", "disabled", "mandatory"]
when: Any = undefined
when_not: Any = undefined
description: Optional[StrictStr] = None
def to_function(
self,
@ -768,6 +772,7 @@ class IdentifierPropertyCalculation(_IdentifierCalculation):
class IndexCalculation(Calculation):
attribute_name: Literal["default", "choice", "dynamic"]
description: Optional[StrictStr] = None
def to_function(
self,
@ -784,6 +789,7 @@ class IndexCalculation(Calculation):
class NamespaceCalculation(Calculation):
attribute_name: Literal["default", "secret_manager"]
description: Optional[StrictStr] = None
def to_function(
self,

View file

@ -78,11 +78,11 @@ class Annotator(Walk):
path = alternative_name
else:
path = variable_path.rsplit(".", 1)[0] + "." + alternative_name
self.objectspace.version = variable.version
self.objectspace.add_variable(
alternative_name,
{"type": "symlink", "path": path, "opt": variable},
variable.xmlfiles,
False,
False,
variable.version,
)

View file

@ -22,8 +22,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
from typing import List
from re import findall
from rougail.utils import normalize_family
from tiramisu import undefined, Calculation
from rougail.utils import normalize_family, undefined
from tiramisu import Calculation
from tiramisu.error import (
PropertiesOptionError,
LeadershipError,

View file

@ -199,3 +199,10 @@ def calc_multi_for_type_variable(local_variable: 'Variable', variable_in_calcula
elif count_identifiers > 1:
variable_in_calculation_multi = 'submulti'
return local_variable_multi, variable_in_calculation_multi
class Undefined:
pass
undefined = Undefined()

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1 @@
[]

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,14 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[], properties=frozenset({"advanced"}), informations={'ymlfiles': ['']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])

View file

@ -0,0 +1,9 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[])

View file

@ -0,0 +1,14 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[], properties=frozenset({"advanced"}), informations={'ymlfiles': ['']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])

View file

@ -0,0 +1,9 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[])

View file

@ -0,0 +1,14 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[], properties=frozenset({"advanced"}), informations={'ymlfiles': ['']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])

View file

@ -0,0 +1,9 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[])

View file

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

View file

@ -0,0 +1,4 @@
{
"rougail.var1": null,
"rougail.var2": null
}

View file

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

View file

@ -0,0 +1 @@
["rougail.var1", "rougail.var2"]

View file

@ -0,0 +1,4 @@
{
"rougail.var1": null,
"rougail.var2": null
}

View file

@ -0,0 +1,16 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_2 = StrOption(name="var1", doc="a first variable", properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
option_3 = StrOption(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_2)))), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, option_3], properties=frozenset({"basic"}), informations={'ymlfiles': ['']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])

View file

@ -0,0 +1,11 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_1 = StrOption(name="var1", doc="a first variable", properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
option_2 = StrOption(name="var2", doc="a second variable", default=Calculation(func['calc_value'], Params((ParamOption(option_1)))), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/00_2default_calculated_variable_description/rougail/00-base.yml'], 'type': 'string'})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])

View file

@ -0,0 +1,21 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.var": {
"owner": "default",
"value": "a value"
},
"rougail.dynval2.var": {
"owner": "default",
"value": "a value"
},
"rougail.var2": {
"owner": "default",
"value": "a value"
}
}

View file

@ -0,0 +1,9 @@
{
"rougail.var1": [
"val1",
"val2"
],
"rougail.dynval1.var": "a value",
"rougail.dynval2.var": "a value",
"rougail.var2": "a value"
}

View file

@ -0,0 +1,21 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.var": {
"owner": "default",
"value": "a value"
},
"rougail.dynval2.var": {
"owner": "default",
"value": "a value"
},
"rougail.var2": {
"owner": "default",
"value": "a value"
}
}

View file

@ -0,0 +1,7 @@
{
"rougail.var1": [
"val1",
"val2"
],
"rougail.var2": "a value"
}

View file

@ -0,0 +1,21 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.var": {
"owner": "default",
"value": true
},
"rougail.dynval2.var": {
"owner": "default",
"value": true
},
"rougail.var2": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,9 @@
{
"rougail.var1": [
"val1",
"val2"
],
"rougail.dynval1.var": true,
"rougail.dynval2.var": true,
"rougail.var2": true
}

View file

@ -0,0 +1,21 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.var": {
"owner": "default",
"value": true
},
"rougail.dynval2.var": {
"owner": "default",
"value": true
},
"rougail.var2": {
"owner": "default",
"value": true
}
}

View file

@ -0,0 +1,7 @@
{
"rougail.var1": [
"val1",
"val2"
],
"rougail.var2": true
}

View file

@ -0,0 +1,18 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_2 = StrOption(name="var1", doc="A suffix variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml'], 'type': 'string'})
option_4 = BoolOption(name="var", doc="A dynamic variable", default=True, properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml'], 'type': 'boolean'})
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_4], properties=frozenset({"standard"}), informations={'dynamic_variable': 'rougail.var1', 'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml']})
option_5 = BoolOption(name="var2", doc="A variable calculated", default=Calculation(func['calc_value'], Params((ParamDynOption(option_4, ["val1"])))), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_boolean/rougail/00-base.yml'], 'type': 'boolean'})
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3, option_5], properties=frozenset({"standard"}), informations={'ymlfiles': ['']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])

View file

@ -0,0 +1,30 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.var": {
"owner": "default",
"value": [
"a value",
"a second value"
]
},
"rougail.dynval2.var": {
"owner": "default",
"value": [
"a value",
"a second value"
]
},
"rougail.var2": {
"owner": "default",
"value": [
"a value",
"a second value"
]
}
}

View file

@ -0,0 +1,18 @@
{
"rougail.var1": [
"val1",
"val2"
],
"rougail.dynval1.var": [
"a value",
"a second value"
],
"rougail.dynval2.var": [
"a value",
"a second value"
],
"rougail.var2": [
"a value",
"a second value"
]
}

View file

@ -0,0 +1,30 @@
{
"rougail.var1": {
"owner": "default",
"value": [
"val1",
"val2"
]
},
"rougail.dynval1.var": {
"owner": "default",
"value": [
"a value",
"a second value"
]
},
"rougail.dynval2.var": {
"owner": "default",
"value": [
"a value",
"a second value"
]
},
"rougail.var2": {
"owner": "default",
"value": [
"a value",
"a second value"
]
}
}

View file

@ -0,0 +1,10 @@
{
"rougail.var1": [
"val1",
"val2"
],
"rougail.var2": [
"a value",
"a second value"
]
}

View file

@ -0,0 +1,18 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
option_2 = StrOption(name="var1", doc="A suffix variable", multi=True, default=["val1", "val2"], default_multi="val1", properties=frozenset({"standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml'], 'type': 'string'})
option_4 = StrOption(name="var", doc="A dynamic variable", multi=True, default=["a value", "a second value"], default_multi="a value", properties=frozenset({"force_default_on_freeze", "frozen", "hidden", "mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml'], 'type': 'string'})
optiondescription_3 = ConvertDynOptionDescription(name="dyn{{ identifier }}", doc="dyn{{ identifier }}", identifiers=Calculation(func['calc_value'], Params((ParamOption(option_2)))), children=[option_4], properties=frozenset({"standard"}), informations={'dynamic_variable': 'rougail.var1', 'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml']})
option_5 = StrOption(name="var2", doc="A variable calculated", multi=True, default=Calculation(func['calc_value'], Params((ParamDynOption(option_4, ["val1"])), kwargs={'__internal_multi': ParamValue(True)})), properties=frozenset({"mandatory", "standard"}), informations={'ymlfiles': ['../rougail-tests/structures/60_5family_dynamic_calc_suffix_hidden_multi/rougail/00-base.yml'], 'type': 'string'})
optiondescription_1 = OptionDescription(name="rougail", doc="Rougail", group_type=groups.namespace, children=[option_2, optiondescription_3, option_5], properties=frozenset({"standard"}), informations={'ymlfiles': ['']})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[optiondescription_1])

View file

@ -43,7 +43,7 @@ for test in errors_dirs.iterdir():
test_raise.add(test.name)
excludes = set([
'80family_several',
# '80family_several',
])
test_ok -= excludes
test_raise -= excludes
@ -149,6 +149,10 @@ def test_dictionary(test_dir):
rougailconfig['main_namespace'] = None
if (dico_dirs / test_dir / 'force_namespace').is_file():
return
if (dico_dirs / test_dir / 'default_dictionary_format_version').is_file():
rougailconfig['default_dictionary_format_version'] = "1.1"
else:
rougailconfig['default_dictionary_format_version'] = None
eolobj = load_rougail_object(str(dico_dirs / test_dir), rougailconfig)
if not eolobj:
return
@ -166,6 +170,10 @@ def test_dictionary_namespace(test_dir):
rougailconfig['main_namespace'] = 'Rougail'
if (dico_dirs / test_dir / 'force_no_namespace').is_file():
return
if (dico_dirs / test_dir / 'default_dictionary_format_version').is_file():
rougailconfig['default_dictionary_format_version'] = "1.1"
else:
rougailconfig['default_dictionary_format_version'] = None
eolobj = load_rougail_object(test_dir_, rougailconfig, namespace=True)
if not eolobj:
return

View file

@ -68,6 +68,7 @@ def test_personalize_annotate_twice():
def test_option_params():
rougailconfig = RougailConfig.copy()
rougailconfig['dictionaries_dir'] = ['tests/default_option_params/structure']
rougailconfig["define_default_params"] = True
rougailconfig["default_params.unix_filename.test_existence"] = True
eolobj = Rougail(rougailconfig=rougailconfig)
with raises(ValueError):

View file

@ -40,7 +40,7 @@ def test_validate_default_version():
RougailConfig["dictionaries_dir"] = ["tests/data/dict1"]
RougailConfig["default_dictionary_format_version"] = "1.1"
rougail = Rougail()
config = rougail.get_config()
config = rougail.run()
filename = "tests/data/dict1/dict.yml"
with open(filename, encoding="utf8") as file_fh:
@ -55,7 +55,7 @@ def test_validate_file_version_from_yml():
RougailConfig["dictionaries_dir"] = ["tests/data/dict2"]
RougailConfig["default_dictionary_format_version"] = "1.1"
rougail = Rougail()
config = rougail.get_config()
config = rougail.run()
filename = "tests/data/dict2/dict.yml"
with open(filename, encoding="utf8") as file_fh:
@ -71,7 +71,7 @@ def test_retrieve_version_from_config():
rougail = Rougail()
# FIXME replace with rougail.annotator()
# rougail.converted.annotator()
rougail.get_config()
rougail.run()
assert rougail.converted.paths._data["rougail.hello"].version == "1.0"