Compare commits
No commits in common. "main" and "5.2.0a36" have entirely different histories.
38 changed files with 593 additions and 693 deletions
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -4,7 +4,7 @@ requires = ["flit_core >=3.8.0,<4"]
|
||||||
|
|
||||||
[project]
|
[project]
|
||||||
name = "tiramisu"
|
name = "tiramisu"
|
||||||
version = "5.2.0"
|
version = "5.2.0a36"
|
||||||
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"
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""Configuration management library written in python"""
|
"""Configuration management library written in python
|
||||||
|
"""
|
||||||
from .function import (
|
from .function import (
|
||||||
calc_value,
|
calc_value,
|
||||||
calc_value_property_help,
|
calc_value_property_help,
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
__version__ = "5.2.0"
|
__version__ = "5.2.0a36"
|
||||||
|
|
|
||||||
120
tiramisu/api.py
120
tiramisu/api.py
|
|
@ -141,8 +141,7 @@ class CommonTiramisu(TiramisuHelp):
|
||||||
raise ConfigError(str(err))
|
raise ConfigError(str(err))
|
||||||
if id(self._subconfig.config_bag) != id(self._config_bag):
|
if id(self._subconfig.config_bag) != id(self._config_bag):
|
||||||
subconfig = self._subconfig
|
subconfig = self._subconfig
|
||||||
self._subconfig = subconfig.__class__(
|
self._subconfig = subconfig.__class__(option=subconfig.option,
|
||||||
option=subconfig.option,
|
|
||||||
index=subconfig.index,
|
index=subconfig.index,
|
||||||
path=subconfig.path,
|
path=subconfig.path,
|
||||||
config_bag=self._config_bag,
|
config_bag=self._config_bag,
|
||||||
|
|
@ -154,9 +153,7 @@ class CommonTiramisu(TiramisuHelp):
|
||||||
validate_properties=False,
|
validate_properties=False,
|
||||||
check_dynamic_without_identifiers=False,
|
check_dynamic_without_identifiers=False,
|
||||||
)
|
)
|
||||||
self._subconfig.is_self_dynamic_without_identifiers = (
|
self._subconfig.is_self_dynamic_without_identifiers = subconfig.is_self_dynamic_without_identifiers
|
||||||
subconfig.is_self_dynamic_without_identifiers
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
self._subconfig._length = None
|
self._subconfig._length = None
|
||||||
if not self._subconfig:
|
if not self._subconfig:
|
||||||
|
|
@ -192,11 +189,7 @@ def option_type(types):
|
||||||
return func(self, options_bag, *args[1:], **kwargs)
|
return func(self, options_bag, *args[1:], **kwargs)
|
||||||
self._set_subconfig()
|
self._set_subconfig()
|
||||||
if (
|
if (
|
||||||
"allow_dynoption" not in types
|
"allow_dynoption" not in types and not ("dynoption_or_uncalculated" in types and kwargs.get("uncalculated", False) is True)
|
||||||
and not (
|
|
||||||
"dynoption_or_uncalculated" in types
|
|
||||||
and kwargs.get("uncalculated", False) is True
|
|
||||||
)
|
|
||||||
) and self._subconfig.is_dynamic_without_identifiers:
|
) and self._subconfig.is_dynamic_without_identifiers:
|
||||||
raise AttributeOptionError(self._subconfig.path, "option-dynamic")
|
raise AttributeOptionError(self._subconfig.path, "option-dynamic")
|
||||||
|
|
||||||
|
|
@ -244,13 +237,7 @@ def option_type(types):
|
||||||
self.__class__.__name__, func.__name__
|
self.__class__.__name__, func.__name__
|
||||||
)
|
)
|
||||||
raise ConfigError(msg)
|
raise ConfigError(msg)
|
||||||
if self._index is None and (
|
if self._index is None and ("with_index" in types or ("with_index_or_uncalculated" in types and kwargs.get("uncalculated", False) is False)):
|
||||||
"with_index" in types
|
|
||||||
or (
|
|
||||||
"with_index_or_uncalculated" in types
|
|
||||||
and kwargs.get("uncalculated", False) is False
|
|
||||||
)
|
|
||||||
):
|
|
||||||
msg = _(
|
msg = _(
|
||||||
"please specify index with a follower option ({0}.{1})"
|
"please specify index with a follower option ({0}.{1})"
|
||||||
).format(self.__class__.__name__, func.__name__)
|
).format(self.__class__.__name__, func.__name__)
|
||||||
|
|
@ -293,7 +280,7 @@ class CommonTiramisuOption(CommonTiramisu):
|
||||||
path: str,
|
path: str,
|
||||||
index: Optional[int],
|
index: Optional[int],
|
||||||
config_bag: ConfigBag,
|
config_bag: ConfigBag,
|
||||||
subconfig: Optional[SubConfig] = None,
|
subconfig: Optional[SubConfig]=None,
|
||||||
) -> None:
|
) -> None:
|
||||||
self._path = path
|
self._path = path
|
||||||
self._index = index
|
self._index = index
|
||||||
|
|
@ -471,11 +458,7 @@ class _TiramisuOptionOptionDescription:
|
||||||
):
|
):
|
||||||
if subconfig.properties is None:
|
if subconfig.properties is None:
|
||||||
subconfig.properties = undefined
|
subconfig.properties = undefined
|
||||||
if (
|
if is_default and subconfig.config_bag.context.get_owner(subconfig) != owners.default:
|
||||||
is_default
|
|
||||||
and subconfig.config_bag.context.get_owner(subconfig)
|
|
||||||
!= owners.default
|
|
||||||
):
|
|
||||||
continue
|
continue
|
||||||
options.append(
|
options.append(
|
||||||
TiramisuOption(
|
TiramisuOption(
|
||||||
|
|
@ -488,11 +471,7 @@ class _TiramisuOptionOptionDescription:
|
||||||
for subconfig in context.get_dynamic_from_dyn_option(
|
for subconfig in context.get_dynamic_from_dyn_option(
|
||||||
self._subconfig, option
|
self._subconfig, option
|
||||||
):
|
):
|
||||||
if (
|
if is_default and subconfig.config_bag.context.get_owner(subconfig) != owners.default:
|
||||||
is_default
|
|
||||||
and subconfig.config_bag.context.get_owner(subconfig)
|
|
||||||
!= owners.default
|
|
||||||
):
|
|
||||||
continue
|
continue
|
||||||
options.append(
|
options.append(
|
||||||
TiramisuOption(
|
TiramisuOption(
|
||||||
|
|
@ -523,11 +502,7 @@ class _TiramisuOptionOptionDescription:
|
||||||
)
|
)
|
||||||
t_option._set_subconfig()
|
t_option._set_subconfig()
|
||||||
subconfig = t_option._subconfig
|
subconfig = t_option._subconfig
|
||||||
if (
|
if is_default and subconfig.config_bag.context.get_owner(subconfig) != owners.default:
|
||||||
is_default
|
|
||||||
and subconfig.config_bag.context.get_owner(subconfig)
|
|
||||||
!= owners.default
|
|
||||||
):
|
|
||||||
continue
|
continue
|
||||||
options.append(
|
options.append(
|
||||||
t_option,
|
t_option,
|
||||||
|
|
@ -655,10 +630,7 @@ class _TiramisuOptionOptionDescription:
|
||||||
dynconfig = None
|
dynconfig = None
|
||||||
_subconfig = subconfig
|
_subconfig = subconfig
|
||||||
while not dynconfig:
|
while not dynconfig:
|
||||||
if (
|
if _subconfig.option.impl_is_optiondescription() and _subconfig.option.impl_is_dynoptiondescription():
|
||||||
_subconfig.option.impl_is_optiondescription()
|
|
||||||
and _subconfig.option.impl_is_dynoptiondescription()
|
|
||||||
):
|
|
||||||
dynconfig = _subconfig
|
dynconfig = _subconfig
|
||||||
else:
|
else:
|
||||||
_subconfig = _subconfig.parent
|
_subconfig = _subconfig.parent
|
||||||
|
|
@ -677,30 +649,18 @@ class _TiramisuOptionOptionDescription:
|
||||||
"""
|
"""
|
||||||
identifiers = []
|
identifiers = []
|
||||||
while True:
|
while True:
|
||||||
if (
|
if subconfig.option.impl_is_optiondescription() and subconfig.option.impl_is_dynoptiondescription():
|
||||||
subconfig.option.impl_is_optiondescription()
|
|
||||||
and subconfig.option.impl_is_dynoptiondescription()
|
|
||||||
):
|
|
||||||
if not subconfig.is_self_dynamic_without_identifiers:
|
if not subconfig.is_self_dynamic_without_identifiers:
|
||||||
new_identifiers = [subconfig.identifiers[-1]]
|
new_identifiers = [subconfig.identifiers[-1]]
|
||||||
else:
|
else:
|
||||||
new_identifiers = subconfig.option.get_identifiers(
|
new_identifiers = subconfig.option.get_identifiers(subconfig.parent, uncalculated=uncalculated, convert=convert)
|
||||||
subconfig.parent, uncalculated=uncalculated, convert=convert
|
|
||||||
)
|
|
||||||
if isinstance(new_identifiers, Calculation):
|
if isinstance(new_identifiers, Calculation):
|
||||||
if identifiers:
|
if identifiers:
|
||||||
identifiers = [
|
identifiers = [[new_identifiers] + old_identifiers for old_identifiers in identifiers]
|
||||||
[new_identifiers] + old_identifiers
|
|
||||||
for old_identifiers in identifiers
|
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
identifiers = [new_identifiers]
|
identifiers = [new_identifiers]
|
||||||
elif identifiers:
|
elif identifiers:
|
||||||
identifiers = [
|
identifiers = [[identifier] + old_identifiers for identifier in new_identifiers for old_identifiers in identifiers]
|
||||||
[identifier] + old_identifiers
|
|
||||||
for identifier in new_identifiers
|
|
||||||
for old_identifiers in identifiers
|
|
||||||
]
|
|
||||||
else:
|
else:
|
||||||
identifiers = [[identifier] for identifier in new_identifiers]
|
identifiers = [[identifier] for identifier in new_identifiers]
|
||||||
subconfig = subconfig.parent
|
subconfig = subconfig.parent
|
||||||
|
|
@ -722,10 +682,7 @@ class _TiramisuOptionOptionDescription:
|
||||||
dynconfig = None
|
dynconfig = None
|
||||||
_subconfig = subconfig
|
_subconfig = subconfig
|
||||||
while not dynconfig:
|
while not dynconfig:
|
||||||
if (
|
if _subconfig.option.impl_is_optiondescription() and _subconfig.option.impl_is_dynoptiondescription():
|
||||||
_subconfig.option.impl_is_optiondescription()
|
|
||||||
and _subconfig.option.impl_is_dynoptiondescription()
|
|
||||||
):
|
|
||||||
dynconfig = _subconfig
|
dynconfig = _subconfig
|
||||||
_subconfig = _subconfig.parent
|
_subconfig = _subconfig.parent
|
||||||
return dynconfig.option.get_identifiers(
|
return dynconfig.option.get_identifiers(
|
||||||
|
|
@ -852,7 +809,10 @@ class TiramisuOptionOwner(CommonTiramisuOption):
|
||||||
"""Is option has defaut value"""
|
"""Is option has defaut value"""
|
||||||
subconfig = self._subconfig
|
subconfig = self._subconfig
|
||||||
s_properties = subconfig.properties
|
s_properties = subconfig.properties
|
||||||
if "frozen" in s_properties and "force_default_on_freeze" in s_properties:
|
if (
|
||||||
|
"frozen" in s_properties
|
||||||
|
and "force_default_on_freeze" in s_properties
|
||||||
|
):
|
||||||
return True
|
return True
|
||||||
context = self._config_bag.context
|
context = self._config_bag.context
|
||||||
subconfig = context._get(
|
subconfig = context._get(
|
||||||
|
|
@ -884,13 +844,7 @@ class TiramisuOptionProperty(CommonTiramisuOption):
|
||||||
_validate_properties = False
|
_validate_properties = False
|
||||||
|
|
||||||
@option_type(
|
@option_type(
|
||||||
[
|
["option", "optiondescription", "with_index_or_uncalculated", "symlink", "allow_dynoption"]
|
||||||
"option",
|
|
||||||
"optiondescription",
|
|
||||||
"with_index_or_uncalculated",
|
|
||||||
"symlink",
|
|
||||||
"allow_dynoption",
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
|
|
@ -1111,15 +1065,7 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
|
||||||
|
|
||||||
_validate_properties = True
|
_validate_properties = True
|
||||||
|
|
||||||
@option_type(
|
@option_type(["option", "symlink", "with_index", "optiondescription", "dynoption_or_uncalculated"])
|
||||||
[
|
|
||||||
"option",
|
|
||||||
"symlink",
|
|
||||||
"with_index",
|
|
||||||
"optiondescription",
|
|
||||||
"dynoption_or_uncalculated",
|
|
||||||
]
|
|
||||||
)
|
|
||||||
def get(
|
def get(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
|
|
@ -1183,13 +1129,7 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
|
||||||
values.reset(self._subconfig)
|
values.reset(self._subconfig)
|
||||||
|
|
||||||
@option_type(
|
@option_type(
|
||||||
[
|
["option", "with_or_without_index", "symlink", "dont_validate_property", "dynoption_or_uncalculated"]
|
||||||
"option",
|
|
||||||
"with_or_without_index",
|
|
||||||
"symlink",
|
|
||||||
"dont_validate_property",
|
|
||||||
"dynoption_or_uncalculated",
|
|
||||||
]
|
|
||||||
)
|
)
|
||||||
def default(
|
def default(
|
||||||
self,
|
self,
|
||||||
|
|
@ -1398,7 +1338,7 @@ class TiramisuOption(
|
||||||
if subfunc in ["forcepermissive", "unrestraint", "nowarnings"]:
|
if subfunc in ["forcepermissive", "unrestraint", "nowarnings"]:
|
||||||
if subfunc == "unrestraint" and self._config_bag.is_unrestraint:
|
if subfunc == "unrestraint" and self._config_bag.is_unrestraint:
|
||||||
return self
|
return self
|
||||||
# if self._orig_config_bags:
|
#if self._orig_config_bags:
|
||||||
# msg = _(
|
# msg = _(
|
||||||
# "do not use unrestraint, nowarnings or forcepermissive together"
|
# "do not use unrestraint, nowarnings or forcepermissive together"
|
||||||
# )
|
# )
|
||||||
|
|
@ -1488,8 +1428,6 @@ class TiramisuOption(
|
||||||
if self._tiramisu_dict is None: # pragma: no cover
|
if self._tiramisu_dict is None: # pragma: no cover
|
||||||
self._load_dict()
|
self._load_dict()
|
||||||
return self._tiramisu_dict.set_updates(body)
|
return self._tiramisu_dict.set_updates(body)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# def forcepermissive(self):
|
# def forcepermissive(self):
|
||||||
# self._set_subconfig()
|
# self._set_subconfig()
|
||||||
|
|
@ -1564,11 +1502,8 @@ class TiramisuContextValue(TiramisuConfig, _TiramisuODGet):
|
||||||
only_mandatory=True,
|
only_mandatory=True,
|
||||||
):
|
):
|
||||||
if id(subconfig.config_bag) != id(config_bag):
|
if id(subconfig.config_bag) != id(config_bag):
|
||||||
old_is_dynamic_without_identifiers = (
|
old_is_dynamic_without_identifiers = subconfig.is_self_dynamic_without_identifiers
|
||||||
subconfig.is_self_dynamic_without_identifiers
|
subconfig = subconfig.__class__(option=subconfig.option,
|
||||||
)
|
|
||||||
subconfig = subconfig.__class__(
|
|
||||||
option=subconfig.option,
|
|
||||||
index=subconfig.index,
|
index=subconfig.index,
|
||||||
path=subconfig.path,
|
path=subconfig.path,
|
||||||
config_bag=config_bag,
|
config_bag=config_bag,
|
||||||
|
|
@ -1580,9 +1515,7 @@ class TiramisuContextValue(TiramisuConfig, _TiramisuODGet):
|
||||||
validate_properties=False,
|
validate_properties=False,
|
||||||
check_dynamic_without_identifiers=False,
|
check_dynamic_without_identifiers=False,
|
||||||
)
|
)
|
||||||
subconfig.is_self_dynamic_without_identifiers = (
|
subconfig.is_self_dynamic_without_identifiers = old_is_dynamic_without_identifiers
|
||||||
old_is_dynamic_without_identifiers
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
subconfig._length = None
|
subconfig._length = None
|
||||||
options.append(
|
options.append(
|
||||||
|
|
@ -2296,7 +2229,6 @@ class TiramisuAPI(TiramisuHelp):
|
||||||
class ConfigProp(TiramisuAPI, TiramisuContextOption):
|
class ConfigProp(TiramisuAPI, TiramisuContextOption):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class Config(TiramisuAPI, TiramisuContextOption):
|
class Config(TiramisuAPI, TiramisuContextOption):
|
||||||
"""Root config object that enables us to handle the configuration options"""
|
"""Root config object that enables us to handle the configuration options"""
|
||||||
|
|
||||||
|
|
@ -2323,8 +2255,6 @@ class Config(TiramisuAPI, TiramisuContextOption):
|
||||||
permissives=permissives,
|
permissives=permissives,
|
||||||
)
|
)
|
||||||
super().__init__(config_bag)
|
super().__init__(config_bag)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# def __del__(self):
|
# def __del__(self):
|
||||||
# try:
|
# try:
|
||||||
|
|
|
||||||
|
|
@ -157,9 +157,9 @@ class ParamDynOption(ParamOption):
|
||||||
)
|
)
|
||||||
if not isinstance(identifiers, (list, Calculation)):
|
if not isinstance(identifiers, (list, Calculation)):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
_(
|
_("identifiers in ParamDynOption must be a list or a calculation, not {0}").format(
|
||||||
"identifiers in ParamDynOption must be a list or a calculation, not {0}"
|
identifiers
|
||||||
).format(identifiers)
|
)
|
||||||
)
|
)
|
||||||
if not isinstance(optional, bool):
|
if not isinstance(optional, bool):
|
||||||
raise Exception(
|
raise Exception(
|
||||||
|
|
@ -628,26 +628,21 @@ def manager_callback(
|
||||||
properties = config_bag.context.get_settings().getproperties(
|
properties = config_bag.context.get_settings().getproperties(
|
||||||
subconfig,
|
subconfig,
|
||||||
uncalculated=True,
|
uncalculated=True,
|
||||||
) - {"validator", "mandatory", "empty"}
|
) - {'validator', 'mandatory', 'empty'}
|
||||||
for subconfig_ in subconfigs:
|
for subconfig_ in subconfigs:
|
||||||
if subconfig.path == subconfig_.path:
|
if subconfig.path == subconfig_.path:
|
||||||
values.append(orig_value)
|
values.append(orig_value)
|
||||||
else:
|
else:
|
||||||
subconfig_.properties = properties
|
subconfig_.properties = properties
|
||||||
values.append(
|
values.append(get_value(
|
||||||
get_value(
|
|
||||||
config_bag,
|
config_bag,
|
||||||
subconfig_,
|
subconfig_,
|
||||||
param,
|
param,
|
||||||
True,
|
True,
|
||||||
)
|
))
|
||||||
)
|
|
||||||
if callback.__name__ not in FUNCTION_WAITING_FOR_DICT:
|
if callback.__name__ not in FUNCTION_WAITING_FOR_DICT:
|
||||||
return values
|
return values
|
||||||
return {
|
return {"name": search_option.impl_get_display_name(subconfig), "value": values}
|
||||||
"name": search_option.impl_get_display_name(subconfig),
|
|
||||||
"value": values,
|
|
||||||
}
|
|
||||||
else:
|
else:
|
||||||
value = calc_self(
|
value = calc_self(
|
||||||
param,
|
param,
|
||||||
|
|
@ -784,9 +779,7 @@ def manager_callback(
|
||||||
or param.raisepropertyerror
|
or param.raisepropertyerror
|
||||||
):
|
):
|
||||||
raise err from err
|
raise err from err
|
||||||
raise ConfigError(
|
raise ConfigError(str(err), subconfig=subconfig) from err
|
||||||
str(err), subconfig=subconfig
|
|
||||||
) from err
|
|
||||||
parents = new_parents
|
parents = new_parents
|
||||||
if subconfigs_is_a_list:
|
if subconfigs_is_a_list:
|
||||||
subconfigs = parents
|
subconfigs = parents
|
||||||
|
|
@ -889,8 +882,7 @@ def carry_out_calculation(
|
||||||
config_bag = config_bag.copy()
|
config_bag = config_bag.copy()
|
||||||
config_bag.set_permissive()
|
config_bag.set_permissive()
|
||||||
old_is_dynamic_without_identifiers = subconfig.is_dynamic_without_identifiers
|
old_is_dynamic_without_identifiers = subconfig.is_dynamic_without_identifiers
|
||||||
subconfig = subconfig.__class__(
|
subconfig = subconfig.__class__(option=subconfig.option,
|
||||||
option=subconfig.option,
|
|
||||||
index=subconfig.index,
|
index=subconfig.index,
|
||||||
path=subconfig.path,
|
path=subconfig.path,
|
||||||
config_bag=config_bag,
|
config_bag=config_bag,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""options handler global entry point"""
|
"""options handler global entry point
|
||||||
|
"""
|
||||||
import weakref
|
import weakref
|
||||||
from copy import copy, deepcopy
|
from copy import copy, deepcopy
|
||||||
from typing import Optional, List, Any, Union
|
from typing import Optional, List, Any, Union
|
||||||
|
|
@ -48,7 +49,7 @@ def get_common_path(path1, path2):
|
||||||
if common_path in all_paths:
|
if common_path in all_paths:
|
||||||
# od.st is not the common_path of od.st_in
|
# od.st is not the common_path of od.st_in
|
||||||
all_paths.remove(common_path)
|
all_paths.remove(common_path)
|
||||||
if all_paths[0].startswith(common_path + "."):
|
if all_paths[0].startswith(common_path + '.'):
|
||||||
return common_path
|
return common_path
|
||||||
if common_path.endswith("."):
|
if common_path.endswith("."):
|
||||||
return common_path[:-1]
|
return common_path[:-1]
|
||||||
|
|
@ -104,9 +105,7 @@ class CCache:
|
||||||
if not force:
|
if not force:
|
||||||
# if is_default and config_bag.context.get_owner(subconfig) != owners.default:
|
# if is_default and config_bag.context.get_owner(subconfig) != owners.default:
|
||||||
# return
|
# return
|
||||||
for is_default, woption in subconfig.option.get_dependencies(
|
for is_default, woption in subconfig.option.get_dependencies(subconfig.option):
|
||||||
subconfig.option
|
|
||||||
):
|
|
||||||
option = woption()
|
option = woption()
|
||||||
if option.issubdyn():
|
if option.issubdyn():
|
||||||
# it's an option in dynoptiondescription, remove cache for all generated option
|
# it's an option in dynoptiondescription, remove cache for all generated option
|
||||||
|
|
@ -344,13 +343,7 @@ class SubConfig:
|
||||||
self.config_bag.context.get_settings().validate_properties(self)
|
self.config_bag.context.get_settings().validate_properties(self)
|
||||||
self._properties = undefined
|
self._properties = undefined
|
||||||
self.config_bag.context.get_settings().validate_properties(self)
|
self.config_bag.context.get_settings().validate_properties(self)
|
||||||
if (
|
if validate_properties and self.apply_requires and self.option.impl_is_optiondescription() and self.path and self.properties is not None:
|
||||||
validate_properties
|
|
||||||
and self.apply_requires
|
|
||||||
and self.option.impl_is_optiondescription()
|
|
||||||
and self.path
|
|
||||||
and self.properties is not None
|
|
||||||
):
|
|
||||||
settings = config_bag.context.get_settings()
|
settings = config_bag.context.get_settings()
|
||||||
self.transitive_properties = settings.calc_transitive_properties(
|
self.transitive_properties = settings.calc_transitive_properties(
|
||||||
self,
|
self,
|
||||||
|
|
@ -533,10 +526,7 @@ class SubConfig:
|
||||||
)
|
)
|
||||||
if check_index and index is not None:
|
if check_index and index is not None:
|
||||||
if option.impl_is_optiondescription() or not option.impl_is_follower():
|
if option.impl_is_optiondescription() or not option.impl_is_follower():
|
||||||
raise ConfigError(
|
raise ConfigError("index must be set only with a follower option", subconfig=subsubconfig,)
|
||||||
"index must be set only with a follower option",
|
|
||||||
subconfig=subsubconfig,
|
|
||||||
)
|
|
||||||
length = self.get_length_leadership()
|
length = self.get_length_leadership()
|
||||||
if index >= length:
|
if index >= length:
|
||||||
raise LeadershipError(
|
raise LeadershipError(
|
||||||
|
|
@ -577,11 +567,9 @@ class SubConfig:
|
||||||
None,
|
None,
|
||||||
validate_properties=False,
|
validate_properties=False,
|
||||||
)
|
)
|
||||||
subconfig.is_self_dynamic_without_identifiers = (
|
subconfig.is_self_dynamic_without_identifiers = self.is_self_dynamic_without_identifiers
|
||||||
self.is_self_dynamic_without_identifiers
|
#FIXME
|
||||||
)
|
#self._length = len(cconfig_bag.context.get_value(subconfig))
|
||||||
# FIXME
|
|
||||||
# self._length = len(cconfig_bag.context.get_value(subconfig))
|
|
||||||
length = len(cconfig_bag.context.get_value(subconfig))
|
length = len(cconfig_bag.context.get_value(subconfig))
|
||||||
return length
|
return length
|
||||||
|
|
||||||
|
|
@ -693,9 +681,7 @@ class SubConfig:
|
||||||
true_path=self.true_path,
|
true_path=self.true_path,
|
||||||
validate_properties=False,
|
validate_properties=False,
|
||||||
)
|
)
|
||||||
subconfig.is_self_dynamic_without_identifiers = (
|
subconfig.is_self_dynamic_without_identifiers = self.is_self_dynamic_without_identifiers
|
||||||
self.is_self_dynamic_without_identifiers
|
|
||||||
)
|
|
||||||
return subconfig
|
return subconfig
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1087,7 +1073,6 @@ class _Config(CCache):
|
||||||
|
|
||||||
class _CommonConfig(_Config):
|
class _CommonConfig(_Config):
|
||||||
"abstract base class for the Config, KernelGroupConfig and the KernelMetaConfig"
|
"abstract base class for the Config, KernelGroupConfig and the KernelMetaConfig"
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
"_impl_values",
|
"_impl_values",
|
||||||
"_impl_values_cache",
|
"_impl_values_cache",
|
||||||
|
|
@ -1920,7 +1905,9 @@ class KernelMetaConfig(KernelMixConfig):
|
||||||
if descr is None:
|
if descr is None:
|
||||||
descr = child.get_description()
|
descr = child.get_description()
|
||||||
if child.impl_getname() is None:
|
if child.impl_getname() is None:
|
||||||
raise ConfigError(_("children in MetaConfig must have name"))
|
raise ConfigError(
|
||||||
|
_("children in MetaConfig must have name")
|
||||||
|
)
|
||||||
elif descr is not child.get_description():
|
elif descr is not child.get_description():
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
_(
|
_(
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,9 @@ TiramisuErrorCode = Literal[
|
||||||
def display_list(
|
def display_list(
|
||||||
lst,
|
lst,
|
||||||
*,
|
*,
|
||||||
separator: str = "and",
|
separator: str="and",
|
||||||
add_quote: bool = False,
|
add_quote: bool=False,
|
||||||
sort: bool = True,
|
sort: bool=True,
|
||||||
) -> str():
|
) -> str():
|
||||||
if not lst:
|
if not lst:
|
||||||
return '""'
|
return '""'
|
||||||
|
|
@ -212,7 +212,7 @@ class ConfigError(Exception):
|
||||||
exp,
|
exp,
|
||||||
*,
|
*,
|
||||||
prefix: Optional[str] = None,
|
prefix: Optional[str] = None,
|
||||||
subconfig: Optional["Subconfig"] = None,
|
subconfig: Optional["Subconfig"]=None,
|
||||||
):
|
):
|
||||||
super().__init__(exp)
|
super().__init__(exp)
|
||||||
self.err_msg = exp
|
self.err_msg = exp
|
||||||
|
|
@ -230,7 +230,6 @@ class ConfigError(Exception):
|
||||||
|
|
||||||
class ConflictError(Exception):
|
class ConflictError(Exception):
|
||||||
"duplicate options are present in a single config"
|
"duplicate options are present in a single config"
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -309,7 +308,6 @@ class LeadershipError(Exception):
|
||||||
|
|
||||||
class ConstError(TypeError):
|
class ConstError(TypeError):
|
||||||
"no uniq value in _NameSpace"
|
"no uniq value in _NameSpace"
|
||||||
|
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -428,8 +426,7 @@ class Errors:
|
||||||
display_name = option.impl_get_display_name(subconfig, with_quote=True)
|
display_name = option.impl_get_display_name(subconfig, with_quote=True)
|
||||||
if original_error:
|
if original_error:
|
||||||
raise ConfigError(
|
raise ConfigError(
|
||||||
message.format(display_name, original_error, *extra_keys),
|
message.format(display_name, original_error, *extra_keys), subconfig=subconfig,
|
||||||
subconfig=subconfig,
|
|
||||||
) from original_error
|
) from original_error
|
||||||
raise ConfigError(message.format(display_name, extra_keys), subconfig=subconfig)
|
raise ConfigError(message.format(display_name, extra_keys), subconfig=subconfig)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,8 @@
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU Lesser General Public License
|
# 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/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
"""some functions to validates or calculates value"""
|
"""some functions to validates or calculates value
|
||||||
|
"""
|
||||||
from typing import Any, List, Optional
|
from typing import Any, List, Optional
|
||||||
from operator import add, mul, sub, truediv
|
from operator import add, mul, sub, truediv
|
||||||
from ipaddress import ip_address, ip_interface, ip_network
|
from ipaddress import ip_address, ip_interface, ip_network
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""all official option"""
|
"""all official option
|
||||||
|
"""
|
||||||
from .optiondescription import OptionDescription
|
from .optiondescription import OptionDescription
|
||||||
from .dynoptiondescription import DynOptionDescription
|
from .dynoptiondescription import DynOptionDescription
|
||||||
from .leadership import Leadership
|
from .leadership import Leadership
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""base option"""
|
"""base option
|
||||||
|
"""
|
||||||
from typing import FrozenSet, Set, Any, List, Optional, Dict
|
from typing import FrozenSet, Set, Any, List, Optional, Dict
|
||||||
import weakref
|
import weakref
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
@ -26,13 +27,7 @@ from itertools import chain
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..setting import undefined
|
from ..setting import undefined
|
||||||
from ..autolib import (
|
from ..autolib import Calculation, ParamOption, ParamSelfOption, ParamInformation, ParamSelfInformation
|
||||||
Calculation,
|
|
||||||
ParamOption,
|
|
||||||
ParamSelfOption,
|
|
||||||
ParamInformation,
|
|
||||||
ParamSelfInformation,
|
|
||||||
)
|
|
||||||
|
|
||||||
STATIC_TUPLE = frozenset()
|
STATIC_TUPLE = frozenset()
|
||||||
|
|
||||||
|
|
@ -395,7 +390,10 @@ class BaseOption(Base):
|
||||||
self.value_dependency(value, is_identifier)
|
self.value_dependency(value, is_identifier)
|
||||||
|
|
||||||
def value_dependency(
|
def value_dependency(
|
||||||
self, value: Any, is_identifier: bool = False, type_: str = "default"
|
self,
|
||||||
|
value: Any,
|
||||||
|
is_identifier: bool = False,
|
||||||
|
type_: str = 'default'
|
||||||
) -> Any:
|
) -> Any:
|
||||||
if not isinstance(is_identifier, bool):
|
if not isinstance(is_identifier, bool):
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""BoolOption"""
|
"""BoolOption
|
||||||
|
"""
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from .option import Option
|
from .option import Option
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""BroadcastOption"""
|
"""BroadcastOption
|
||||||
|
"""
|
||||||
from ipaddress import ip_address
|
from ipaddress import ip_address
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""ChoiceOption"""
|
"""ChoiceOption
|
||||||
|
"""
|
||||||
from typing import Any
|
from typing import Any
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""DateOption"""
|
"""DateOption
|
||||||
|
"""
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""DomainnameOption"""
|
"""DomainnameOption
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
import socket
|
import socket
|
||||||
from ipaddress import ip_interface
|
from ipaddress import ip_interface
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""DynOptionDescription"""
|
"""DynOptionDescription
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
import weakref
|
import weakref
|
||||||
from typing import List, Any, Optional, Dict
|
from typing import List, Any, Optional, Dict
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""EmailOption"""
|
"""EmailOption
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""FilenameOption"""
|
"""FilenameOption
|
||||||
|
"""
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""FloatOption"""
|
"""FloatOption
|
||||||
|
"""
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from .option import Option
|
from .option import Option
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""IntOption"""
|
"""IntOption
|
||||||
|
"""
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from .option import Option
|
from .option import Option
|
||||||
|
|
@ -26,7 +27,6 @@ from .option import Option
|
||||||
|
|
||||||
class IntOption(Option):
|
class IntOption(Option):
|
||||||
"represents a choice of an integer"
|
"represents a choice of an integer"
|
||||||
|
|
||||||
__slots__ = tuple()
|
__slots__ = tuple()
|
||||||
_type = "integer"
|
_type = "integer"
|
||||||
_t_type = _("integer")
|
_t_type = _("integer")
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""IPOption"""
|
"""IPOption
|
||||||
|
"""
|
||||||
from ipaddress import ip_address, ip_interface
|
from ipaddress import ip_address, ip_interface
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,7 @@ class Leadership(OptionDescription):
|
||||||
self._check_default_value(child)
|
self._check_default_value(child)
|
||||||
# remove empty property for follower
|
# remove empty property for follower
|
||||||
if not child.impl_is_submulti():
|
if not child.impl_is_submulti():
|
||||||
child._properties = frozenset(
|
child._properties = frozenset(child._properties - {"empty", "unique"})
|
||||||
child._properties - {"empty", "unique"}
|
|
||||||
)
|
|
||||||
followers.append(child)
|
followers.append(child)
|
||||||
child._add_dependency(self, "leadership")
|
child._add_dependency(self, "leadership")
|
||||||
child._leadership = weakref.ref(self)
|
child._leadership = weakref.ref(self)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""MACOption"""
|
"""MACOption
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""NetmaskOption"""
|
"""NetmaskOption
|
||||||
|
"""
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from .stroption import StrOption
|
from .stroption import StrOption
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""NetworkOption"""
|
"""NetworkOption
|
||||||
|
"""
|
||||||
from ipaddress import ip_network
|
from ipaddress import ip_network
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
@ -28,7 +29,6 @@ from .stroption import StrOption
|
||||||
|
|
||||||
class NetworkOption(IPOption):
|
class NetworkOption(IPOption):
|
||||||
"represents the choice of a network"
|
"represents the choice of a network"
|
||||||
|
|
||||||
__slots__ = tuple()
|
__slots__ = tuple()
|
||||||
_type = "network address"
|
_type = "network address"
|
||||||
_t_type = _("network address")
|
_t_type = _("network address")
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""OptionDescription"""
|
"""OptionDescription
|
||||||
|
"""
|
||||||
import weakref
|
import weakref
|
||||||
from typing import Optional, Iterator, Union, List, Dict
|
from typing import Optional, Iterator, Union, List, Dict
|
||||||
|
|
||||||
|
|
@ -28,12 +29,7 @@ from ..setting import ConfigBag, groups, undefined, owners, Undefined
|
||||||
from .baseoption import BaseOption
|
from .baseoption import BaseOption
|
||||||
|
|
||||||
# from .syndynoption import SubDynOptionDescription, SynDynOptionDescription
|
# from .syndynoption import SubDynOptionDescription, SynDynOptionDescription
|
||||||
from ..error import (
|
from ..error import ConfigError, ConflictError, AttributeOptionError, PropertiesOptionError
|
||||||
ConfigError,
|
|
||||||
ConflictError,
|
|
||||||
AttributeOptionError,
|
|
||||||
PropertiesOptionError,
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class CacheOptionDescription(BaseOption):
|
class CacheOptionDescription(BaseOption):
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""PasswordOption"""
|
"""PasswordOption
|
||||||
|
"""
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from ..error import display_list
|
from ..error import display_list
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""PermissionsOption"""
|
"""PermissionsOption
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""PortOption"""
|
"""PortOption
|
||||||
|
"""
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
from .stroption import StrOption
|
from .stroption import StrOption
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""StrOption and RegexpOption"""
|
"""StrOption and RegexpOption
|
||||||
|
"""
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""SymLinkOption link to an other option"""
|
"""SymLinkOption link to an other option
|
||||||
|
"""
|
||||||
from typing import Any, Optional, Dict
|
from typing import Any, Optional, Dict
|
||||||
from .baseoption import BaseOption, valid_name
|
from .baseoption import BaseOption, valid_name
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""URLOption to check url value"""
|
"""URLOption to check url value
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
from typing import Any, Optional, List, Dict
|
from typing import Any, Optional, List, Dict
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@
|
||||||
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
|
||||||
# the whole pypy projet is under MIT licence
|
# the whole pypy projet is under MIT licence
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
"""UsernameOption or GroupnameOption to check unix username/group value"""
|
"""UsernameOption or GroupnameOption to check unix username/group value
|
||||||
|
"""
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from ..i18n import _
|
from ..i18n import _
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,8 @@ RW_REMOVE = frozenset(
|
||||||
|
|
||||||
|
|
||||||
PROPERTIES_MAKE_SENSE = (
|
PROPERTIES_MAKE_SENSE = (
|
||||||
"cache" "demoting_error_warning",
|
"cache"
|
||||||
|
"demoting_error_warning",
|
||||||
"disabled",
|
"disabled",
|
||||||
"empty",
|
"empty",
|
||||||
"everything_frozen",
|
"everything_frozen",
|
||||||
|
|
@ -377,7 +378,6 @@ forbidden_owners = (owners.default, owners.forced) # pylint: disable=no-member
|
||||||
# ____________________________________________________________
|
# ____________________________________________________________
|
||||||
class Settings:
|
class Settings:
|
||||||
"``config.Config()``'s configuration options settings"
|
"``config.Config()``'s configuration options settings"
|
||||||
|
|
||||||
__slots__ = (
|
__slots__ = (
|
||||||
"_properties",
|
"_properties",
|
||||||
"_permissives",
|
"_permissives",
|
||||||
|
|
|
||||||
|
|
@ -122,7 +122,7 @@ class Values:
|
||||||
# get it
|
# get it
|
||||||
value = self.get_default_value(subconfig)
|
value = self.get_default_value(subconfig)
|
||||||
if owner == owners.default:
|
if owner == owners.default:
|
||||||
if (
|
if(
|
||||||
"force_store_value" in subconfig.config_bag.properties
|
"force_store_value" in subconfig.config_bag.properties
|
||||||
and "force_store_value" in self_properties
|
and "force_store_value" in self_properties
|
||||||
):
|
):
|
||||||
|
|
@ -163,7 +163,9 @@ class Values:
|
||||||
msubconfig = self._get_modified_parent(subconfig)
|
msubconfig = self._get_modified_parent(subconfig)
|
||||||
if msubconfig is not None:
|
if msubconfig is not None:
|
||||||
# retrieved value from parent config
|
# retrieved value from parent config
|
||||||
return msubconfig.config_bag.context.get_values().getowner(msubconfig)
|
return msubconfig.config_bag.context.get_values().getowner(
|
||||||
|
msubconfig
|
||||||
|
)
|
||||||
return owners.default
|
return owners.default
|
||||||
|
|
||||||
def get_default_value(
|
def get_default_value(
|
||||||
|
|
@ -340,7 +342,7 @@ class Values:
|
||||||
subconfig,
|
subconfig,
|
||||||
value,
|
value,
|
||||||
)
|
)
|
||||||
# parent._length = len(value)
|
# parent._length = len(value)
|
||||||
leader.follower_force_store_value(
|
leader.follower_force_store_value(
|
||||||
value,
|
value,
|
||||||
parent,
|
parent,
|
||||||
|
|
@ -567,7 +569,10 @@ class Values:
|
||||||
:returns: a `setting.owners.Owner` object
|
:returns: a `setting.owners.Owner` object
|
||||||
"""
|
"""
|
||||||
self_properties = subconfig.properties
|
self_properties = subconfig.properties
|
||||||
if "frozen" in self_properties and "force_default_on_freeze" in self_properties:
|
if (
|
||||||
|
"frozen" in self_properties
|
||||||
|
and "force_default_on_freeze" in self_properties
|
||||||
|
):
|
||||||
return owners.default
|
return owners.default
|
||||||
setting_properties = subconfig.config_bag.properties
|
setting_properties = subconfig.config_bag.properties
|
||||||
if (
|
if (
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue