Compare commits

...

8 commits

14 changed files with 264 additions and 156 deletions

View file

@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Tiramisu\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-11-05 08:49+0100\n"
"POT-Creation-Date: 2024-12-15 11:03+0100\n"
"PO-Revision-Date: \n"
"Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n"
"Language-Team: Tiramisu's team <egarette@cadoles.com>\n"
@ -34,23 +34,23 @@ msgstr "Ne peut avoir de warnings durant une validation"
msgid "Commands:"
msgstr "Commandes :"
#: tiramisu/api.py:111 tiramisu/api.py:1840
#: tiramisu/api.py:111 tiramisu/api.py:1843
msgid "please specify a valid sub function ({0}.{1})"
msgstr "veuillez spécifier une sous fonction valide ({0}.{1})"
#: tiramisu/api.py:194
#: tiramisu/api.py:196
msgid "please do not specify index ({0}.{1})"
msgstr "veuillez ne pas spécifier d'index ({0}.{1})"
#: tiramisu/api.py:199 tiramisu/api.py:844
#: tiramisu/api.py:201 tiramisu/api.py:847
msgid "please specify index with a follower option ({0}.{1})"
msgstr "veuillez spécifier un index avec une option suiveuse ({0}.{1})"
#: tiramisu/api.py:220
#: tiramisu/api.py:222
msgid "please specify a valid sub function ({0}.{1}): {2}"
msgstr "veuillez spécifier une sous fonction valide ({0}.{1}): {2}"
#: tiramisu/api.py:431
#: tiramisu/api.py:434
msgid ""
"the option {0} is not a dynamic option, cannot get identifiers with "
"only_self parameter to True"
@ -58,15 +58,15 @@ msgstr ""
"l'option {0} n'est pas une option dynamique, ne peut retrouver l'identifiant "
"avec le paramètre only_self à True"
#: tiramisu/api.py:517
#: tiramisu/api.py:520
msgid "cannot get option from a follower symlink without index"
msgstr "ne peut avoir d'option pour une symlink suiveuse sans index"
#: tiramisu/api.py:592
#: tiramisu/api.py:595
msgid "cannot add this property: \"{0}\""
msgstr "ne peut pas ajouter cette propriété : \"{0}\""
#: tiramisu/api.py:619
#: tiramisu/api.py:622
msgid ""
"cannot remove option's property \"{0}\", use permissive instead in option "
"\"{1}\""
@ -74,11 +74,11 @@ msgstr ""
"ne supprimer la propriété \"{0}\" de l'option, utiliser plutôt permissive "
"dans l'option \"{1}\""
#: tiramisu/api.py:623
#: tiramisu/api.py:626
msgid "cannot find \"{0}\" in option \"{1}\""
msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\""
#: tiramisu/api.py:628
#: tiramisu/api.py:631
msgid ""
"cannot remove option's property \"{0}\", use permissive instead in option "
"\"{1}\" at index \"{2}\""
@ -86,39 +86,39 @@ msgstr ""
"ne peut supprimer la propriété \"{0}\" de l'option, utilisez plutôt "
"permissive dans l'option \"{1}\" a l'index \"{2}\""
#: tiramisu/api.py:632
#: tiramisu/api.py:635
msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\""
msgstr "ne peut trouver \"{0}\" dans l'option \"{1}\" à l'index \"{2}\""
#: tiramisu/api.py:676
#: tiramisu/api.py:679
msgid "cannot find \"{0}\""
msgstr "ne peut trouver \"{0}\""
#: tiramisu/api.py:808
#: tiramisu/api.py:811
msgid "cannot reduce length of the leader {}"
msgstr "il est impossible de réduire la longueur du leader \"{}\""
#: tiramisu/api.py:861
#: tiramisu/api.py:864
msgid "only multi value has defaultmulti"
msgstr "seule les valeurs multiple a l'attribut defaultmulti"
#: tiramisu/api.py:1020
#: tiramisu/api.py:1023
msgid "please specify a valid sub function ({0}.{1}) for {2}"
msgstr "veuillez spécifier une sous fonction valide ({0}.{1}) pour {2}"
#: tiramisu/api.py:1407
#: tiramisu/api.py:1410
msgid "properties must be a frozenset"
msgstr "une propriété doit être de type frozenset"
#: tiramisu/api.py:1411 tiramisu/api.py:1438
#: tiramisu/api.py:1414 tiramisu/api.py:1441
msgid "unknown when {} (must be in append or remove)"
msgstr "value {} inconsistent (doit être append ou remove)"
#: tiramisu/api.py:1424 tiramisu/api.py:1448 tiramisu/config.py:1680
#: tiramisu/api.py:1427 tiramisu/api.py:1451 tiramisu/config.py:1681
msgid "unknown type {}"
msgstr "type inconnu {}"
#: tiramisu/api.py:1812
#: tiramisu/api.py:1815
msgid "do not use unrestraint, nowarnings or forcepermissive together"
msgstr ""
"il ne faut pas utiliser unrestraint, nowarnings ou forcepermissive ensemble"
@ -147,6 +147,26 @@ msgstr "param doit avoir un booléan pas un {} pour notraisepropertyerror"
msgid "param must have a boolean not a {} for raisepropertyerror"
msgstr "param doit avoir un booléan pas un {} pour raisepropertyerror"
#: tiramisu/autolib.py:151
msgid "identifiers in ParamDynOption must be a list, not {0}"
msgstr ""
"les identifiants d'un ParamDynOption doivent être une liste, donc pas {0}"
#: tiramisu/autolib.py:155
msgid "optional in ParamDynOption must be a boolean, not {0}"
msgstr ""
"le paramètre optional dans ParamDynOption doit être un booléen, pas {0}"
#: tiramisu/autolib.py:206
msgid "cannot add option in information after creating config"
msgstr ""
"ne peut ajouter une option dans une information après la création de la "
"configuration"
#: tiramisu/autolib.py:208
msgid "cannot redefine option in information"
msgstr "on ne peu pas redéfinir une option dans une information"
#: tiramisu/autolib.py:212
msgid "option in ParamInformation cannot be a symlinkoption"
msgstr "l'option dans ParamInformation ne peut pas être un symlinkoption"
@ -185,7 +205,14 @@ msgstr ""
"l'option {0} n'est pas une dynoptiondescription ou n'est pas dans une "
"dynoptiondescription"
#: tiramisu/autolib.py:848
#: tiramisu/autolib.py:685
msgid ""
"cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\""
msgstr ""
"impossible de calculer les arguments de \"{0}\", la variable dynamic \"{1}\" "
"ne peut être trouvée"
#: tiramisu/autolib.py:864
msgid ""
"the \"{}\" function with positional arguments \"{}\" and keyword arguments "
"\"{}\" must not return a list (\"{}\") for the follower option {}"
@ -194,7 +221,7 @@ msgstr ""
"nommés \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option "
"suiveuse {}"
#: tiramisu/autolib.py:863
#: tiramisu/autolib.py:879
msgid ""
"the \"{}\" function must not return a list (\"{}\") for the follower option "
"{}"
@ -202,7 +229,7 @@ msgstr ""
"la fonction \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option "
"suiveuse {}"
#: tiramisu/autolib.py:904
#: tiramisu/autolib.py:920
msgid ""
"unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and "
"\"{4}\" for option {2}"
@ -210,64 +237,64 @@ msgstr ""
"erreur inattendue \"{0}\" dans la fonction \"{1}\" avec les arguments "
"\"{3}\" et \"{4}\" pour l'option {2}"
#: tiramisu/autolib.py:915
#: tiramisu/autolib.py:931
msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}"
msgstr "erreur inattendue \"{0}\" dans la fonction \"{1}\" pour l'option {2}"
#: tiramisu/config.py:419
#: tiramisu/config.py:420
msgid ""
"index \"{0}\" is greater than the leadership length \"{1}\" for option {2}"
msgstr ""
"l'index \"{0}\" est supérieur à la longueur de la leadership \"{1}\" pour "
"l'option {2}"
#: tiramisu/config.py:579
#: tiramisu/config.py:580
msgid "there is no option description for this config (may be GroupConfig)"
msgstr ""
"il n'y a pas d'option description trouvé pour cette config (peut être un "
"GroupConfig)"
#: tiramisu/config.py:668
#: tiramisu/config.py:669
msgid "no option found in config with these criteria"
msgstr "aucune option trouvée dans la config avec ces critères"
#: tiramisu/config.py:871
#: tiramisu/config.py:872
msgid ""
"the follower option {0} has greater length ({1}) than the leader length ({2})"
msgstr ""
"l'option suiveuse {0} a une longueur supérieur ({1}) à la longueur de "
"l'option leader ({2})"
#: tiramisu/config.py:982 tiramisu/option/optiondescription.py:74
#: tiramisu/config.py:983 tiramisu/option/optiondescription.py:74
msgid "option description seems to be part of an other config"
msgstr "l'option description semble faire parti d'une autre config"
#: tiramisu/config.py:1144
#: tiramisu/config.py:1145
msgid "parent of {0} not already exists"
msgstr "le parent de {0} n'existe plus"
#: tiramisu/config.py:1191
#: tiramisu/config.py:1192
msgid "cannot set leadership object has root optiondescription"
msgstr "ne peut assigner un objet leadership comme optiondescription racine"
#: tiramisu/config.py:1194
#: tiramisu/config.py:1195
msgid "cannot set dynoptiondescription object has root optiondescription"
msgstr ""
"ne peut assigner un objet dynoptiondescription comme optiondescription racine"
#: tiramisu/config.py:1246
#: tiramisu/config.py:1247
msgid "config name must be uniq in groupconfig for \"{0}\""
msgstr "le nom d'un config doit être unique dans un groupconfig pour \"{0}\""
#: tiramisu/config.py:1457
#: tiramisu/config.py:1458
msgid "unknown config \"{}\""
msgstr "config \"{}\" inconnue"
#: tiramisu/config.py:1482
#: tiramisu/config.py:1483
msgid "child must be a Config, MixConfig or MetaConfig"
msgstr "l'enfant doit être une Config, MixConfig ou MetaConfig"
#: tiramisu/config.py:1517
#: tiramisu/config.py:1518
msgid ""
"force_default, force_default_if_same or force_dont_change_value cannot be "
"set with only_config"
@ -275,43 +302,43 @@ msgstr ""
"force_default, force_default_if_same ou force_dont_change_value ne peuvent "
"pas être spécifié avec only_config"
#: tiramisu/config.py:1527
#: tiramisu/config.py:1528
msgid "force_default and force_dont_change_value cannot be set together"
msgstr ""
"force_default et force_dont_change_value ne peuvent pas être mis ensemble"
#: tiramisu/config.py:1676
#: tiramisu/config.py:1677
msgid "config name must be uniq in groupconfig for {0}"
msgstr "le nom de la config doit être unique dans un groupconfig pour {0}"
#: tiramisu/config.py:1721
#: tiramisu/config.py:1722
msgid "config added has no name, the name is mandatory"
msgstr "la config ajoutée n'a pas de nom, le nom est obligatoire"
#: tiramisu/config.py:1726
#: tiramisu/config.py:1727
msgid "config name \"{0}\" is not uniq in groupconfig \"{1}\""
msgstr ""
"le nom d'un config \"{0}\" n'est pas unique dans le groupconfig \"{1}\""
#: tiramisu/config.py:1744 tiramisu/config.py:1750
#: tiramisu/config.py:1745 tiramisu/config.py:1751
msgid "cannot find the config {0}"
msgstr "ne peut pas trouver la config {0}"
#: tiramisu/config.py:1776
#: tiramisu/config.py:1777
msgid "MetaConfig with optiondescription must have string has child, not {}"
msgstr ""
"MetaConfig avec une optiondescription doit avoir un nom comme enfant, pas {}"
#: tiramisu/config.py:1788
#: tiramisu/config.py:1789
msgid "child must be a Config or MetaConfig"
msgstr "enfant doit être une une Config ou une MetaConfig"
#: tiramisu/config.py:1793
#: tiramisu/config.py:1794
msgid "all config in metaconfig must have the same optiondescription"
msgstr ""
"toutes les configs d'une metaconfig doivent avoir la même optiondescription"
#: tiramisu/config.py:1810
#: tiramisu/config.py:1811
msgid "metaconfig must have the same optiondescription"
msgstr "metaconfig doivent avoir la même optiondescription"
@ -576,9 +603,17 @@ msgstr ""
msgid "must starts with \"/\""
msgstr "doit débuter par \"/\""
#: tiramisu/option/filenameoption.py:78
msgid "cannot find {0} \"{1}\""
msgstr "ne peut pas trouver {0} \"{1}\""
#: tiramisu/option/filenameoption.py:77
msgid "directory"
msgstr "répertoire"
#: tiramisu/option/filenameoption.py:77
msgid "file"
msgstr "fichier"
#: tiramisu/option/filenameoption.py:79
msgid "cannot find this {0}"
msgstr "ce {0} est introuvable"
#: tiramisu/option/intoption.py:52
msgid "value should be equal or greater than \"{0}\""
@ -934,6 +969,9 @@ msgstr ""
msgid "information's item not found \"{}\""
msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
#~ msgid "cannot find {0} \"{1}\""
#~ msgstr "ne peut pas trouver {0} \"{1}\""
#~ msgid ""
#~ "IP \"{ip[\"value\"]}\" ({ip[\"name\"]}) with this netmask is in fact a "
#~ "broacast address"
@ -1107,18 +1145,12 @@ msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
#~ msgstr ""
#~ "seuls les caractères en minuscule, les nombres et \"-\" sont recommandés"
#~ msgid "cannot set symlinkoption in a dynoptiondescription"
#~ msgstr "ne peut mettre une symlinkoption dans une dynoptiondescription"
#~ msgid "callback is mandatory for the dynoptiondescription \"{}\""
#~ msgstr "un callback est obligatoire pour le dynoptiondescription \"{}\""
#~ msgid "email address"
#~ msgstr "adresse mail"
#~ msgid "file name"
#~ msgstr "nom de fichier"
#~ msgid "float"
#~ msgstr "nombre flottant"
@ -1191,9 +1223,6 @@ msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
#~ msgid "IP \"{0}\" (\"{1}\") is the broadcast"
#~ msgstr "IP \"{0}\" (\"{1}\") est l'adresse de broadcast"
#~ msgid "unique must be a boolean, not \"{}\""
#~ msgstr "unique doit être un booléan, pas \"{}\""
#~ msgid "unique must be set only with multi value"
#~ msgstr "unique doit être activé uniquement avec une valeur multiple"

View file

@ -5,7 +5,7 @@
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-11-05 08:52+0100\n"
"POT-Creation-Date: 2024-12-15 11:06+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"
@ -35,79 +35,79 @@ msgstr ""
msgid "Commands:"
msgstr ""
#: tiramisu/api.py:111 tiramisu/api.py:1840
#: tiramisu/api.py:111 tiramisu/api.py:1843
msgid "please specify a valid sub function ({0}.{1})"
msgstr ""
#: tiramisu/api.py:194
#: tiramisu/api.py:196
msgid "please do not specify index ({0}.{1})"
msgstr ""
#: tiramisu/api.py:199 tiramisu/api.py:844
#: tiramisu/api.py:201 tiramisu/api.py:847
msgid "please specify index with a follower option ({0}.{1})"
msgstr ""
#: tiramisu/api.py:220
#: tiramisu/api.py:222
msgid "please specify a valid sub function ({0}.{1}): {2}"
msgstr ""
#: tiramisu/api.py:431
#: tiramisu/api.py:434
msgid "the option {0} is not a dynamic option, cannot get identifiers with only_self parameter to True"
msgstr ""
#: tiramisu/api.py:517
#: tiramisu/api.py:520
msgid "cannot get option from a follower symlink without index"
msgstr ""
#: tiramisu/api.py:592
#: tiramisu/api.py:595
msgid "cannot add this property: \"{0}\""
msgstr ""
#: tiramisu/api.py:619
#: tiramisu/api.py:622
msgid "cannot remove option's property \"{0}\", use permissive instead in option \"{1}\""
msgstr ""
#: tiramisu/api.py:623
#: tiramisu/api.py:626
msgid "cannot find \"{0}\" in option \"{1}\""
msgstr ""
#: tiramisu/api.py:628
#: tiramisu/api.py:631
msgid "cannot remove option's property \"{0}\", use permissive instead in option \"{1}\" at index \"{2}\""
msgstr ""
#: tiramisu/api.py:632
#: tiramisu/api.py:635
msgid "cannot find \"{0}\" in option \"{1}\" at index \"{2}\""
msgstr ""
#: tiramisu/api.py:676
#: tiramisu/api.py:679
msgid "cannot find \"{0}\""
msgstr ""
#: tiramisu/api.py:808
#: tiramisu/api.py:811
msgid "cannot reduce length of the leader {}"
msgstr ""
#: tiramisu/api.py:861
#: tiramisu/api.py:864
msgid "only multi value has defaultmulti"
msgstr ""
#: tiramisu/api.py:1020
#: tiramisu/api.py:1023
msgid "please specify a valid sub function ({0}.{1}) for {2}"
msgstr ""
#: tiramisu/api.py:1407
#: tiramisu/api.py:1410
msgid "properties must be a frozenset"
msgstr ""
#: tiramisu/api.py:1411 tiramisu/api.py:1438
#: tiramisu/api.py:1414 tiramisu/api.py:1441
msgid "unknown when {} (must be in append or remove)"
msgstr ""
#: tiramisu/api.py:1424 tiramisu/api.py:1448 tiramisu/config.py:1680
#: tiramisu/api.py:1427 tiramisu/api.py:1451 tiramisu/config.py:1681
msgid "unknown type {}"
msgstr ""
#: tiramisu/api.py:1812
#: tiramisu/api.py:1815
msgid "do not use unrestraint, nowarnings or forcepermissive together"
msgstr ""
@ -135,6 +135,22 @@ msgstr ""
msgid "param must have a boolean not a {} for raisepropertyerror"
msgstr ""
#: tiramisu/autolib.py:151
msgid "identifiers in ParamDynOption must be a list, not {0}"
msgstr ""
#: tiramisu/autolib.py:155
msgid "optional in ParamDynOption must be a boolean, not {0}"
msgstr ""
#: tiramisu/autolib.py:206
msgid "cannot add option in information after creating config"
msgstr ""
#: tiramisu/autolib.py:208
msgid "cannot redefine option in information"
msgstr ""
#: tiramisu/autolib.py:212
msgid "option in ParamInformation cannot be a symlinkoption"
msgstr ""
@ -171,103 +187,107 @@ msgstr ""
msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription"
msgstr ""
#: tiramisu/autolib.py:848
#: tiramisu/autolib.py:685
msgid "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\""
msgstr ""
#: tiramisu/autolib.py:864
msgid "the \"{}\" function with positional arguments \"{}\" and keyword arguments \"{}\" must not return a list (\"{}\") for the follower option {}"
msgstr ""
#: tiramisu/autolib.py:863
#: tiramisu/autolib.py:879
msgid "the \"{}\" function must not return a list (\"{}\") for the follower option {}"
msgstr ""
#: tiramisu/autolib.py:904
#: tiramisu/autolib.py:920
msgid "unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and \"{4}\" for option {2}"
msgstr ""
#: tiramisu/autolib.py:915
#: tiramisu/autolib.py:931
msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}"
msgstr ""
#: tiramisu/config.py:419
#: tiramisu/config.py:420
msgid "index \"{0}\" is greater than the leadership length \"{1}\" for option {2}"
msgstr ""
#: tiramisu/config.py:579
#: tiramisu/config.py:580
msgid "there is no option description for this config (may be GroupConfig)"
msgstr ""
#: tiramisu/config.py:668
#: tiramisu/config.py:669
msgid "no option found in config with these criteria"
msgstr ""
#: tiramisu/config.py:871
#: tiramisu/config.py:872
msgid "the follower option {0} has greater length ({1}) than the leader length ({2})"
msgstr ""
#: tiramisu/config.py:982 tiramisu/option/optiondescription.py:74
#: tiramisu/config.py:983 tiramisu/option/optiondescription.py:74
msgid "option description seems to be part of an other config"
msgstr ""
#: tiramisu/config.py:1144
#: tiramisu/config.py:1145
msgid "parent of {0} not already exists"
msgstr ""
#: tiramisu/config.py:1191
#: tiramisu/config.py:1192
msgid "cannot set leadership object has root optiondescription"
msgstr ""
#: tiramisu/config.py:1194
#: tiramisu/config.py:1195
msgid "cannot set dynoptiondescription object has root optiondescription"
msgstr ""
#: tiramisu/config.py:1246
#: tiramisu/config.py:1247
msgid "config name must be uniq in groupconfig for \"{0}\""
msgstr ""
#: tiramisu/config.py:1457
#: tiramisu/config.py:1458
msgid "unknown config \"{}\""
msgstr ""
#: tiramisu/config.py:1482
#: tiramisu/config.py:1483
msgid "child must be a Config, MixConfig or MetaConfig"
msgstr ""
#: tiramisu/config.py:1517
#: tiramisu/config.py:1518
msgid "force_default, force_default_if_same or force_dont_change_value cannot be set with only_config"
msgstr ""
#: tiramisu/config.py:1527
#: tiramisu/config.py:1528
msgid "force_default and force_dont_change_value cannot be set together"
msgstr ""
#: tiramisu/config.py:1676
#: tiramisu/config.py:1677
msgid "config name must be uniq in groupconfig for {0}"
msgstr ""
#: tiramisu/config.py:1721
#: tiramisu/config.py:1722
msgid "config added has no name, the name is mandatory"
msgstr ""
#: tiramisu/config.py:1726
#: tiramisu/config.py:1727
msgid "config name \"{0}\" is not uniq in groupconfig \"{1}\""
msgstr ""
#: tiramisu/config.py:1744 tiramisu/config.py:1750
#: tiramisu/config.py:1745 tiramisu/config.py:1751
msgid "cannot find the config {0}"
msgstr ""
#: tiramisu/config.py:1776
#: tiramisu/config.py:1777
msgid "MetaConfig with optiondescription must have string has child, not {}"
msgstr ""
#: tiramisu/config.py:1788
#: tiramisu/config.py:1789
msgid "child must be a Config or MetaConfig"
msgstr ""
#: tiramisu/config.py:1793
#: tiramisu/config.py:1794
msgid "all config in metaconfig must have the same optiondescription"
msgstr ""
#: tiramisu/config.py:1810
#: tiramisu/config.py:1811
msgid "metaconfig must have the same optiondescription"
msgstr ""
@ -500,8 +520,16 @@ msgstr ""
msgid "must starts with \"/\""
msgstr ""
#: tiramisu/option/filenameoption.py:78
msgid "cannot find {0} \"{1}\""
#: tiramisu/option/filenameoption.py:77
msgid "directory"
msgstr ""
#: tiramisu/option/filenameoption.py:77
msgid "file"
msgstr ""
#: tiramisu/option/filenameoption.py:79
msgid "cannot find this {0}"
msgstr ""
#: tiramisu/option/intoption.py:52

View file

@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
[project]
name = "tiramisu"
version = "5.1.0"
version = "5.2.0a0"
authors = [{name = "Emmanuel Garette", email = "gnunux@gnunux.info"}]
readme = "README.md"
description = "an options controller tool"

View file

@ -432,6 +432,20 @@ def test_callback_dyndescription_outside3():
assert parse_od_get(cfg.value.get()) == {'od.out': 'val1', 'lst': ['val1', 'val2']}
def test_callback_dyndescription_outside_optional():
lst = StrOption('lst', '', ['val'], multi=True)
st = StrOption('st', '', 'val')
dod = DynOptionDescription('dod', '', [st], identifiers=Calculation(return_list, Params(ParamOption(lst))))
out = StrOption('out', '', Calculation(calc_value, Params(ParamDynOption(st, ['unknown_val'], optional=True))))
od = OptionDescription('od', '', [dod, out])
od2 = OptionDescription('od', '', [od, lst])
cfg = Config(od2)
assert parse_od_get(cfg.value.get()) == {'od.dodval.st': 'val', 'od.out': None, 'lst': ['val']}
cfg.option('lst').value.set(['val', 'unknown_val'])
assert parse_od_get(cfg.value.get()) == {'od.dodval.st': 'val', 'od.dodunknown_val.st': 'val', 'od.out': 'val', 'lst': ['val', 'unknown_val']}
# assert not list_sessions()
def test_callback_dyndescription_subdyn():
lst = StrOption('lst', '', ['val1', 'val2'], multi=True)
st = StrOption('st', '', 'val1')

View file

@ -28,6 +28,8 @@ def test_symlink_option(config_type):
assert cfg.option('c').issymlinkoption()
assert cfg.option('s1.b').type() == 'boolean'
assert cfg.option('c').type() == 'boolean'
assert cfg.option('s1.b').type(only_self=True) == 'boolean'
assert cfg.option('c').type(only_self=True) == 'symlink'
assert cfg.option('s1.b').value.get() is False
cfg.option("s1.b").value.set(True)
cfg.option("s1.b").value.set(False)

View file

@ -139,6 +139,8 @@ def option_type(typ):
@wraps(func)
def wrapped(*args, **kwargs):
self = args[0]
if isinstance(typ, list) and "allow_dynoption" in typ:
self._allow_dynoption = True
config_bag = self._config_bag
if self._config_bag.context.impl_type == "group" and "group" in types:
options_bag = [
@ -269,10 +271,9 @@ class _TiramisuOptionWalk:
class _TiramisuOptionOptionDescription:
"""Manage option"""
_validate_properties = False
@option_type(["optiondescription", "option", "with_or_without_index", "symlink"])
@option_type(["optiondescription", "option", "with_or_without_index", "symlink", "allow_dynoption"])
def get(self):
"""Get Tiramisu option"""
return self._subconfig.option
@ -347,11 +348,13 @@ class _TiramisuOptionOptionDescription:
return options
@option_type(["option", "optiondescription", "symlink", "with_or_without_index"])
def type(self):
def type(self, only_self=False):
"""Get de option type"""
option = self._subconfig.option
if option.impl_is_optiondescription():
return "optiondescription"
if only_self and option.impl_is_symlinkoption():
return 'symlink'
return option.get_type()
@option_type(["option", "symlink", "with_or_without_index"])
@ -1527,7 +1530,7 @@ class TiramisuContextOption(TiramisuConfig, _TiramisuOptionWalk):
def get(self):
"""Get Tiramisu option"""
return None
return self._config_bag.context.get_description()
def isleadership(self):
"""Test if option is a leader or a follower"""

View file

@ -22,7 +22,7 @@ from typing import Any, Optional, Union, Callable, Dict, List
from itertools import chain
import weakref
from .error import PropertiesOptionError, ConfigError, LeadershipError, ValueWarning
from .error import PropertiesOptionError, ConfigError, LeadershipError, ValueWarning, CancelParam
from .i18n import _
from .setting import undefined, ConfigBag
from .function import FUNCTION_WAITING_FOR_DICT, FUNCTION_WAITING_FOR_ERROR
@ -148,11 +148,11 @@ class ParamDynOption(ParamOption):
)
if not isinstance(identifiers, list):
raise Exception(
f"identifiers in ParamDynOption must be a list, not {identifiers}"
_("identifiers in ParamDynOption must be a list, not {0}").format(identifiers)
)
if not isinstance(optional, bool):
raise Exception(
f"optional in ParamDynOption must be a boolean, not {optional}"
_("optional in ParamDynOption must be a boolean, not {0}").format(optional)
)
self.identifiers = identifiers
self.optional = optional
@ -203,9 +203,9 @@ class ParamInformation(Param):
def set_option(self, option: "Option" = None) -> None:
if not hasattr(self, "self_option"):
raise ConfigError("cannot add option in information after creating config")
raise ConfigError(_("cannot add option in information after creating config"))
if self.option:
raise ConfigError("cannot redefine option in information")
raise ConfigError(_("cannot redefine option in information"))
if not option.impl_is_optiondescription():
if option.impl_is_symlinkoption():
raise ValueError(
@ -464,7 +464,7 @@ def manager_callback(
) from err
except AttributeError as err:
if isinstance(param, ParamDynOption) and param.optional:
# cannot acces, simulate a propertyerror
# cannot access, simulate a propertyerror
raise PropertiesOptionError(
subconfig,
["configerror"],
@ -524,7 +524,7 @@ def manager_callback(
) from err
except AttributeError as err:
if isinstance(param, ParamDynOption) and param.optional:
# cannot acces, simulate a propertyerror
# cannot access, simulate a propertyerror
raise PropertiesOptionError(
param,
["configerror"],
@ -602,6 +602,9 @@ def manager_callback(
"option {0} is not a dynoptiondescription or in a dynoptiondescription"
).format(display_name)
)
if subconfig.identifiers is None:
# if uncalculated
return
return subconfig.identifiers[param.identifier_index]
if isinstance(param, ParamSelfOption):
@ -673,7 +676,14 @@ def manager_callback(
parent,
)
except AttributeError as err:
raise ConfigError(err) from err
if parent.path:
child_path = parent.path + '.' + name
else:
child_path = name
if param.optional:
raise CancelParam(callbk_option.impl_getpath(), child_path)
msg = _('cannot calculate arguments for "{0}", cannot find dynamic variable "{1}"').format(subconfig.path, child_path)
raise ConfigError(msg) from err
new_parents.append(
parent.get_child(
doption,
@ -828,6 +838,12 @@ def carry_out_calculation(
args.append(err)
else:
kwargs[key] = err
except CancelParam as err:
if callback.__name__ in FUNCTION_WAITING_FOR_ERROR:
if key is None:
args.append(err)
else:
kwargs[key] = err
ret = calculate(
subconfig,
callback,
@ -893,7 +909,7 @@ def calculate(
except (ValueError, ValueWarning) as err:
if allow_value_error:
if force_value_warning:
raise ValueWarning(str(err))
raise ValueWarning(msg=str(err))
raise err from err
error = err
except ConfigError as err:

View file

@ -227,7 +227,8 @@ class SubConfig:
identifiers: Optional[list[str]],
*,
true_path: Optional[str] = None,
properties: Union[list[str], undefined] = undefined,
# for python 3.9 properties: Union[list[str], undefined] = undefined,
properties = undefined,
validate_properties: bool = True,
) -> None:
self.index = index

View file

@ -181,7 +181,7 @@ class _CommonError:
try:
msg = self.prefix
except AttributeError:
self.prefix = self.tmpl.format(self.val, _(self.display_type), self.name)
self.prefix = self.tmpl.format(self.val, _(self.display_type), self.name, self.index)
msg = self.prefix
if self.err_msg:
if msg:
@ -196,13 +196,16 @@ class _CommonError:
class ValueWarning(_CommonError, UserWarning):
tmpl = None
def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
if ValueWarning.tmpl is None:
if kwargs.get('index') is None:
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}"')
if len(args) == 1 and not kwargs:
self.msg = args[0]
else:
super().__init__(*args, **kwargs)
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}" at index "{3}"')
if list(kwargs) == ['msg']:
self.msg = kwargs['msg']
else:
super().__init__(**kwargs)
self.msg = None
def __str__(self):
@ -214,10 +217,13 @@ class ValueWarning(_CommonError, UserWarning):
class ValueOptionError(_CommonError, ValueError):
tmpl = None
def __init__(self, *args, **kwargs):
def __init__(self, **kwargs):
if ValueOptionError.tmpl is None:
if kwargs.get('index') is None:
ValueOptionError.tmpl = _('"{0}" is an invalid {1} for "{2}"')
super().__init__(*args, **kwargs)
else:
ValueOptionError.tmpl = _('"{0}" is an invalid {1} for "{2}" at index "{3}"')
super().__init__(**kwargs)
class ValueErrorWarning(ValueWarning):
@ -227,3 +233,10 @@ class ValueErrorWarning(ValueWarning):
if ValueErrorWarning.tmpl is None:
ValueErrorWarning.tmpl = _('"{0}" is an invalid {1} for "{2}"')
super().__init__(*args, **kwargs)
class CancelParam(Exception):
def __init__(self, origin_path, current_path):
super().__init__()
self.origin_path = origin_path
self.current_path = current_path

View file

@ -76,14 +76,20 @@ class DomainnameOption(StrOption):
regexp = r"((?!-)[a-z0-9-]{{{1},{0}}}\.){{{1},}}[a-z0-9-]{{1,{0}}}".format(
self._get_len(type), min_time
)
else:
regexp = r"((?!-)[a-z0-9-]{{1,{0}}})".format(self._get_len(type))
msg = _(
'must start with lowercase characters followed by lowercase characters, number, "-" and "." characters are allowed'
)
msg_warning = _(
'must start with lowercase characters followed by lowercase characters, number, "-" and "." characters are recommanded'
)
else:
regexp = r"((?!-)[a-z0-9-]{{1,{0}}})".format(self._get_len(type))
msg = _(
'must start with lowercase characters followed by lowercase characters, number and "-" characters are allowed'
)
msg_warning = _(
'must start with lowercase characters followed by lowercase characters, number and "-" characters are recommanded'
)
if allow_ip:
msg = _("could be a IP, otherwise {}").format(msg)
msg_warning = _("could be a IP, otherwise {}").format(msg_warning)

View file

@ -74,8 +74,9 @@ class FilenameOption(StrOption):
if not found and "directory" in types and file.is_dir():
found = True
if not found:
translated_types = [{"file": _("file"), "directory": _("directory")}.get(typ) for typ in types]
raise ValueError(
_('cannot find {0} "{1}"').format(
display_list(types, separator="or"), value
_('cannot find this {0}').format(
display_list(translated_types, separator="or"), value
)
)

View file

@ -127,11 +127,6 @@ class Option(BaseOption):
def test_multi_value(value):
if isinstance(value, Calculation):
return
# option_bag = OptionBag(self,
# None,
# undefined,
# properties=None,
# )
try:
self.validate(value)
self.validate_with_option(
@ -329,12 +324,12 @@ class Option(BaseOption):
except ValueWarning as warn:
warnings.warn_explicit(
ValueWarning(
subconfig,
val,
_(self.get_type()),
self,
str(warn),
_index,
subconfig=subconfig,
val=val,
display_type=_(self.get_type()),
opt=self,
err_msg=str(warn),
index=_index,
),
ValueWarning,
self.__class__.__name__,
@ -370,12 +365,12 @@ class Option(BaseOption):
if is_warnings_only:
warnings.warn_explicit(
ValueWarning(
subconfig,
_value,
_(self.get_type()),
self,
str(err),
_index,
subconfig=subconfig,
val=_value,
display_type=_(self.get_type()),
opt=self,
err_msg=str(err),
index=_index,
),
ValueWarning,
self.__class__.__name__,
@ -442,11 +437,11 @@ class Option(BaseOption):
or "demoting_error_warning" not in subconfig.config_bag.properties
):
raise ValueOptionError(
subconfig, val, _(self.get_type()), self, str(err), err_index
subconfig=subconfig, val=val, display_type=_(self.get_type()), opt=self, err_msg=str(err), index=err_index
) from err
warnings.warn_explicit(
ValueErrorWarning(
subconfig, val, _(self.get_type()), self, str(err), err_index
subconfig=subconfig, val=val, display_type=_(self.get_type()), opt=self, err_msg=str(err), index=err_index
),
ValueErrorWarning,
self.__class__.__name__,

View file

@ -38,7 +38,7 @@ class StrOption(Option):
) -> None:
"""validation"""
if not isinstance(value, str):
raise ValueError()
raise ValueError(_('which is not a string'))
class RegexpOption(StrOption):