Compare commits

..

No commits in common. "8d6cf62204fbff952acb41657e23986f023a7c81" and "439cf7fe2db1d6df3d9ae719a3749d37ee2de34f" have entirely different histories.

28 changed files with 232 additions and 485 deletions

View file

@ -1,13 +1,3 @@
## 1.2.0a42 (2025-11-06)
### Feat
- can add limit length for a variable
### Fix
- black
## 1.2.0a41 (2025-11-06)
### Feat

View file

@ -5,8 +5,8 @@
msgid ""
msgstr ""
"Project-Id-Version: \n"
"POT-Creation-Date: 2025-11-06 21:31+0100\n"
"PO-Revision-Date: 2025-11-06 21:32+0100\n"
"POT-Creation-Date: 2025-10-26 15:26+0100\n"
"PO-Revision-Date: 2025-10-26 15:28+0100\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: fr\n"
@ -86,8 +86,10 @@ msgstr ""
"nom de l'étiquette invalide \"{0}\" ne doit pas être un nom de mode existant"
#: src/rougail/annotator/property.py:168
msgid ""
"invalid tag name \"{0}\" should not be the name of an available properties"
#, fuzzy
#| msgid ""
#| "invalid tag name \"{0}\" should not be name of an available proprerties"
msgid "invalid tag name \"{0}\" should not be name of an available properties"
msgstr ""
"nom de l'étiquette invalide \"{0}\" ne doit pas être le nom d'une propriétés "
"existantes"
@ -137,127 +139,97 @@ msgstr ""
"la variable \"{0}\" a l'attribut \"secret_manager\" donc ne devrait pas "
"avoir de valeur par défaut"
#: src/rougail/annotator/variable.py:154
msgid "{0} values needed, but there are {{{{ var | length }}}}"
msgstr "il faut {0} valeurs, mais il y en a {{{{ var | length }}}}"
#: src/rougail/annotator/variable.py:155
msgid "needs exactly {0} values"
msgstr "nécessite exactement {0} valeurs"
#: src/rougail/annotator/variable.py:157
msgid ""
"a maximum of {0} values are needed, but there are {{{{ var | length }}}}"
msgstr "il faut au maximum {0} valeurs, mais il y en a {{{{ var | length }}}}"
#: src/rougail/annotator/variable.py:158
msgid "needs a maximum of {0} values"
msgstr "nécessite au maximum {0} valeurs"
#: src/rougail/annotator/variable.py:160
msgid ""
"a minimum of {0} values are needed, but there are {{{{ var | length }}}}"
msgstr "il faut au minimum {0} valeurs, mais il y en a {{{{ var | length }}}}"
#: src/rougail/annotator/variable.py:161
msgid "needs a minimum of {0} values"
msgstr "nécessite au minimum {0} valeurs"
#: src/rougail/annotator/variable.py:223
msgid "the \"{0}\" default value is a calculation with itself"
msgstr "la valeur par défaut \"{0}\" est un calcul avec elle-même"
#: src/rougail/annotator/variable.py:285
#: src/rougail/annotator/variable.py:254
msgid ""
"the variable \"{0}\" has regexp attribut but has not the \"regexp\" type"
msgstr ""
"la variable \"{0}\" a un attribut regexp mais n'a pas le type \"regexp\""
#: src/rougail/annotator/variable.py:328
#: src/rougail/annotator/variable.py:297
msgid ""
"the variable \"{0}\" has choices attribut but has not the \"choice\" type"
msgstr ""
"la variable \"{0}\" a un attribut choices mais n'a pas le type \"choice\""
#: src/rougail/annotator/variable.py:356
#: src/rougail/annotator/variable.py:325
msgid ""
"the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}"
msgstr ""
"la variable \"{0}\" a la valeur par défaut invalide \"{1}\" devrait être {2}"
#: src/rougail/config/__init__.py:276
#: src/rougail/config/__init__.py:235
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/__init__.py:284
#: src/rougail/config/__init__.py:243
msgid "File with functions"
msgstr "Fichier avec les fonctions"
#: src/rougail/config/__init__.py:296
#: src/rougail/config/__init__.py:255
msgid "All modes level available"
msgstr "Tous les niveaux de modes valides"
#: src/rougail/config/__init__.py:308
#: src/rougail/config/__init__.py:267
msgid "Default mode for a family"
msgstr "Mode par défaut pour une famille"
#: src/rougail/config/__init__.py:328
#: src/rougail/config/__init__.py:287
msgid "Default mode for a variable"
msgstr "Mode par défaut pour une variable"
#: src/rougail/config/__init__.py:352
#: src/rougail/config/__init__.py:311
msgid "Option name for the base option"
msgstr "Nom de l'option pour l'option de base"
#: src/rougail/config/__init__.py:357
#: src/rougail/config/__init__.py:316
msgid "In cache file, do not importation of Tiramisu and other dependencies"
msgstr ""
"Dans le fichier de cache, ne pas importer Tiramisu et autres dépendances"
#: src/rougail/config/__init__.py:362
#: src/rougail/config/__init__.py:321
msgid "Tiramisu cache filename"
msgstr "Nom du fichier du cache Tiramisu"
#: src/rougail/config/__init__.py:370
#: src/rougail/config/__init__.py:329
msgid "Name of internal functions that we can use as a function"
msgstr ""
"Nom des fonctions internes qu'il est possible d'utiliser comme fonction"
#: src/rougail/config/__init__.py:376
#: src/rougail/config/__init__.py:335
msgid "Name of extra annotators"
msgstr "Nom des annotators supplémentaires"
#: src/rougail/config/__init__.py:382
#: src/rougail/config/__init__.py:341
msgid "Suffix add to generated options name"
msgstr "Suffix ajouté pour généré le nom des options"
#: src/rougail/config/__init__.py:388
#: src/rougail/config/__init__.py:347
msgid "Every variables in calculation are optionals"
msgstr "Toutes les variables dans un calcul sont optionnelles"
#: src/rougail/config/__init__.py:392
#: src/rougail/config/__init__.py:351
msgid "Loads redefine variables even if there don't already exists"
msgstr "Charger les variables redéfinis même si elles n'existe pas"
#: src/rougail/config/__init__.py:399
#: src/rougail/config/__init__.py:358
msgid "The secret pattern to build item name in Bitwarden"
msgstr "Le patron de secret pour construire le nom de l'élément dans Bitwarden"
#: src/rougail/config/__init__.py:400
#: src/rougail/config/__init__.py:359
msgid "The pattern is in Jinja format"
msgstr "Le patron est au format Jinja"
#: src/rougail/config/__init__.py:428
#: src/rougail/config/__init__.py:387
msgid "Select for {0}"
msgstr "Sélection pour {0}"
#: src/rougail/config/__init__.py:508
#: src/rougail/config/__init__.py:467
msgid "Override default parameters for option type"
msgstr "Sur charger les paramètre par défaut pour le type d'option"
#: src/rougail/config/__init__.py:511
#: src/rougail/config/__init__.py:470
msgid "Default parameters for option type"
msgstr "Paramètre par défaut pour le type d'option"
@ -296,42 +268,42 @@ msgstr ""
"définition invalide pour la définition des \"structures\" ({0}), aucun "
"fichier de structure ne peut être chargé !"
#: src/rougail/convert/object_model.py:121
#: src/rougail/convert/object_model.py:122
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/convert/object_model.py:127
#: src/rougail/convert/object_model.py:128
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/convert/object_model.py:132
#: src/rougail/convert/object_model.py:484
#: src/rougail/convert/object_model.py:133
#: src/rougail/convert/object_model.py:479
msgid "unknown object \"{0}\" in attribute \"{1}\" for \"{2}\""
msgstr "objet inconnu \"{0}\" dans l'attribut \"{1}\" pour \"{2}\""
#: src/rougail/convert/object_model.py:151
#: src/rougail/convert/object_model.py:152
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/convert/object_model.py:180
#: src/rougail/convert/object_model.py:181
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/convert/object_model.py:185
#: src/rougail/convert/object_model.py:186
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/convert/object_model.py:202
#: src/rougail/convert/object_model.py:203
msgid ""
"the variable \"{0}\" is not a follower, so cannot have index type for param "
"in \"{1}\""
@ -339,15 +311,7 @@ msgstr ""
"la variable \"{0}\" n'est pas suiveuse, donc ne peut avoir de type index "
"comme paramètre dans \"{1}\""
#: src/rougail/convert/object_model.py:252
msgid ""
"\"warnings\" are only available with attribute \"{self.attribute_name}\" for "
"variable \"{self.ori_path}\""
msgstr ""
"\"warnings\" est seulement utilisable avec l'attribut \"{self.attribute_name}"
"\" pour la variable \"{self.ori_path}\""
#: src/rougail/convert/object_model.py:410
#: src/rougail/convert/object_model.py:405
msgid ""
"variable \"{0}\" has a calculating \"{1}\" with an invalid return_type, "
"should be boolean or string, not \"{2}\""
@ -355,7 +319,7 @@ msgstr ""
"la variable \"{0}\" a un calcul \"{1}\" avec un return_type invalide, "
"devrait être un booléen ou une chaîne de caractère, et pas \"{2}\""
#: src/rougail/convert/object_model.py:479
#: src/rougail/convert/object_model.py:474
msgid ""
"a variable \"{0}\" is needs in attribute \"{1}\" for \"{2}\" but it's a "
"family"
@ -363,7 +327,7 @@ msgstr ""
"une variable \"{0}\" est nécessaire pour l'attribut \"{1}\" pour \"{2}\" "
"mais c'est une famille"
#: src/rougail/convert/object_model.py:504
#: src/rougail/convert/object_model.py:499
msgid ""
"variable \"{0}\" has an attribute \"{1}\" calculated with the unknown "
"variable \"{2}\""
@ -371,7 +335,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\" calculé avec la variable "
"inconnue \"{2}\""
#: src/rougail/convert/object_model.py:556
#: src/rougail/convert/object_model.py:551
msgid ""
"the variable \"{0}\" has an invalid \"{1}\" the variable \"{2}\" is in a sub "
"dynamic option"
@ -379,14 +343,14 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable \"{2}\" est "
"dans une sous option dynamique"
#: src/rougail/convert/object_model.py:565
#: src/rougail/convert/object_model.py:560
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/convert/object_model.py:607
#: src/rougail/convert/object_model.py:602
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" "
"must not be multi"
@ -394,7 +358,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable \"{2}\" ne "
"doit pas être multiple"
#: src/rougail/convert/object_model.py:621
#: src/rougail/convert/object_model.py:616
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable must not "
"be a multi or the variable \"{2}\" must be multi"
@ -402,7 +366,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/convert/object_model.py:635
#: src/rougail/convert/object_model.py:630
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable must be "
"a multi or the variable \"{2}\" must not be multi"
@ -410,7 +374,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/convert/object_model.py:649
#: src/rougail/convert/object_model.py:644
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" "
"is multi but is inside a list"
@ -418,7 +382,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", la variable \"{2}\" est "
"multiple mais est dans une liste"
#: src/rougail/convert/object_model.py:671
#: src/rougail/convert/object_model.py:666
msgid ""
"the variable \"{0}\" is waiting for a list as \"{1}\" but the attribute "
"\"default\" is not a list (\"{2}\")"
@ -426,7 +390,7 @@ msgstr ""
"la variable \"{0}\" attend une liste comme \"{1}\" mais l'attribut "
"\"default\" n'est pas une liste \"{2}\""
#: src/rougail/convert/object_model.py:673
#: src/rougail/convert/object_model.py:668
msgid ""
"the variable \"{0}\" is not waiting for a list as \"{1}\" but the attribute "
"\"default\" is a list (\"{2}\")"
@ -434,7 +398,7 @@ msgstr ""
"la variable \"{0}\" n'attend pas une liste comme \"{1}\" mais l'attribut "
"\"default\" est une liste \"{2}\""
#: src/rougail/convert/object_model.py:689
#: src/rougail/convert/object_model.py:684
msgid ""
"\"{0}\" attribut shall not have an \"optional\" attribute without the "
"\"default\" attribute for variable \"{1}\""
@ -442,7 +406,7 @@ msgstr ""
"l'attribut \"{0}\" ne devrait pas avoir d'attribut \"optional\" sans "
"l'attribut \"default\" pour la variable \"{1}\""
#: src/rougail/convert/object_model.py:713
#: src/rougail/convert/object_model.py:708
msgid ""
"variable \"{0}\" has a default value calculated with \"{1}\" which has "
"incompatible type"
@ -450,7 +414,7 @@ msgstr ""
"la variable \"{0}\" a une valeur par défaut calculé a partir de \"{1}\" "
"laquelle a un type incompatible"
#: src/rougail/convert/object_model.py:756
#: src/rougail/convert/object_model.py:751
msgid ""
"the variable \"{0}\" is waiting for a boolean as \"{1}\" but the attribute "
"\"default\" is not a boolean (\"{2}\")"
@ -458,7 +422,7 @@ msgstr ""
"la variable \"{0}\" attend un booléan comme \"{1}\" mais l'attribut "
"\"default\" n'est pas une booléan (\"{2}\")"
#: src/rougail/convert/object_model.py:776
#: src/rougail/convert/object_model.py:771
msgid ""
"\"when\" is not allowed in format version 1.0 for attribute \"{0}\" for "
"variable \"{1}\""
@ -466,7 +430,7 @@ msgstr ""
"\"when\" n'est pas autorisé avec le format en version 1.0 pour l'attribut "
"\"{0}\" pour la variable \"{1}\""
#: src/rougail/convert/object_model.py:781
#: src/rougail/convert/object_model.py:776
msgid ""
"the variable \"{0}\" has an invalid attribute \"{1}\", \"when\" and "
"\"when_not\" cannot set together"
@ -474,7 +438,7 @@ msgstr ""
"la variable \"{0}\" a un attribut invalide \"{1}\", \"when\" et \"when_not\" "
"ne peuvent pas être défini ensemble"
#: src/rougail/convert/object_model.py:789
#: src/rougail/convert/object_model.py:784
msgid ""
"\"when_not\" is not allowed in format version 1.0 for attribute \"{0}\" for "
"variable \"{1}\""
@ -482,7 +446,7 @@ msgstr ""
"\"when_not\" n'est pas autorisé au format 1.0 pour l'attribut \"{0}\" pour "
"la variable variable \"{1}\""
#: src/rougail/convert/object_model.py:845
#: src/rougail/convert/object_model.py:840
msgid ""
"cannot find variable \"{0}\" for the information \"{1}\" when calculating "
"\"{2}\""
@ -490,19 +454,19 @@ msgstr ""
"ne peut trouver la variable \"{0}\" pour l'information \"{1}\" lors du "
"calcul de \"{2}\""
#: src/rougail/convert/object_model.py:850
#: src/rougail/convert/object_model.py:845
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/convert/object_model.py:902
#: src/rougail/convert/object_model.py:897
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/convert/object_model.py:908
#: src/rougail/convert/object_model.py:918
#: src/rougail/convert/object_model.py:903
#: src/rougail/convert/object_model.py:913
msgid ""
"the identifier has an invalid attribute \"{0}\", \"when\" and \"when_not\" "
"cannot set together"
@ -510,7 +474,7 @@ msgstr ""
"l'identifiant a un attribut invalide \"{0}\", \"when\" et \"when_not\" ne "
"peuvent pas être défini ensemble"
#: src/rougail/convert/object_model.py:944
#: src/rougail/convert/object_model.py:939
msgid ""
"the variable \"{0}\" is not a follower, so cannot have index type for \"{1}\""
msgstr ""
@ -530,7 +494,7 @@ msgid "internal error, {0} is not a dynamic variable"
msgstr "erreur interne, \"{0}\" n'est pas une variable dynamique"
#: src/rougail/error.py:61 src/rougail/tiramisu.py:157
#: src/rougail/user_datas.py:407 src/rougail/user_datas.py:410
#: src/rougail/user_datas.py:392 src/rougail/user_datas.py:395
msgid "{0} in {1}"
msgstr "{0} dans {1}"
@ -588,24 +552,24 @@ msgstr ""
"ne peut calculer l'attribut \"{0}\" pour la variable \"{1}\" dans {2} avec "
"les paramètres \"{3}\" : {4}"
#: src/rougail/user_datas.py:145
#: src/rougail/user_datas.py:135
msgid ""
"cannot load variable path \"{0}\", the identifier \"{1}\" is not valid in {2}"
msgstr ""
"ne peut charger la variable \"{0}\", l'identifiant \"{1}\" n'est pas valide "
"dans {2}"
#: src/rougail/user_datas.py:228
#: src/rougail/user_datas.py:218
msgid "the variable \"{0}\" contains secrets and should not be defined in {1}"
msgstr ""
"la variable \"{0}\" contient des secrets et ne devrait pas être défini dans "
"{1}"
#: src/rougail/user_datas.py:268
#: src/rougail/user_datas.py:257
msgid "loaded from {0}"
msgstr "chargée depuis {0}"
#: src/rougail/user_datas.py:308
#: src/rougail/user_datas.py:297
msgid ""
"cannot set the value \"{0}\" to the family {1}, it will be ignored when "
"loading from {2}"
@ -613,11 +577,7 @@ msgstr ""
"impossible de définir la valeur \"{0}\" à la famille {1}, elle sera ignorée "
"lors du chargement depuis {2}"
#: src/rougail/user_datas.py:319 src/rougail/user_datas.py:336
msgid "{0} loaded from {1}"
msgstr "{0} chargée depuis {1}"
#: src/rougail/user_datas.py:324
#: src/rougail/user_datas.py:309
msgid ""
"variable or family \"{0}\" does not exist, it will be ignored when loading "
"from {1}"
@ -625,7 +585,7 @@ msgstr ""
"la variable ou la famille \"{0}\" n'existe pas, elle sera ignorée lors du "
"chargement depuis {1}"
#: src/rougail/user_datas.py:330
#: src/rougail/user_datas.py:315
msgid ""
"\"{0}\" is the name of a dynamic family, it will be ignored when loading "
"from {1}"
@ -633,7 +593,11 @@ msgstr ""
"\"{0}\" est le nom d'une famille dynamique, il sera ignoré lors du "
"chargement depuis {1}"
#: src/rougail/user_datas.py:364
#: src/rougail/user_datas.py:321
msgid "{0} loaded from {1}"
msgstr "{0} chargée depuis {1}"
#: src/rougail/user_datas.py:349
msgid ""
"variable {0} at index \"{1}\" is {2}, it will be ignored when loading from "
"{3}"
@ -641,23 +605,23 @@ msgstr ""
"la variable {0} à l'index \"{1}\" est {2}, elle sera ignorée lors du "
"chargement depuis {3}"
#: src/rougail/user_datas.py:375
#: src/rougail/user_datas.py:360
msgid ""
"family {0} is {1}, {2} at index \"{3}\" will be ignored when loading from {4}"
msgstr ""
"la famille {0} est {1}, {2} à l'index \"{3}\" sera ignorée lors du "
"chargement depuis {4}"
#: src/rougail/user_datas.py:388
#: src/rougail/user_datas.py:373
msgid "variable {0} is {1}, it will be ignored when loading from {2}"
msgstr ""
"la variable {0} est {1}, elle sera ignorée lors du chargement depuis {2}"
#: src/rougail/user_datas.py:396
#: src/rougail/user_datas.py:381
msgid "family {0} is {1}, {2} will be ignored when loading from {3}"
msgstr "la famille {0} est {1}, {2} sera ignorée lors du chargement depuis {3}"
#: src/rougail/user_datas.py:416
#: src/rougail/user_datas.py:401
msgid ""
"the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it will "
"be ignored when loading from {5}"
@ -665,7 +629,7 @@ msgstr ""
"la valeur \"{0}\" est un invalide {1} pour {2} à l'index \"{3}\", {4}, elle "
"sera ignorée lors du chargement depuis {5}"
#: src/rougail/user_datas.py:430
#: src/rougail/user_datas.py:415
msgid ""
"the value \"{0}\" is an invalid {1} for {2}, {3}, it will be ignored when "
"loading from {4}"
@ -705,28 +669,6 @@ msgstr "unique"
msgid "auto modified"
msgstr "auto modifiée"
#, fuzzy
#~| msgid ""
#~| "we need {0} values when there are {{{{ var | length }}}} ({{{{ var | "
#~| "join(\", \")}}}})"
#~ msgid ""
#~ "it needs {0} values maximum when there are {{{{ var | length }}}} "
#~ "({{{{ var | join(\", \")}}}})"
#~ msgstr ""
#~ "we need {0} values when there are {{{{ var | length }}}} ({{{{ var | "
#~ "join(\", \")}}}})"
#, fuzzy
#~| msgid ""
#~| "we need {0} values when there are {{{{ var | length }}}} ({{{{ var | "
#~| "join(\", \")}}}})"
#~ msgid ""
#~ "it needs {0} values minimum when there are {{{{ var | length }}}} "
#~ "({{{{ var | join(\", \")}}}})"
#~ msgstr ""
#~ "we need {0} values when there are {{{{ var | length }}}} ({{{{ var | "
#~ "join(\", \")}}}})"
#~ msgid ""
#~ "the variable \"{0}\" is a family, so cannot set the value \"{1}\" in {2}"
#~ msgstr ""

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2025-11-06 21:32+0100\n"
"POT-Creation-Date: 2025-10-26 15:29+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -56,7 +56,7 @@ msgid "invalid tag name \"{0}\" should not be a name of an existing mode"
msgstr ""
#: src/rougail/annotator/property.py:168
msgid "invalid tag name \"{0}\" should not be the name of an available properties"
msgid "invalid tag name \"{0}\" should not be name of an available properties"
msgstr ""
#: src/rougail/annotator/value.py:78
@ -87,115 +87,87 @@ msgstr ""
msgid "the variable \"{0}\" has attribute \"secret_manager\" so must not have default value"
msgstr ""
#: src/rougail/annotator/variable.py:154
msgid "{0} values needed, but there are {{{{ var | length }}}}"
msgstr ""
#: src/rougail/annotator/variable.py:155
msgid "needs exactly {0} values"
msgstr ""
#: src/rougail/annotator/variable.py:157
msgid "a maximum of {0} values are needed, but there are {{{{ var | length }}}}"
msgstr ""
#: src/rougail/annotator/variable.py:158
msgid "needs a maximum of {0} values"
msgstr ""
#: src/rougail/annotator/variable.py:160
msgid "a minimum of {0} values are needed, but there are {{{{ var | length }}}}"
msgstr ""
#: src/rougail/annotator/variable.py:161
msgid "needs a minimum of {0} values"
msgstr ""
#: src/rougail/annotator/variable.py:223
msgid "the \"{0}\" default value is a calculation with itself"
msgstr ""
#: src/rougail/annotator/variable.py:285
#: src/rougail/annotator/variable.py:254
msgid "the variable \"{0}\" has regexp attribut but has not the \"regexp\" type"
msgstr ""
#: src/rougail/annotator/variable.py:328
#: src/rougail/annotator/variable.py:297
msgid "the variable \"{0}\" has choices attribut but has not the \"choice\" type"
msgstr ""
#: src/rougail/annotator/variable.py:356
#: src/rougail/annotator/variable.py:325
msgid "the variable \"{0}\" has an unvalid default value \"{1}\" should be in {2}"
msgstr ""
#: src/rougail/config/__init__.py:276
#: src/rougail/config/__init__.py:235
msgid "Structure format version by default, if not specified in structure file"
msgstr ""
#: src/rougail/config/__init__.py:284
#: src/rougail/config/__init__.py:243
msgid "File with functions"
msgstr ""
#: src/rougail/config/__init__.py:296
#: src/rougail/config/__init__.py:255
msgid "All modes level available"
msgstr ""
#: src/rougail/config/__init__.py:308
#: src/rougail/config/__init__.py:267
msgid "Default mode for a family"
msgstr ""
#: src/rougail/config/__init__.py:328
#: src/rougail/config/__init__.py:287
msgid "Default mode for a variable"
msgstr ""
#: src/rougail/config/__init__.py:352
#: src/rougail/config/__init__.py:311
msgid "Option name for the base option"
msgstr ""
#: src/rougail/config/__init__.py:357
#: src/rougail/config/__init__.py:316
msgid "In cache file, do not importation of Tiramisu and other dependencies"
msgstr ""
#: src/rougail/config/__init__.py:362
#: src/rougail/config/__init__.py:321
msgid "Tiramisu cache filename"
msgstr ""
#: src/rougail/config/__init__.py:370
#: src/rougail/config/__init__.py:329
msgid "Name of internal functions that we can use as a function"
msgstr ""
#: src/rougail/config/__init__.py:376
#: src/rougail/config/__init__.py:335
msgid "Name of extra annotators"
msgstr ""
#: src/rougail/config/__init__.py:382
#: src/rougail/config/__init__.py:341
msgid "Suffix add to generated options name"
msgstr ""
#: src/rougail/config/__init__.py:388
#: src/rougail/config/__init__.py:347
msgid "Every variables in calculation are optionals"
msgstr ""
#: src/rougail/config/__init__.py:392
#: src/rougail/config/__init__.py:351
msgid "Loads redefine variables even if there don't already exists"
msgstr ""
#: src/rougail/config/__init__.py:399
#: src/rougail/config/__init__.py:358
msgid "The secret pattern to build item name in Bitwarden"
msgstr ""
#: src/rougail/config/__init__.py:400
#: src/rougail/config/__init__.py:359
msgid "The pattern is in Jinja format"
msgstr ""
#: src/rougail/config/__init__.py:428
#: src/rougail/config/__init__.py:387
msgid "Select for {0}"
msgstr ""
#: src/rougail/config/__init__.py:508
#: src/rougail/config/__init__.py:467
msgid "Override default parameters for option type"
msgstr ""
#: src/rougail/config/__init__.py:511
#: src/rougail/config/__init__.py:470
msgid "Default parameters for option type"
msgstr ""
@ -231,125 +203,121 @@ msgstr ""
msgid "invalid \"structural\" definition ({0}), we cannot load any structural file!"
msgstr ""
#: src/rougail/convert/object_model.py:121
#: src/rougail/convert/object_model.py:122
msgid "cannot find variable \"{0}\" defined in attribute \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:127
#: src/rougail/convert/object_model.py:128
msgid "the variable \"{0}\" is in fact a family in attribute \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:132
#: src/rougail/convert/object_model.py:484
#: src/rougail/convert/object_model.py:133
#: src/rougail/convert/object_model.py:479
msgid "unknown object \"{0}\" in attribute \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:151
#: src/rougail/convert/object_model.py:152
msgid "identifier parameter for \"{0}\" in \"{1}\" cannot be set none dynamic family"
msgstr ""
#: src/rougail/convert/object_model.py:180
#: src/rougail/convert/object_model.py:181
msgid "cannot find variable \"{0}\" defined in \"{1}\" for \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:185
#: src/rougail/convert/object_model.py:186
msgid "variable \"{0}\" defined in \"{1}\" for \"{2}\" is a dynamic variable"
msgstr ""
#: src/rougail/convert/object_model.py:202
#: src/rougail/convert/object_model.py:203
msgid "the variable \"{0}\" is not a follower, so cannot have index type for param in \"{1}\""
msgstr ""
#: src/rougail/convert/object_model.py:252
msgid "\"warnings\" are only available with attribute \"{self.attribute_name}\" for variable \"{self.ori_path}\""
msgstr ""
#: src/rougail/convert/object_model.py:410
#: src/rougail/convert/object_model.py:405
msgid "variable \"{0}\" has a calculating \"{1}\" with an invalid return_type, should be boolean or string, not \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:479
#: src/rougail/convert/object_model.py:474
msgid "a variable \"{0}\" is needs in attribute \"{1}\" for \"{2}\" but it's a family"
msgstr ""
#: src/rougail/convert/object_model.py:504
#: src/rougail/convert/object_model.py:499
msgid "variable \"{0}\" has an attribute \"{1}\" calculated with the unknown variable \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:556
#: src/rougail/convert/object_model.py:551
msgid "the variable \"{0}\" has an invalid \"{1}\" the variable \"{2}\" is in a sub dynamic option"
msgstr ""
#: src/rougail/convert/object_model.py:565
#: src/rougail/convert/object_model.py:560
msgid "the leader \"{0}\" has an invalid \"{1}\" the follower \"{2}\" is a multi"
msgstr ""
#: src/rougail/convert/object_model.py:607
#: src/rougail/convert/object_model.py:602
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" must not be multi"
msgstr ""
#: src/rougail/convert/object_model.py:621
#: src/rougail/convert/object_model.py:616
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/convert/object_model.py:635
#: src/rougail/convert/object_model.py:630
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/convert/object_model.py:649
#: src/rougail/convert/object_model.py:644
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", the variable \"{2}\" is multi but is inside a list"
msgstr ""
#: src/rougail/convert/object_model.py:671
#: src/rougail/convert/object_model.py:666
msgid "the variable \"{0}\" is waiting for a list as \"{1}\" but the attribute \"default\" is not a list (\"{2}\")"
msgstr ""
#: src/rougail/convert/object_model.py:673
#: src/rougail/convert/object_model.py:668
msgid "the variable \"{0}\" is not waiting for a list as \"{1}\" but the attribute \"default\" is a list (\"{2}\")"
msgstr ""
#: src/rougail/convert/object_model.py:689
#: src/rougail/convert/object_model.py:684
msgid "\"{0}\" attribut shall not have an \"optional\" attribute without the \"default\" attribute for variable \"{1}\""
msgstr ""
#: src/rougail/convert/object_model.py:713
#: src/rougail/convert/object_model.py:708
msgid "variable \"{0}\" has a default value calculated with \"{1}\" which has incompatible type"
msgstr ""
#: src/rougail/convert/object_model.py:756
#: src/rougail/convert/object_model.py:751
msgid "the variable \"{0}\" is waiting for a boolean as \"{1}\" but the attribute \"default\" is not a boolean (\"{2}\")"
msgstr ""
#: src/rougail/convert/object_model.py:776
#: src/rougail/convert/object_model.py:771
msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\" for variable \"{1}\""
msgstr ""
#: src/rougail/convert/object_model.py:781
#: src/rougail/convert/object_model.py:776
msgid "the variable \"{0}\" has an invalid attribute \"{1}\", \"when\" and \"when_not\" cannot set together"
msgstr ""
#: src/rougail/convert/object_model.py:789
#: src/rougail/convert/object_model.py:784
msgid "\"when_not\" is not allowed in format version 1.0 for attribute \"{0}\" for variable \"{1}\""
msgstr ""
#: src/rougail/convert/object_model.py:845
#: src/rougail/convert/object_model.py:840
msgid "cannot find variable \"{0}\" for the information \"{1}\" when calculating \"{2}\""
msgstr ""
#: src/rougail/convert/object_model.py:850
#: src/rougail/convert/object_model.py:845
msgid "identifier not allowed for the information \"{0}\" when calculating \"{1}\""
msgstr ""
#: src/rougail/convert/object_model.py:902
#: src/rougail/convert/object_model.py:897
msgid "\"when\" is not allowed in format version 1.0 for attribute \"{0}\""
msgstr ""
#: src/rougail/convert/object_model.py:908
#: src/rougail/convert/object_model.py:918
#: src/rougail/convert/object_model.py:903
#: src/rougail/convert/object_model.py:913
msgid "the identifier has an invalid attribute \"{0}\", \"when\" and \"when_not\" cannot set together"
msgstr ""
#: src/rougail/convert/object_model.py:944
#: src/rougail/convert/object_model.py:939
msgid "the variable \"{0}\" is not a follower, so cannot have index type for \"{1}\""
msgstr ""
@ -362,7 +330,7 @@ msgid "internal error, {0} is not a dynamic variable"
msgstr ""
#: src/rougail/error.py:61 src/rougail/tiramisu.py:157
#: src/rougail/user_datas.py:407 src/rougail/user_datas.py:410
#: src/rougail/user_datas.py:392 src/rougail/user_datas.py:395
msgid "{0} in {1}"
msgstr ""
@ -414,55 +382,55 @@ msgstr ""
msgid "cannot calculating \"{0}\" attribute for variable \"{1}\" in {2} with parameters \"{3}\": {4}"
msgstr ""
#: src/rougail/user_datas.py:145
#: src/rougail/user_datas.py:135
msgid "cannot load variable path \"{0}\", the identifier \"{1}\" is not valid in {2}"
msgstr ""
#: src/rougail/user_datas.py:228
#: src/rougail/user_datas.py:218
msgid "the variable \"{0}\" contains secrets and should not be defined in {1}"
msgstr ""
#: src/rougail/user_datas.py:268
#: src/rougail/user_datas.py:257
msgid "loaded from {0}"
msgstr ""
#: src/rougail/user_datas.py:308
#: src/rougail/user_datas.py:297
msgid "cannot set the value \"{0}\" to the family {1}, it will be ignored when loading from {2}"
msgstr ""
#: src/rougail/user_datas.py:319 src/rougail/user_datas.py:336
msgid "{0} loaded from {1}"
msgstr ""
#: src/rougail/user_datas.py:324
#: src/rougail/user_datas.py:309
msgid "variable or family \"{0}\" does not exist, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_datas.py:330
#: src/rougail/user_datas.py:315
msgid "\"{0}\" is the name of a dynamic family, it will be ignored when loading from {1}"
msgstr ""
#: src/rougail/user_datas.py:364
#: src/rougail/user_datas.py:321
msgid "{0} loaded from {1}"
msgstr ""
#: src/rougail/user_datas.py:349
msgid "variable {0} at index \"{1}\" is {2}, it will be ignored when loading from {3}"
msgstr ""
#: src/rougail/user_datas.py:375
#: src/rougail/user_datas.py:360
msgid "family {0} is {1}, {2} at index \"{3}\" will be ignored when loading from {4}"
msgstr ""
#: src/rougail/user_datas.py:388
#: src/rougail/user_datas.py:373
msgid "variable {0} is {1}, it will be ignored when loading from {2}"
msgstr ""
#: src/rougail/user_datas.py:396
#: src/rougail/user_datas.py:381
msgid "family {0} is {1}, {2} will be ignored when loading from {3}"
msgstr ""
#: src/rougail/user_datas.py:416
#: src/rougail/user_datas.py:401
msgid "the value \"{0}\" is an invalid {1} for {2} at index \"{3}\", {4}, it will be ignored when loading from {5}"
msgstr ""
#: src/rougail/user_datas.py:430
#: src/rougail/user_datas.py:415
msgid "the value \"{0}\" is an invalid {1} for {2}, {3}, it will be ignored when loading from {4}"
msgstr ""

View file

@ -1,6 +1,6 @@
[project]
name = "rougail"
version = "1.2.0a42"
version = "1.2.0a41"
[tool.commitizen]
name = "cz_conventional_commits"

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail-base"
version = "1.2.0a42"
version = "1.2.0a41"
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

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "rougail"
version = "1.2.0a42"
version = "1.2.0a41"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
description = "A consistency handling system that was initially designed in the configuration management"
classifiers = [
@ -18,7 +18,7 @@ classifiers = [
dependencies = [
"ruamel.yaml ~= 0.18.6",
"pydantic ~= 2.9.2",
"rougail-base == 1.2.0a42",
"rougail-base == 1.2.0a41",
]
[tool.flit.sdist]

View file

@ -1 +1 @@
__version__ = "1.2.0a42"
__version__ = "1.2.0a41"

View file

@ -147,15 +147,12 @@ class Annotator(Walk):
for tag in variable.tags:
self.check_tag(tag, variable.xmlfiles)
self.objectspace.properties.add(variable.path, tag, True)
self.objectspace.informations.add(
variable.path, "tags", tuple(variable.tags)
)
self.objectspace.informations.add(variable.path, "tags", tuple(variable.tags))
def check_tag(
self,
tag: str,
xmlfiles: List[str],
):
def check_tag(self,
tag: str,
xmlfiles: List[str],
):
match = NAME_REGEXP.search(tag)
if not match:
msg = _(
@ -169,7 +166,7 @@ class Annotator(Walk):
raise DictConsistencyError(msg, 82, xmlfiles)
if tag in PROPERTIES_MAKE_SENSE:
msg = _(
'invalid tag name "{0}" should not be the name of an available properties'
'invalid tag name "{0}" should not be name of an available properties'
).format(tag)
raise DictConsistencyError(msg, 82, xmlfiles)

View file

@ -29,13 +29,7 @@ from tiramisu.error import display_list
from rougail.i18n import _
from rougail.utils import calc_multi_for_type_variable
from rougail.error import DictConsistencyError
from rougail.convert.object_model import (
Calculation,
VariableCalculation,
VariableParam,
IndexCalculation,
JinjaCalculation,
)
from rougail.convert.object_model import Calculation, VariableCalculation, IndexCalculation
from rougail.tiramisu import display_xmlfiles, RENAME_TYPE
from warnings import warn
@ -122,87 +116,37 @@ class Annotator(Walk): # pylint: disable=R0903
continue
if variable.type in RENAME_TYPE:
warning = f'the variable "{ variable.path }" has a depreciated type "{variable.type}", please use "{RENAME_TYPE[variable.type]}" instead in {display_xmlfiles(variable.xmlfiles)}'
warn(
warning,
DeprecationWarning,
)
warn(warning,
DeprecationWarning,
)
variable.type = RENAME_TYPE[variable.type]
if variable.type == "cidr":
if variable.type == 'cidr':
warning = f'the variable "{ variable.path }" has a depreciated type "{variable.type}", please use type "ip" with attribute cidr=True instead in {display_xmlfiles(variable.xmlfiles)}'
warn(
warning,
DeprecationWarning,
)
if variable.type == "network_cidr":
warn(warning,
DeprecationWarning,
)
if variable.type == 'network_cidr':
warning = f'the variable "{ variable.path }" has a depreciated type "{variable.type}", please use type "network" with attribute cidr=True instead in {display_xmlfiles(variable.xmlfiles)}'
warn(
warning,
DeprecationWarning,
)
warn(warning,
DeprecationWarning,
)
self.objectspace.informations.add(
variable.path, "ymlfiles", variable.xmlfiles
)
if variable.version != "1.0" and variable.type is None:
if isinstance(variable.default, IndexCalculation):
variable.type = "integer"
elif isinstance(variable.default, VariableCalculation):
if isinstance(
variable.default, IndexCalculation
):
variable.type = 'integer'
elif isinstance(
variable.default, VariableCalculation
):
calculated_variable_path, calculated_variable, identifier = (
variable.default.get_variable(self.objectspace)
)
if calculated_variable is not None:
self._default_variable_copy_informations(
variable, calculated_variable
)
self._default_variable_copy_informations(variable, calculated_variable)
self._convert_variable(variable)
if variable.multi and variable.params:
indexes_to_remove = []
for idx, param in enumerate(variable.params):
if param.key == "multi_length":
jinja = f'{{% if var | length != {param.value} %}}{_("{0} values needed, but there are {{{{ var | length }}}}").format(param.value)}{{% endif %}}'
description = _("needs exactly {0} values").format(param.value)
elif param.key == "multi_max_length":
jinja = f'{{% if var | length > {param.value} %}}{_("a maximum of {0} values are needed, but there are {{{{ var | length }}}}").format(param.value)}{{% endif %}}'
description = _("needs a maximum of {0} values").format(
param.value
)
elif param.key == "multi_min_length":
jinja = f'{{% if var | length < {param.value} %}}{_("a minimum of {0} values are needed, but there are {{{{ var | length }}}}").format(param.value)}{{% endif %}}'
description = _("needs a minimum of {0} values").format(
param.value
)
else:
continue
indexes_to_remove.append(idx)
if variable.validators is None:
variable.validators = []
variable.validators.append(
JinjaCalculation(
path=variable.path,
inside_list=True,
version=variable.version,
xmlfiles=variable.xmlfiles,
attribute_name="validators",
namespace=variable.namespace,
jinja=jinja,
description=description,
params=[
VariableParam(
variable.path,
"validators",
False,
variable.xmlfiles,
key="var",
namespace=variable.namespace,
type="variable",
variable=variable.path,
whole=True,
)
],
)
)
for idx in reversed(indexes_to_remove):
variable.params.pop(idx)
def _convert_variable_inference(
self,
@ -245,8 +189,10 @@ class Annotator(Walk): # pylint: disable=R0903
and variable.path == calculated_variable.default.path
):
msg = _(
'the "{0}" default value is a calculation with itself'
).format(variable.path)
'the "{0}" default value is a calculation with itself'.format(
variable.path
)
)
raise DictConsistencyError(msg, 75, variable.xmlfiles)
self._convert_variable_multi(calculated_variable)
variable.multi = calc_multi_for_type_variable(

View file

@ -25,7 +25,6 @@ details.
You should have received a copy of the GNU Lesser General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from pathlib import Path
from tiramisu import Config
from ruamel.yaml import YAML
@ -166,8 +165,7 @@ class _RougailConfig:
return ret
def __contains__(
self,
key,
self, key,
) -> None:
try:
self.__getitem__(key)
@ -206,7 +204,7 @@ class _RougailConfig:
return values
class RConfigLeadership:
class RConfigLeadership():
def __init__(self, config, option, leader, followers):
self.config = config
self.option = option
@ -222,11 +220,11 @@ class RConfigLeadership:
value,
) -> None:
self.config.property.read_write()
names = self.option.option("names")
names = self.option.option('names')
leader = names.value.get()
leader.append(key)
names.value.set(leader)
directories = self.option.option("directories", len(leader) - 1)
directories = self.option.option('directories', len(leader) - 1)
directories.value.set(value)
self.leader.append(key)
self.followers.append(value)

View file

@ -161,7 +161,7 @@ class ParserVariable:
def load_config(self) -> None:
rougailconfig = self.rougailconfig
self.suffix = rougailconfig["suffix"]
self.default_structural_format_version = rougailconfig[
self.default_structural_format_version= rougailconfig[
"default_structural_format_version"
]
self.custom_types = rougailconfig["custom_types"]
@ -586,11 +586,10 @@ class ParserVariable:
del family["variable"]
if self.version != "1.0":
warning = f'"variable" attribute in dynamic family "{ path }" is depreciated in {filename}'
warn(
warning,
DeprecationWarning,
stacklevel=2,
)
warn(warning,
DeprecationWarning,
stacklevel=2,
)
if "variable" in family:
raise Exception(
f'dynamic family must not have "variable" attribute for "{family["path"]}" in {family["xmlfiles"]}'

View file

@ -249,9 +249,7 @@ class Calculation(BaseModel):
def get_params(self, objectspace):
if self.warnings is not None and self.attribute_name != "validators":
msg = _(
'"warnings" are only available with attribute "{self.attribute_name}" for variable "{self.ori_path}"'
)
msg = _('"warnings" are only available with attribute "{self.attribute_name}" for variable "{self.ori_path}"')
raise DictConsistencyError(msg, 83, xmlfiles)
if not self.params:
return {}
@ -312,11 +310,10 @@ class JinjaCalculation(Calculation):
objectspace.jinja[jinja_path] = self.jinja
if return_type in RENAME_TYPE:
warning = f'the variable "{ self.path }" has a depreciated return_type "{return_type}", please use "{RENAME_TYPE[return_type]}" instead in {display_xmlfiles(variable.xmlfiles)}'
warn(
warning,
DeprecationWarning,
stacklevel=2,
)
warn(warning,
DeprecationWarning,
stacklevel=2,
)
return_type = RENAME_TYPE[return_type]
default = {
"function": function,
@ -421,11 +418,7 @@ class JinjaCalculation(Calculation):
False,
objectspace,
add_help=True,
params={
None: [self.attribute_name, description],
"when": True,
"inverse": False,
},
params={None: [self.attribute_name, description], "when": True, "inverse": False},
)
elif self.attribute_name == "choices":
return_type = self.return_type
@ -675,13 +668,9 @@ class _VariableCalculation(Calculation):
value_is_multi = isinstance(default, list)
if expected_multiple_value != value_is_multi:
if self.attribute_name != "default" or expected_multiple_value:
msg = _(
'the variable "{0}" is waiting for a list as "{1}" but the attribute "default" is not a list ("{2}")'
)
msg = _('the variable "{0}" is waiting for a list as "{1}" but the attribute "default" is not a list ("{2}")')
else:
msg = _(
'the variable "{0}" is not waiting for a list as "{1}" but the attribute "default" is a list ("{2}")'
)
msg = _('the variable "{0}" is not waiting for a list as "{1}" but the attribute "default" is a list ("{2}")')
msg = msg.format(self.path, self.attribute_name, default)
raise DictConsistencyError(msg, 77, self.xmlfiles)
return default
@ -696,11 +685,7 @@ class VariableCalculation(_VariableCalculation):
self,
objectspace,
) -> dict:
if (
self.attribute_name != "default"
and self.optional
and self.default is undefined
):
if self.attribute_name != "default" and self.optional and self.default is undefined:
msg = _(
'"{0}" attribut shall not have an "optional" attribute without the "default" attribute for variable "{1}"'
).format(self.attribute_name, self.variable)
@ -710,8 +695,10 @@ class VariableCalculation(_VariableCalculation):
variable_in_calculation,
variable_in_calculation_identifier,
) = self.get_variable(objectspace)
if not variable_in_calculation and (
self.optional or objectspace.force_optional
if (
not variable_in_calculation
and (self.optional
or objectspace.force_optional)
):
if self.default is not undefined:
return self.get_default_value_optional(objectspace, self.default)
@ -756,18 +743,17 @@ class VariablePropertyCalculation(_VariableCalculation):
variable_in_calculation_identifier,
) = self.get_variable(objectspace)
if (
# self.default is not undefined and
# self.default is not undefined and
not variable_in_calculation
and (self.optional or objectspace.force_optional)
and (self.optional
or objectspace.force_optional)
):
if self.default is undefined:
default = False
else:
default = self.default
if not isinstance(default, bool):
msg = _(
'the variable "{0}" is waiting for a boolean as "{1}" but the attribute "default" is not a boolean ("{2}")'
)
msg = _('the variable "{0}" is waiting for a boolean as "{1}" but the attribute "default" is not a boolean ("{2}")')
msg = msg.format(self.path, self.attribute_name, default)
raise DictConsistencyError(msg, 79, self.xmlfiles)
return self.get_default_value_optional(objectspace, default)
@ -776,7 +762,7 @@ class VariablePropertyCalculation(_VariableCalculation):
variable_in_calculation_path,
variable_in_calculation,
variable_in_calculation_identifier,
key="value",
key="value"
)
params["prop"] = self.attribute_name
if objectspace.force_optional and (

View file

@ -204,8 +204,8 @@ class Paths:
option = self._data[path]
option_namespace = option.namespace
if (
self.isolated_namespace
and self.default_namespace not in [namespace, option_namespace]
self.isolated_namespace and
self.default_namespace not in [namespace, option_namespace]
and namespace != option_namespace
):
msg = _(

View file

@ -231,10 +231,8 @@ class Common:
elif ret is not None:
calc_properties.append(ret)
if properties or calc_properties:
return (
"frozenset({" + ", ".join(sorted(properties) + calc_properties) + "})"
)
raise Exception("ca existe alors ...")
return "frozenset({" + ", ".join(sorted(properties) + calc_properties) + "})"
raise Exception('ca existe alors ...')
def calculation_property(
self,
@ -247,6 +245,7 @@ class Common:
return None
return value
def calc_properties(
self,
prop,
@ -469,7 +468,7 @@ class Variable(Common):
keys["values"] = self.populate_calculation(
self.elt.choices, return_a_tuple=True
)
if keys["values"] == "(,)":
if keys["values"] == '(,)':
keys["values"] = tuple()
except VariableCalculationDependencyError:
keys["values"] = tuple()

View file

@ -39,10 +39,9 @@ class Walker:
rougailconfig = self.convert.rougailconfig
self.sort_structural_files_all = rougailconfig["sort_structural_files_all"]
if rougailconfig["main_namespace"]:
self.convert.paths = Paths(
rougailconfig["main_namespace"],
rougailconfig["isolated_namespace"],
)
self.convert.paths = Paths(rougailconfig["main_namespace"],
rougailconfig["isolated_namespace"],
)
self.load_with_extra(
rougailconfig["extra_namespaces"],
rougailconfig["main_namespace"],

View file

@ -36,12 +36,7 @@ from unicodedata import normalize, combining
from jinja2 import StrictUndefined, DictLoader
from jinja2.sandbox import SandboxedEnvironment
from re import findall
from tiramisu import (
DynOptionDescription,
calc_value,
function_waiting_for_error,
undefined,
)
from tiramisu import DynOptionDescription, calc_value, function_waiting_for_error, undefined
from tiramisu.error import (
ValueWarning,
ConfigError,
@ -139,7 +134,7 @@ CONVERT_OPTION = {
#
"symlink": dict(opttype="SymLinkOption"),
}
RENAME_TYPE = {"number": "integer"}
RENAME_TYPE = {'number': 'integer'}
def get_identifier_from_dynamic_family(true_name, name) -> str:
@ -377,16 +372,14 @@ def variable_to_property(*, prop, value=undefined, when, inverse, **kwargs):
@function_waiting_for_error
def jinja_to_property(prop, description, when, inverse, **kwargs):
value = func["jinja_to_function"](**kwargs)
if kwargs["__internal_type"] == "string":
if kwargs["__internal_type"] == 'string':
value = value is not None
return func["variable_to_property"](
prop=prop, value=value, when=when, inverse=inverse
)
return func["variable_to_property"](prop=prop, value=value, when=when, inverse=inverse)
@function_waiting_for_error
def jinja_to_property_help(prop, description, **kwargs):
if kwargs["__internal_type"] == "string":
if kwargs["__internal_type"] == 'string':
description = func["jinja_to_function"](**kwargs)
return (prop, f'"{prop}" ({description})')
@ -415,7 +408,6 @@ class ConvertDynOptionDescription(DynOptionDescription):
"""Identifier could be an integer, we should convert it in str
Identifier could also contain invalid character, so we should "normalize" it
"""
@staticmethod
def convert_identifier_to_path(identifier):
if identifier is None:
@ -446,9 +438,7 @@ class ConvertDynOptionDescription(DynOptionDescription):
if "{{ identifier }}" in display:
return display.replace(
"{{ identifier }}",
self.convert_identifier_to_path(
self.get_identifiers(subconfig, from_display_name=True)[-1]
),
self.convert_identifier_to_path(self.get_identifiers(subconfig, from_display_name=True)[-1]),
)
return display

View file

@ -238,7 +238,7 @@ class UserDatas:
if index is not None:
if isinstance(value, tuple):
self.values[values_path]["values"] = []
# for i in range(len(option.parent().leader().value.get())):
# for i in range(len(option.parent().leader().value.get())):
for i in range(option.value.len()):
self.values[values_path]["values"].append(value)
value = self.values[values_path]["values"]
@ -256,7 +256,7 @@ class UserDatas:
option.value.pop(idx)
try:
self.set_value(option, value, options)
# option.value.set(value)
# option.value.set(value)
value_is_set = True
except Exception as err:
if path != option.path():
@ -265,9 +265,7 @@ class UserDatas:
if "source" in self.values[values_path]:
option_without_index.information.set(
"loaded_from",
_("loaded from {0}").format(
self.values[values_path]["source"]
),
_("loaded from {0}").format(self.values[values_path]["source"]),
)
# value is correctly set, remove variable to the set
if index is not None:
@ -299,7 +297,7 @@ class UserDatas:
if "{{ identifier }}" in path:
continue
value = options["values"]
if options.get("secret_manager"):
if options.get('secret_manager'):
option = self.config.forcepermissive.option(path)
else:
option = self.config.option(path)
@ -357,9 +355,7 @@ class UserDatas:
self.set_value(option, value, options.get("options", {}))
except PropertiesOptionError as err:
if err.code == "property-error":
properties = display_list(
[_(prop) for prop in err.proptype], add_quote=False
)
properties = display_list([_(prop) for prop in err.proptype], add_quote=False)
err_path = err._subconfig.path
display_name = option.description(with_quote=True)
if index is not None:
@ -450,9 +446,7 @@ class UserDatas:
is_secret_manager = options.get("secret_manager", False)
if is_secret_manager and isinstance(value, tuple):
# it's a function
value = value[0](
*value[1:], option=option, warnings=self.warnings, errors=self.errors
)
value = value[0](*value[1:], option=option, warnings=self.warnings, errors=self.errors)
option.value.set(value)

View file

@ -217,4 +217,5 @@ def get_properties_to_string():
]
undefined = Undefined()

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,19 +0,0 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
try:
groups.namespace
except:
groups.addgroup('namespace')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
dict_env['validators_rougail.var1'] = "{% if var | length != 2 %}2 values needed, but there are {{ var | length }}{% endif %}"
dict_env['validators_rougail.var2'] = "{% if var | length < 1 %}a minimum of 1 values are needed, but there are {{ var | length }}{% endif %}"
dict_env['validators_rougail.var2_0'] = "{% if var | length > 4 %}a maximum of 4 values are needed, but there are {{ var | length }}{% endif %}"
option_2 = StrOption(name="var1", doc="the variable", multi=True, validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.var1"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.var1"), 'var': ParamSelfOption(whole=True)}))], properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml'], 'type': 'string'})
option_3 = StrOption(name="var2", doc="the variable", multi=True, validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.var2"), 'var': ParamSelfOption(whole=True)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_rougail.var2_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("rougail.var2"), 'var': ParamSelfOption(whole=True)}))], properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/01_6string_multi_length/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

@ -1,14 +0,0 @@
from tiramisu import *
from tiramisu.setting import ALLOWED_LEADER_PROPERTIES
from re import compile as re_compile
from rougail.tiramisu import func, dict_env, load_functions, ConvertDynOptionDescription
load_functions('../rougail-tests/funcs/test.py')
ALLOWED_LEADER_PROPERTIES.add("basic")
ALLOWED_LEADER_PROPERTIES.add("standard")
ALLOWED_LEADER_PROPERTIES.add("advanced")
dict_env['validators_var1'] = "{% if var | length != 2 %}2 values needed, but there are {{ var | length }}{% endif %}"
dict_env['validators_var2'] = "{% if var | length < 1 %}a minimum of 1 values are needed, but there are {{ var | length }}{% endif %}"
dict_env['validators_var2_0'] = "{% if var | length > 4 %}a maximum of 4 values are needed, but there are {{ var | length }}{% endif %}"
option_1 = StrOption(name="var1", doc="the variable", multi=True, validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_var1"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("var1"), 'var': ParamSelfOption(whole=True)}))], properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml'], 'type': 'string'})
option_2 = StrOption(name="var2", doc="the variable", multi=True, validators=[Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_var2"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("var2"), 'var': ParamSelfOption(whole=True)})), Calculation(func['valid_with_jinja'], Params((), kwargs={'__internal_jinja': ParamValue("validators_var2_0"), '__internal_type': ParamValue("string"), '__internal_multi': ParamValue(False), '__internal_files': ParamValue(['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml']), '__internal_attribute': ParamValue("validators"), '__internal_variable': ParamValue("var2"), 'var': ParamSelfOption(whole=True)}))], properties=frozenset({"basic", "mandatory"}), informations={'ymlfiles': ['../rougail-tests/structures/01_6string_multi_length/rougail/00-base.yml'], 'type': 'string'})
option_0 = OptionDescription(name="baseoption", doc="baseoption", children=[option_1, option_2])

View file

@ -47,7 +47,7 @@ excludes = set([
])
test_ok -= excludes
test_raise -= excludes
# test_ok = ['01_6string_multi_length']
#test_ok = ['04_5validators_warnings_all']
#test_ok = []
# test_raise = ['80unknown_default_variable_inside_dynamic_family']
#test_raise = []

View file

@ -31,7 +31,7 @@ excludes = set([])
# excludes = set(['60_5family_dynamic_variable_outside_sub_suffix'])
test_ok -= excludes
# test_ok = ['01_6string_multi_length']
#test_ok = ['04_5disabled_calculation_boolean']
test_ok = list(test_ok)