Compare commits

...

4 commits

7 changed files with 148 additions and 156 deletions

View file

@ -2,7 +2,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Tiramisu\n" "Project-Id-Version: Tiramisu\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2025-04-09 08:14+0200\n" "POT-Creation-Date: 2025-04-29 23:01+0200\n"
"PO-Revision-Date: \n" "PO-Revision-Date: \n"
"Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n" "Last-Translator: Emmanuel Garette <egarette@cadoles.com>\n"
"Language-Team: Tiramisu's team <egarette@cadoles.com>\n" "Language-Team: Tiramisu's team <egarette@cadoles.com>\n"
@ -123,89 +123,93 @@ msgid "do not use unrestraint, nowarnings or forcepermissive together"
msgstr "" msgstr ""
"il ne faut pas utiliser unrestraint, nowarnings ou forcepermissive ensemble" "il ne faut pas utiliser unrestraint, nowarnings ou forcepermissive ensemble"
#: tiramisu/autolib.py:80 #: tiramisu/autolib.py:81
msgid "args in params must be a tuple" msgid "args in params must be a tuple"
msgstr "args dans params doit être un tuple" msgstr "args dans params doit être un tuple"
#: tiramisu/autolib.py:83 tiramisu/autolib.py:88 #: tiramisu/autolib.py:84 tiramisu/autolib.py:89
msgid "arg in params must be a Param" msgid "arg in params must be a Param"
msgstr "arg dans params doit être un Param" msgstr "arg dans params doit être un Param"
#: tiramisu/autolib.py:85 #: tiramisu/autolib.py:86
msgid "kwargs in params must be a dict" msgid "kwargs in params must be a dict"
msgstr "kwargs dans params doit être un dict" msgstr "kwargs dans params doit être un dict"
#: tiramisu/autolib.py:113 #: tiramisu/autolib.py:114
msgid "paramoption needs an option not {}" msgid "paramoption needs an option not {}"
msgstr "paramoption doit être une option pas {0}" msgstr "paramoption doit être une option pas {0}"
#: tiramisu/autolib.py:119 #: tiramisu/autolib.py:120
msgid "param must have a boolean not a {} for notraisepropertyerror" msgid "param must have a boolean not a {} for notraisepropertyerror"
msgstr "param doit avoir un booléan pas un {} pour notraisepropertyerror" msgstr "param doit avoir un booléan pas un {} pour notraisepropertyerror"
#: tiramisu/autolib.py:122 #: tiramisu/autolib.py:123
msgid "param must have a boolean not a {} for raisepropertyerror" msgid "param must have a boolean not a {} for raisepropertyerror"
msgstr "param doit avoir un booléan pas un {} pour raisepropertyerror" msgstr "param doit avoir un booléan pas un {} pour raisepropertyerror"
#: tiramisu/autolib.py:151 #: tiramisu/autolib.py:152
msgid "identifiers in ParamDynOption must be a list, not {0}" msgid "identifiers in ParamDynOption must be a list, not {0}"
msgstr "" msgstr ""
"les identifiants d'un ParamDynOption doivent être une liste, donc pas {0}" "les identifiants d'un ParamDynOption doivent être une liste, donc pas {0}"
#: tiramisu/autolib.py:155 #: tiramisu/autolib.py:156
msgid "optional in ParamDynOption must be a boolean, not {0}" msgid "optional in ParamDynOption must be a boolean, not {0}"
msgstr "" msgstr ""
"le paramètre optional dans ParamDynOption doit être un booléen, pas {0}" "le paramètre optional dans ParamDynOption doit être un booléen, pas {0}"
#: tiramisu/autolib.py:206 #: tiramisu/autolib.py:207
msgid "cannot add option in information after creating config" msgid "cannot add option in information after creating config"
msgstr "" msgstr ""
"ne peut ajouter une option dans une information après la création de la " "ne peut ajouter une option dans une information après la création de la "
"configuration" "configuration"
#: tiramisu/autolib.py:208 #: tiramisu/autolib.py:209
msgid "cannot redefine option in information" msgid "cannot redefine option in information"
msgstr "on ne peu pas redéfinir une option dans une information" msgstr "on ne peu pas redéfinir une option dans une information"
#: tiramisu/autolib.py:212 #: tiramisu/autolib.py:213
msgid "option in ParamInformation cannot be a symlinkoption" msgid "option in ParamInformation cannot be a symlinkoption"
msgstr "l'option dans ParamInformation ne peut pas être un symlinkoption" msgstr "l'option dans ParamInformation ne peut pas être un symlinkoption"
#: tiramisu/autolib.py:215 #: tiramisu/autolib.py:216
msgid "option in ParamInformation cannot be a follower" msgid "option in ParamInformation cannot be a follower"
msgstr "l'option dans ParamInformation ne peut pas être suiveuse" msgstr "l'option dans ParamInformation ne peut pas être suiveuse"
#: tiramisu/autolib.py:218 #: tiramisu/autolib.py:219
msgid "option in ParamInformation cannot be a dynamic option" msgid "option in ParamInformation cannot be a dynamic option"
msgstr "l'option dans ParamInformation ne peut pas être une option dynamique" msgstr "l'option dans ParamInformation ne peut pas être une option dynamique"
#: tiramisu/autolib.py:279 #: tiramisu/autolib.py:280
msgid "first argument ({0}) must be a function" msgid "first argument ({0}) must be a function"
msgstr "le premier argument ({0}) doit être une fonction" msgstr "le premier argument ({0}) doit être une fonction"
#: tiramisu/autolib.py:283 #: tiramisu/autolib.py:284
msgid "help_function ({0}) must be a function" msgid "help_function ({0}) must be a function"
msgstr "help_function ({0}) doit être une fonction" msgstr "help_function ({0}) doit être une fonction"
#: tiramisu/autolib.py:452 tiramisu/autolib.py:514 #: tiramisu/autolib.py:455 tiramisu/autolib.py:503
msgid "unable to carry out a calculation for {}, {}"
msgstr "impossible d'effectuer le calcul pour {}, {}"
#: tiramisu/autolib.py:461 tiramisu/autolib.py:521
msgid "the option {0} is used in a calculation but is invalid ({1})" msgid "the option {0} is used in a calculation but is invalid ({1})"
msgstr "l'option {0} est utilisé dans un calcul mais est invalide ({1})" msgstr "l'option {0} est utilisé dans un calcul mais est invalide ({1})"
#: tiramisu/autolib.py:477 tiramisu/autolib.py:535 tiramisu/autolib.py:584 #: tiramisu/autolib.py:467 tiramisu/autolib.py:515 tiramisu/autolib.py:554
msgid "unable to get value for calculating {0}, {1}" msgid "unable to get value for calculating {0}, {1}"
msgstr "impossible de trouver la valeur pour calculer {0}, {1}" msgstr "impossible de trouver la valeur pour calculer {0}, {1}"
#: tiramisu/autolib.py:601 #: tiramisu/autolib.py:499
msgid "unable to carry out a calculation for {0}, {1}"
msgstr "impossible d'effectuer le calcul pour {0}, {1}"
#: tiramisu/autolib.py:535
msgid "cannot find information for {0}, {1} is a dynamic option"
msgstr "ne peut trouver l'information pour {0}, {1} est une option dynamique"
#: tiramisu/autolib.py:564
msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription" msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription"
msgstr "" msgstr ""
"l'option {0} n'est pas une dynoptiondescription ou n'est pas dans une " "l'option {0} n'est pas une dynoptiondescription ou n'est pas dans une "
"dynoptiondescription" "dynoptiondescription"
#: tiramisu/autolib.py:687 #: tiramisu/autolib.py:650
msgid "" msgid ""
"cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\" " "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\" "
"with identifier \"{2}\", list of valid identifiers: {3}" "with identifier \"{2}\", list of valid identifiers: {3}"
@ -214,7 +218,12 @@ msgstr ""
"dynamique \"{1}\" avec l'identifiant \"{2}\", voici la liste des " "dynamique \"{1}\" avec l'identifiant \"{2}\", voici la liste des "
"identifiants valables : {3}" "identifiants valables : {3}"
#: tiramisu/autolib.py:866 #: tiramisu/autolib.py:754
msgid "the follower {0} must have index in carry_out_calculation!"
msgstr ""
"la variable suiveuse {0} doit avoir un index dans carry_out_calculation!"
#: tiramisu/autolib.py:826
msgid "" msgid ""
"the \"{}\" function with positional arguments \"{}\" and keyword arguments " "the \"{}\" function with positional arguments \"{}\" and keyword arguments "
"\"{}\" must not return a list (\"{}\") for the follower option {}" "\"{}\" must not return a list (\"{}\") for the follower option {}"
@ -223,7 +232,7 @@ msgstr ""
"nommés \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option " "nommés \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option "
"suiveuse {}" "suiveuse {}"
#: tiramisu/autolib.py:881 #: tiramisu/autolib.py:841
msgid "" msgid ""
"the \"{}\" function must not return a list (\"{}\") for the follower option " "the \"{}\" function must not return a list (\"{}\") for the follower option "
"{}" "{}"
@ -231,17 +240,17 @@ msgstr ""
"la fonction \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option " "la fonction \"{}\" ne doit pas retourner une liste (\"{}\") pour l'option "
"suiveuse {}" "suiveuse {}"
#: tiramisu/autolib.py:922 #: tiramisu/autolib.py:882
msgid "" msgid ""
"unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and " "unexpected error \"{1}\" in function \"{2}\" with arguments \"{3}\" and "
"\"{4}\" for option {2}" "\"{4}\" for option {0}"
msgstr "" msgstr ""
"erreur inattendue \"{0}\" dans la fonction \"{1}\" avec les arguments " "erreur inattendue \"{1}\" dans la fonction \"{2}\" avec les arguments "
"\"{3}\" et \"{4}\" pour l'option {2}" "\"{3}\" et \"{4}\" pour l'option {0}"
#: tiramisu/autolib.py:933 #: tiramisu/autolib.py:891
msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}" msgid "unexpected error \"{1}\" in function \"{2}\" for option {0}"
msgstr "erreur inattendue \"{0}\" dans la fonction \"{1}\" pour l'option {2}" msgstr "erreur inattendue \"{1}\" dans la fonction \"{2}\" pour l'option {0}"
#: tiramisu/config.py:420 #: tiramisu/config.py:420
msgid "" msgid ""
@ -393,21 +402,21 @@ msgid "invalid value"
msgstr "valeur invalide" msgstr "valeur invalide"
#: tiramisu/error.py:207 #: tiramisu/error.py:207
msgid "attention, \"{0}\" could be an invalid {1} for \"{2}\"" msgid "attention, \"{0}\" could be an invalid {1} for {2}"
msgstr "attention, \"{0}\" peut être un {1} invalide pour \"{2}\"" msgstr "attention, \"{0}\" peut être un {1} invalide pour {2}"
#: tiramisu/error.py:209 #: tiramisu/error.py:209
msgid "attention, \"{0}\" could be an invalid {1} for \"{2}\" at index \"{3}\"" msgid "attention, \"{0}\" could be an invalid {1} for {2} at index \"{3}\""
msgstr "" msgstr ""
"attention, \"{0}\" peut être un {1} invalide pour \"{2}\" à l'index \"{3}\"" "attention, \"{0}\" peut être un {1} invalide pour {2} à l'index \"{3}\""
#: tiramisu/error.py:228 tiramisu/error.py:239 #: tiramisu/error.py:228 tiramisu/error.py:239
msgid "\"{0}\" is an invalid {1} for \"{2}\"" msgid "\"{0}\" is an invalid {1} for {2}"
msgstr "\"{0}\" est une valeur invalide pour l'option \"{2}\" de type {1}" msgstr "\"{0}\" est une valeur invalide pour l'option {2} de type {1}"
#: tiramisu/error.py:230 #: tiramisu/error.py:230
msgid "\"{0}\" is an invalid {1} for \"{2}\" at index \"{3}\"" msgid "\"{0}\" is an invalid {1} for {2} at index \"{3}\""
msgstr "\"{0}\" est un {1} invalide pour \"{2}\" à l'index \"{3}\"" msgstr "\"{0}\" est un {1} invalide pour {2} à l'index \"{3}\""
#: tiramisu/function.py:65 #: tiramisu/function.py:65
msgid "network \"{0}\" ({1}) does not match with this netmask" msgid "network \"{0}\" ({1}) does not match with this netmask"
@ -730,10 +739,10 @@ msgstr "une option leadership \"{0}\" ne devrait pas avoir de sous-groupe"
#: tiramisu/option/leadership.py:114 #: tiramisu/option/leadership.py:114
msgid "" msgid ""
"only multi option allowed in leadership {0} but option {1} is not a multi" "only multi option are allowed in leadership {0} but option {1} is not a multi"
msgstr "" msgstr ""
"seules des options multiples sont autorisées dans l'option leadership " "seules des options multiples sont autorisées dans l'option leadership {0} "
"\"{0}\" alors que l'option \"{1}\" n'est pas une option multiple" "alors que l'option {1} n'est pas une option multiple"
#: tiramisu/option/leadership.py:141 #: tiramisu/option/leadership.py:141
msgid "not allowed default value for follower option {0} in leadership {1}" msgid "not allowed default value for follower option {0} in leadership {1}"
@ -1021,6 +1030,9 @@ msgstr ""
msgid "information's item not found \"{}\"" msgid "information's item not found \"{}\""
msgstr "l'information de l'objet ne sont pas trouvé \"{}\"" msgstr "l'information de l'objet ne sont pas trouvé \"{}\""
#~ msgid "unable to unable to get value for calculating {0}, {1}"
#~ msgstr "impossible de trouver la valeur pour calculer {0}, {1}"
#~ msgid "" #~ msgid ""
#~ "unknown option \"{0}\" in root optiondescription (it's a dynamic option)" #~ "unknown option \"{0}\" in root optiondescription (it's a dynamic option)"
#~ 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-04-09 08:16+0200\n" "POT-Creation-Date: 2025-04-29 23:01+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"
@ -111,100 +111,108 @@ msgstr ""
msgid "do not use unrestraint, nowarnings or forcepermissive together" msgid "do not use unrestraint, nowarnings or forcepermissive together"
msgstr "" msgstr ""
#: tiramisu/autolib.py:80 #: tiramisu/autolib.py:81
msgid "args in params must be a tuple" msgid "args in params must be a tuple"
msgstr "" msgstr ""
#: tiramisu/autolib.py:83 tiramisu/autolib.py:88 #: tiramisu/autolib.py:84 tiramisu/autolib.py:89
msgid "arg in params must be a Param" msgid "arg in params must be a Param"
msgstr "" msgstr ""
#: tiramisu/autolib.py:85 #: tiramisu/autolib.py:86
msgid "kwargs in params must be a dict" msgid "kwargs in params must be a dict"
msgstr "" msgstr ""
#: tiramisu/autolib.py:113 #: tiramisu/autolib.py:114
msgid "paramoption needs an option not {}" msgid "paramoption needs an option not {}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:119 #: tiramisu/autolib.py:120
msgid "param must have a boolean not a {} for notraisepropertyerror" msgid "param must have a boolean not a {} for notraisepropertyerror"
msgstr "" msgstr ""
#: tiramisu/autolib.py:122 #: tiramisu/autolib.py:123
msgid "param must have a boolean not a {} for raisepropertyerror" msgid "param must have a boolean not a {} for raisepropertyerror"
msgstr "" msgstr ""
#: tiramisu/autolib.py:151 #: tiramisu/autolib.py:152
msgid "identifiers in ParamDynOption must be a list, not {0}" msgid "identifiers in ParamDynOption must be a list, not {0}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:155 #: tiramisu/autolib.py:156
msgid "optional in ParamDynOption must be a boolean, not {0}" msgid "optional in ParamDynOption must be a boolean, not {0}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:206 #: tiramisu/autolib.py:207
msgid "cannot add option in information after creating config" msgid "cannot add option in information after creating config"
msgstr "" msgstr ""
#: tiramisu/autolib.py:208 #: tiramisu/autolib.py:209
msgid "cannot redefine option in information" msgid "cannot redefine option in information"
msgstr "" msgstr ""
#: tiramisu/autolib.py:212 #: tiramisu/autolib.py:213
msgid "option in ParamInformation cannot be a symlinkoption" msgid "option in ParamInformation cannot be a symlinkoption"
msgstr "" msgstr ""
#: tiramisu/autolib.py:215 #: tiramisu/autolib.py:216
msgid "option in ParamInformation cannot be a follower" msgid "option in ParamInformation cannot be a follower"
msgstr "" msgstr ""
#: tiramisu/autolib.py:218 #: tiramisu/autolib.py:219
msgid "option in ParamInformation cannot be a dynamic option" msgid "option in ParamInformation cannot be a dynamic option"
msgstr "" msgstr ""
#: tiramisu/autolib.py:279 #: tiramisu/autolib.py:280
msgid "first argument ({0}) must be a function" msgid "first argument ({0}) must be a function"
msgstr "" msgstr ""
#: tiramisu/autolib.py:283 #: tiramisu/autolib.py:284
msgid "help_function ({0}) must be a function" msgid "help_function ({0}) must be a function"
msgstr "" msgstr ""
#: tiramisu/autolib.py:452 tiramisu/autolib.py:514 #: tiramisu/autolib.py:455 tiramisu/autolib.py:503
msgid "unable to carry out a calculation for {}, {}"
msgstr ""
#: tiramisu/autolib.py:461 tiramisu/autolib.py:521
msgid "the option {0} is used in a calculation but is invalid ({1})" msgid "the option {0} is used in a calculation but is invalid ({1})"
msgstr "" msgstr ""
#: tiramisu/autolib.py:477 tiramisu/autolib.py:535 tiramisu/autolib.py:584 #: tiramisu/autolib.py:467 tiramisu/autolib.py:515 tiramisu/autolib.py:554
msgid "unable to get value for calculating {0}, {1}" msgid "unable to get value for calculating {0}, {1}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:601 #: tiramisu/autolib.py:499
msgid "unable to carry out a calculation for {0}, {1}"
msgstr ""
#: tiramisu/autolib.py:535
msgid "cannot find information for {0}, {1} is a dynamic option"
msgstr ""
#: tiramisu/autolib.py:564
msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription" msgid "option {0} is not a dynoptiondescription or in a dynoptiondescription"
msgstr "" msgstr ""
#: tiramisu/autolib.py:687 #: tiramisu/autolib.py:650
msgid "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\" with identifier \"{2}\", list of valid identifiers: {3}" msgid "cannot calculate arguments for \"{0}\", cannot find dynamic variable \"{1}\" with identifier \"{2}\", list of valid identifiers: {3}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:866 #: tiramisu/autolib.py:754
msgid "the follower {0} must have index in carry_out_calculation!"
msgstr ""
#: tiramisu/autolib.py:826
msgid "the \"{}\" function with positional arguments \"{}\" and keyword arguments \"{}\" must not return a list (\"{}\") for the follower option {}" msgid "the \"{}\" function with positional arguments \"{}\" and keyword arguments \"{}\" must not return a list (\"{}\") for the follower option {}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:881 #: tiramisu/autolib.py:841
msgid "the \"{}\" function must not return a list (\"{}\") for the follower option {}" msgid "the \"{}\" function must not return a list (\"{}\") for the follower option {}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:922 #: tiramisu/autolib.py:882
msgid "unexpected error \"{0}\" in function \"{1}\" with arguments \"{3}\" and \"{4}\" for option {2}" msgid "unexpected error \"{1}\" in function \"{2}\" with arguments \"{3}\" and \"{4}\" for option {0}"
msgstr "" msgstr ""
#: tiramisu/autolib.py:933 #: tiramisu/autolib.py:891
msgid "unexpected error \"{0}\" in function \"{1}\" for option {2}" msgid "unexpected error \"{1}\" in function \"{2}\" for option {0}"
msgstr "" msgstr ""
#: tiramisu/config.py:420 #: tiramisu/config.py:420
@ -340,19 +348,19 @@ msgid "invalid value"
msgstr "" msgstr ""
#: tiramisu/error.py:207 #: tiramisu/error.py:207
msgid "attention, \"{0}\" could be an invalid {1} for \"{2}\"" msgid "attention, \"{0}\" could be an invalid {1} for {2}"
msgstr "" msgstr ""
#: tiramisu/error.py:209 #: tiramisu/error.py:209
msgid "attention, \"{0}\" could be an invalid {1} for \"{2}\" at index \"{3}\"" msgid "attention, \"{0}\" could be an invalid {1} for {2} at index \"{3}\""
msgstr "" msgstr ""
#: tiramisu/error.py:228 tiramisu/error.py:239 #: tiramisu/error.py:228 tiramisu/error.py:239
msgid "\"{0}\" is an invalid {1} for \"{2}\"" msgid "\"{0}\" is an invalid {1} for {2}"
msgstr "" msgstr ""
#: tiramisu/error.py:230 #: tiramisu/error.py:230
msgid "\"{0}\" is an invalid {1} for \"{2}\" at index \"{3}\"" msgid "\"{0}\" is an invalid {1} for {2} at index \"{3}\""
msgstr "" msgstr ""
#: tiramisu/function.py:65 #: tiramisu/function.py:65
@ -633,7 +641,7 @@ msgid "leadership {0} shall not have a subgroup"
msgstr "" msgstr ""
#: tiramisu/option/leadership.py:114 #: tiramisu/option/leadership.py:114
msgid "only multi option allowed in leadership {0} but option {1} is not a multi" msgid "only multi option are allowed in leadership {0} but option {1} is not a multi"
msgstr "" msgstr ""
#: tiramisu/option/leadership.py:141 #: tiramisu/option/leadership.py:141

View file

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

View file

@ -1 +1 @@
__version__ = "5.2.0a5" __version__ = "5.2.0a6"

View file

@ -22,7 +22,7 @@ from typing import Any, Optional, Union, Callable, Dict, List
from itertools import chain from itertools import chain
import weakref import weakref
from .error import PropertiesOptionError, ConfigError, LeadershipError, ValueWarning, CancelParam, display_list from .error import PropertiesOptionError, ConfigError, LeadershipError, ValueWarning, CancelParam, display_list, errors
from .i18n import _ from .i18n import _
from .setting import undefined, ConfigBag from .setting import undefined, ConfigBag
from .function import FUNCTION_WAITING_FOR_DICT, FUNCTION_WAITING_FOR_ERROR from .function import FUNCTION_WAITING_FOR_DICT, FUNCTION_WAITING_FOR_ERROR
@ -446,14 +446,7 @@ def manager_callback(
or param.raisepropertyerror or param.raisepropertyerror
): ):
raise err from err raise err from err
display_name = subconfig.option.impl_get_display_name( raise ConfigError(err)
subconfig, with_quote=True
)
raise ConfigError(
_("unable to carry out a calculation for {}, {}").format(
display_name, err
)
) from err
except ValueError as err: except ValueError as err:
display_name = subconfig.option.impl_get_display_name( display_name = subconfig.option.impl_get_display_name(
subconfig, with_quote=True subconfig, with_quote=True
@ -471,14 +464,7 @@ def manager_callback(
["configerror"], ["configerror"],
config_bag.context.get_settings(), config_bag.context.get_settings(),
) )
display_name = subconfig.option.impl_get_display_name( errors.raise_carry_out_calculation_error(subconfig, _("unable to get value for calculating {0}, {1}"), err)
subconfig, with_quote=True
)
raise ConfigError(
_("unable to get value for calculating {0}, {1}").format(
display_name, err
)
) from err
return value return value
def get_option_bag( def get_option_bag(
@ -510,12 +496,7 @@ def manager_callback(
# raise PropertiesOptionError (which is catched) because must not add value None in carry_out_calculation # raise PropertiesOptionError (which is catched) because must not add value None in carry_out_calculation
if param.notraisepropertyerror or param.raisepropertyerror: if param.notraisepropertyerror or param.raisepropertyerror:
raise err from err raise err from err
display_name = option.impl_get_display_name(subconfig, with_quote=True) errors.raise_carry_out_calculation_error(subconfig, _("unable to carry out a calculation for {0}, {1}"), err, option=option)
raise ConfigError(
_("unable to carry out a calculation for {}, {}").format(
display_name, err
)
) from err
except ValueError as err: except ValueError as err:
display_name = option.impl_get_display_name(subconfig, with_quote=True) display_name = option.impl_get_display_name(subconfig, with_quote=True)
raise ValueError( raise ValueError(
@ -531,12 +512,7 @@ def manager_callback(
["configerror"], ["configerror"],
config_bag.context.get_settings(), config_bag.context.get_settings(),
) )
display_name = option.impl_get_display_name(subconfig, with_quote=True) errors.raise_carry_out_calculation_error(subconfig, _("unable to get value for calculating {0}, {1}"), err, option=option)
raise ConfigError(
_("unable to get value for calculating {0}, {1}").format(
display_name, err
)
) from err
return subsubconfig return subsubconfig
if isinstance(param, ParamValue): if isinstance(param, ParamValue):
@ -553,15 +529,10 @@ def manager_callback(
true_path=subconfig.path, true_path=subconfig.path,
) )
if isinstance(isubconfig, list): if isinstance(isubconfig, list):
display_name = option.impl_get_display_name(
subconfig, with_quote=True
)
search_name = search_option.impl_get_display_name( search_name = search_option.impl_get_display_name(
None, with_quote=True None, with_quote=True
) )
raise ConfigError( errors.raise_carry_out_calculation_error(subconfig, _("cannot find information for {0}, {1} is a dynamic option"), None, option=option, extra_keys=[search_name])
f"cannot find information for {display_name}, {search_name} is a dynamic option"
)
else: else:
isubconfig = get_option_bag( isubconfig = get_option_bag(
config_bag, config_bag,
@ -580,12 +551,7 @@ def manager_callback(
param.default_value, param.default_value,
) )
except ValueError as err: except ValueError as err:
display_name = option.impl_get_display_name(subconfig, with_quote=True) errors.raise_carry_out_calculation_error(subconfig, _("unable to get value for calculating {0}, {1}"), err, option=option)
raise ConfigError(
_("unable to get value for calculating {0}, {1}").format(
display_name, err
)
) from err
if isinstance(param, ParamIndex): if isinstance(param, ParamIndex):
return index return index
@ -595,14 +561,7 @@ def manager_callback(
not option.impl_is_optiondescription() not option.impl_is_optiondescription()
or not option.impl_is_dynoptiondescription() or not option.impl_is_dynoptiondescription()
): ):
display_name = subconfig.option.impl_get_display_name( errors.raise_carry_out_calculation_error(subconfig, _("option {0} is not a dynoptiondescription or in a dynoptiondescription"), None, option=option)
subconfig, with_quote=True
)
raise ConfigError(
_(
"option {0} is not a dynoptiondescription or in a dynoptiondescription"
).format(display_name)
)
if subconfig.identifiers is None: if subconfig.identifiers is None:
# if uncalculated # if uncalculated
return return
@ -685,8 +644,10 @@ def manager_callback(
raise CancelParam(callbk_option.impl_getpath(), child_path) raise CancelParam(callbk_option.impl_getpath(), child_path)
identifiers = display_list(doption.get_identifiers(parent), add_quote=True) identifiers = display_list(doption.get_identifiers(parent), add_quote=True)
msg = _('cannot calculate arguments for "{0}", cannot find dynamic variable "{1}" with identifier "{2}", list of valid identifiers: {3}').format(subconfig.path, doption.impl_getpath(), identifier, identifiers) doption_name = doption.impl_get_display_name(
raise ConfigError(msg) from err None, with_quote=True
)
errors.raise_carry_out_calculation_error(subconfig, _('cannot calculate arguments for "{0}", cannot find dynamic variable "{1}" with identifier "{2}", list of valid identifiers: {3}'), err, extra_keys=[doption_name, identifier, identifiers])
new_parents.append( new_parents.append(
parent.get_child( parent.get_child(
doption, doption,
@ -790,9 +751,7 @@ def carry_out_calculation(
and option.impl_is_follower() and option.impl_is_follower()
and index is None and index is None
): ):
raise ConfigError( errors.raise_carry_out_calculation_error(subconfig, _("the follower {0} must have index in carry_out_calculation!"), None, option=option)
f"the follower {option.impl_get_display_name(subconfig, with_quote=True)} must have index in carry_out_calculation!"
)
def fake_items(iterator): def fake_items(iterator):
return ((None, i) for i in iterator) return ((None, i) for i in iterator)
@ -921,19 +880,14 @@ def calculate(
error = err error = err
if args or kwargs: if args or kwargs:
msg = _( msg = _(
'unexpected error "{0}" in function "{1}" with arguments "{3}" and "{4}" ' 'unexpected error "{1}" in function "{2}" with arguments "{3}" and "{4}" '
"for option {2}" "for option {0}"
).format( )
str(error), extra_keys = [callback.__name__,
callback.__name__,
subconfig.option.impl_get_display_name(subconfig, with_quote=True),
args, args,
kwargs, kwargs,
) ]
else: else:
msg = _('unexpected error "{0}" in function "{1}" for option {2}' "").format( msg = _('unexpected error "{1}" in function "{2}" for option {0}')
str(error), extra_keys = [callback.__name__]
callback.__name__, errors.raise_carry_out_calculation_error(subconfig, msg, error, extra_keys=extra_keys)
subconfig.option.impl_get_display_name(subconfig, with_quote=True),
)
raise ConfigError(msg) from error

View file

@ -177,7 +177,7 @@ class _CommonError:
self.val = val self.val = val
self.display_type = display_type self.display_type = display_type
self.opt = weakref.ref(opt) self.opt = weakref.ref(opt)
self.name = opt.impl_get_display_name(subconfig) self.name = opt.impl_get_display_name(subconfig, with_quote=True)
self.err_msg = err_msg self.err_msg = err_msg
self.index = index self.index = index
super().__init__(self.err_msg) super().__init__(self.err_msg)
@ -204,9 +204,9 @@ class ValueWarning(_CommonError, UserWarning):
def __init__(self, **kwargs): def __init__(self, **kwargs):
if ValueWarning.tmpl is None: if ValueWarning.tmpl is None:
if kwargs.get('index') is None: if kwargs.get('index') is None:
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}"') ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for {2}')
else: else:
ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for "{2}" at index "{3}"') ValueWarning.tmpl = _('attention, "{0}" could be an invalid {1} for {2} at index "{3}"')
if list(kwargs) == ['msg']: if list(kwargs) == ['msg']:
self.msg = kwargs['msg'] self.msg = kwargs['msg']
else: else:
@ -225,9 +225,9 @@ class ValueOptionError(_CommonError, ValueError):
def __init__(self, **kwargs): def __init__(self, **kwargs):
if ValueOptionError.tmpl is None: if ValueOptionError.tmpl is None:
if kwargs.get('index') is None: if kwargs.get('index') is None:
self.tmpl = _('"{0}" is an invalid {1} for "{2}"') self.tmpl = _('"{0}" is an invalid {1} for {2}')
else: else:
self.tmpl = _('"{0}" is an invalid {1} for "{2}" at index "{3}"') self.tmpl = _('"{0}" is an invalid {1} for {2} at index "{3}"')
super().__init__(**kwargs) super().__init__(**kwargs)
@ -236,7 +236,7 @@ class ValueErrorWarning(ValueWarning):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
if ValueErrorWarning.tmpl is None: if ValueErrorWarning.tmpl is None:
ValueErrorWarning.tmpl = _('"{0}" is an invalid {1} for "{2}"') ValueErrorWarning.tmpl = _('"{0}" is an invalid {1} for {2}')
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -254,3 +254,21 @@ class CancelParam(Exception):
def __bool__(self): def __bool__(self):
return False return False
class Errors:
@staticmethod
def raise_carry_out_calculation_error(subconfig, message, original_error, option=None, extra_keys=[]):
if option is None:
option = subconfig.option
display_name = option.impl_get_display_name(
subconfig, with_quote=True
)
if original_error:
raise ConfigError(
message.format(display_name, original_error, *extra_keys)
) from original_error
raise ConfigError(message.format(display_name, extra_keys))
errors = Errors()