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) ## 1.2.0a22 (2025-05-05)
### Fix ### Fix

View file

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

View file

@ -5,7 +5,7 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "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" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\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}" msgid "the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}"
msgstr "" msgstr ""
#: src/rougail/config.py:226
msgid "Structure format version by default, if not specified in structure file"
msgstr ""
#: src/rougail/config.py:234 #: src/rougail/config.py:234
msgid "File with functions" msgid "File with functions"
msgstr "" msgstr ""
@ -143,39 +147,47 @@ msgstr ""
msgid "The pattern is in Jinja format" msgid "The pattern is in Jinja format"
msgstr "" 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" msgid "Default parameters for option type"
msgstr "" msgstr ""
#: src/rougail/convert.py:281 #: src/rougail/convert.py:280
msgid "unknown type {0} for {1}" msgid "unknown type {0} for {1}"
msgstr "" msgstr ""
#: src/rougail/convert.py:416 #: src/rougail/convert.py:411
msgid "family \"{0}\" define multiple time" msgid "family \"{0}\" define multiple time"
msgstr "" msgstr ""
#: src/rougail/convert.py:679 #: src/rougail/convert.py:667
msgid "variable \"{0}\" define multiple time" msgid "variable \"{0}\" define multiple time"
msgstr "" msgstr ""
#: src/rougail/convert.py:782 #: src/rougail/convert.py:767
msgid "params must be a dict for {0}" msgid "params must be a dict for {0}"
msgstr "" msgstr ""
#: src/rougail/convert.py:803 #: src/rougail/convert.py:788
msgid "\"{0}\" has an invalid \"params\" for {1}: {2}" msgid "\"{0}\" has an invalid \"params\" for {1}: {2}"
msgstr "" msgstr ""
#: src/rougail/convert.py:817 #: src/rougail/convert.py:802
msgid "secret_manager must be a dict for {0}" msgid "secret_manager must be a dict for {0}"
msgstr "" msgstr ""
#: src/rougail/convert.py:1147 #: src/rougail/convert.py:1129
msgid "Cannot execute annotate multiple time" msgid "Cannot execute annotate multiple time"
msgstr "" msgstr ""
#: src/rougail/convert.py:1154 #: src/rougail/convert.py:1136
msgid "invalid \"structural\" definition ({0}), we cannot load any structural file!" msgid "invalid \"structural\" definition ({0}), we cannot load any structural file!"
msgstr "" msgstr ""
@ -184,67 +196,67 @@ msgstr ""
msgid "{0} in {1}" msgid "{0} in {1}"
msgstr "" msgstr ""
#: src/rougail/object_model.py:51 #: src/rougail/object_model.py:50
msgid "unknown boolean value \"{0}\"" msgid "unknown boolean value \"{0}\""
msgstr "" msgstr ""
#: src/rougail/object_model.py:182 #: src/rougail/object_model.py:181
msgid "cannot find variable \"{0}\" defined in attribute \"{1}\" for \"{2}\"" msgid "cannot find variable \"{0}\" defined in attribute \"{1}\" for \"{2}\""
msgstr "" 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}\"" msgid "the variable \"{0}\" is in fact a family in attribute \"{1}\" for \"{2}\""
msgstr "" 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}\"" msgid "unknown object \"{0}\" in attribute \"{1}\" for \"{2}\""
msgstr "" 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" msgid "identifier parameter for \"{0}\" in \"{1}\" cannot be set none dynamic family"
msgstr "" msgstr ""
#: src/rougail/object_model.py:229 #: src/rougail/object_model.py:228
msgid "cannot find variable \"{0}\" defined in \"{1}\" for \"{2}\"" msgid "cannot find variable \"{0}\" defined in \"{1}\" for \"{2}\""
msgstr "" 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" msgid "variable \"{0}\" defined in \"{1}\" for \"{2}\" is a dynamic variable"
msgstr "" 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}\"" msgid "the variable \"{0}\" is not a follower, so cannot have index type for param in \"{1}\""
msgstr "" 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" msgid "a variable \"{0}\" is needs in attribute \"{1}\" for \"{2}\" but it's a family"
msgstr "" 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}\"" msgid "variable \"{0}\" has an attribute \"{1}\" calculated with the unknown variable \"{2}\""
msgstr "" 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" msgid "the variable \"{0}\" has an invalid \"{1}\" the variable \"{2}\" is in a sub dynamic option"
msgstr "" 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" msgid "the leader \"{0}\" has an invalid \"{1}\" the follower \"{2}\" is a multi"
msgstr "" 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" msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" must not be multi"
msgstr "" 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" msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable must not be a multi or the variable \"{2}\" must be multi"
msgstr "" 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" msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable must be a multi or the variable \"{2}\" must not be multi"
msgstr "" 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" msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" is multi but is inside a list"
msgstr "" msgstr ""
@ -256,35 +268,35 @@ msgstr ""
msgid "variable \"{0}\" has a default value calculated with \"{1}\" which has incompatible type" msgid "variable \"{0}\" has a default value calculated with \"{1}\" which has incompatible type"
msgstr "" 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}\"" msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\" for variable \"{1}\""
msgstr "" 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" msgid "the variable \"{0}\" has an invalid attribute \"{1}\", \"when\" and \"when_not\" cannot set together"
msgstr "" 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}\"" msgid "\"when_not\" is not allowed in format version 1.0 for attribute \"{0}\" for variable \"{1}\""
msgstr "" 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}\"" msgid "cannot find variable \"{0}\" for the information \"{1}\" when calculating \"{2}\""
msgstr "" msgstr ""
#: src/rougail/object_model.py:694 #: src/rougail/object_model.py:696
msgid "identifier not allowed for the information \"{0}\" when calculating \"{1}\"" msgid "identifier not allowed for the information \"{0}\" when calculating \"{1}\""
msgstr "" 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}\"" msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\""
msgstr "" 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" msgid "the identifier has an invalid attribute \"{0}\", \"when\" and \"when_not\" cannot set together"
msgstr "" 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}\"" msgid "the variable \"{0}\" is not a follower, so cannot have index type for \"{1}\""
msgstr "" msgstr ""

View file

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

View file

@ -42,15 +42,28 @@ def tiramisu_display_name(
with_quote: bool = False, with_quote: bool = False,
) -> str: ) -> str:
"""Replace the Tiramisu display_name function to display path + description""" """Replace the Tiramisu display_name function to display path + description"""
doc = kls._get_information(subconfig, "doc", None) config_bag = subconfig.config_bag
comment = f" ({doc})" if doc and doc != kls.impl_getname() else "" 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: if "{{ identifier }}" in comment and subconfig.identifiers:
comment = comment.replace("{{ identifier }}", str(subconfig.identifiers[-1])) comment = comment.replace("{{ identifier }}", 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() path = kls.impl_getpath()
if "{{ identifier }}" in path and subconfig.identifiers: if "{{ identifier }}" in path and subconfig.identifiers:
path = path.replace( path = path.replace(
"{{ identifier }}", normalize_family(str(subconfig.identifiers[-1])) "{{ identifier }}", normalize_family(str(subconfig.identifiers[-1]))
) )
else:
path = comment
comment = ""
if with_quote: if with_quote:
return f'"{path}"{comment}' return f'"{path}"{comment}'
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, add_extra_options: bool = True,
) -> "OptionDescription": ) -> "OptionDescription":
rougail_options = f"""default_dictionary_format_version: rougail_options = f"""default_dictionary_format_version:
description: Dictionary format version by default, if not specified in dictionary file description: {_('Structure format version by default, if not specified in structure file')}
alternative_name: v alternative_name: v
choices: choices:
- '1.0' - '1.0'
@ -370,13 +370,13 @@ secret_manager:
for process in processes: for process in processes:
if processes[process]: if processes[process]:
objects = processes[process] objects = processes[process]
rougail_process += """ process_name = normalize_family(process)
tr_process_name = _(process_name)
rougail_process += f"""
{NAME}: {process_name}:
description: Select for {NAME} description: {_('Select for {0}').format(tr_process_name)}
""".format( """
NAME=normalize_family(process),
)
if process != "structural": if process != "structural":
rougail_process += """ rougail_process += """
alternative_name: {NAME[0]} alternative_name: {NAME[0]}
@ -454,8 +454,13 @@ secret_manager:
PROP=prop, PROP=prop,
) )
rougail_process += f""" rougail_process += f"""
define_default_params: false # {_('Override default parameters for option type')}
default_params: default_params:
description: {_("Default parameters for option type")} description: {_("Default parameters for option type")}
disabled:
variable: _.define_default_params
when: false
""" """
for typ, params in get_convert_option_types(): for typ, params in get_convert_option_types():

View file

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

View file

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

View file

@ -78,11 +78,11 @@ class Annotator(Walk):
path = alternative_name path = alternative_name
else: else:
path = variable_path.rsplit(".", 1)[0] + "." + alternative_name path = variable_path.rsplit(".", 1)[0] + "." + alternative_name
self.objectspace.version = variable.version
self.objectspace.add_variable( self.objectspace.add_variable(
alternative_name, alternative_name,
{"type": "symlink", "path": path, "opt": variable}, {"type": "symlink", "path": path, "opt": variable},
variable.xmlfiles, variable.xmlfiles,
False, False,
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 typing import List
from re import findall from re import findall
from rougail.utils import normalize_family from rougail.utils import normalize_family, undefined
from tiramisu import undefined, Calculation from tiramisu import Calculation
from tiramisu.error import ( from tiramisu.error import (
PropertiesOptionError, PropertiesOptionError,
LeadershipError, LeadershipError,

View file

@ -199,3 +199,10 @@ def calc_multi_for_type_variable(local_variable: 'Variable', variable_in_calcula
elif count_identifiers > 1: elif count_identifiers > 1:
variable_in_calculation_multi = 'submulti' variable_in_calculation_multi = 'submulti'
return local_variable_multi, variable_in_calculation_multi 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) test_raise.add(test.name)
excludes = set([ excludes = set([
'80family_several', # '80family_several',
]) ])
test_ok -= excludes test_ok -= excludes
test_raise -= excludes test_raise -= excludes
@ -149,6 +149,10 @@ def test_dictionary(test_dir):
rougailconfig['main_namespace'] = None rougailconfig['main_namespace'] = None
if (dico_dirs / test_dir / 'force_namespace').is_file(): if (dico_dirs / test_dir / 'force_namespace').is_file():
return 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) eolobj = load_rougail_object(str(dico_dirs / test_dir), rougailconfig)
if not eolobj: if not eolobj:
return return
@ -166,6 +170,10 @@ def test_dictionary_namespace(test_dir):
rougailconfig['main_namespace'] = 'Rougail' rougailconfig['main_namespace'] = 'Rougail'
if (dico_dirs / test_dir / 'force_no_namespace').is_file(): if (dico_dirs / test_dir / 'force_no_namespace').is_file():
return 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) eolobj = load_rougail_object(test_dir_, rougailconfig, namespace=True)
if not eolobj: if not eolobj:
return return

View file

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

View file

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