diff --git a/tiramisu/__init__.py b/tiramisu/__init__.py
index 8d15d1e..536e5ee 100644
--- a/tiramisu/__init__.py
+++ b/tiramisu/__init__.py
@@ -12,8 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
-"""Configuration management library written in python
-"""
+"""Configuration management library written in python"""
from .function import (
calc_value,
calc_value_property_help,
diff --git a/tiramisu/api.py b/tiramisu/api.py
index a8855a7..3113580 100644
--- a/tiramisu/api.py
+++ b/tiramisu/api.py
@@ -141,19 +141,22 @@ class CommonTiramisu(TiramisuHelp):
raise ConfigError(str(err))
if id(self._subconfig.config_bag) != id(self._config_bag):
subconfig = self._subconfig
- self._subconfig = subconfig.__class__(option=subconfig.option,
- index=subconfig.index,
- path=subconfig.path,
- config_bag=self._config_bag,
- parent=subconfig.parent,
- identifiers=subconfig.identifiers,
- identifier=None,
- true_path=subconfig.true_path,
- properties=subconfig.properties,
- validate_properties=False,
- check_dynamic_without_identifiers=False,
- )
- self._subconfig.is_self_dynamic_without_identifiers = subconfig.is_self_dynamic_without_identifiers
+ self._subconfig = subconfig.__class__(
+ option=subconfig.option,
+ index=subconfig.index,
+ path=subconfig.path,
+ config_bag=self._config_bag,
+ parent=subconfig.parent,
+ identifiers=subconfig.identifiers,
+ identifier=None,
+ true_path=subconfig.true_path,
+ properties=subconfig.properties,
+ validate_properties=False,
+ check_dynamic_without_identifiers=False,
+ )
+ self._subconfig.is_self_dynamic_without_identifiers = (
+ subconfig.is_self_dynamic_without_identifiers
+ )
else:
self._subconfig._length = None
if not self._subconfig:
@@ -189,7 +192,11 @@ def option_type(types):
return func(self, options_bag, *args[1:], **kwargs)
self._set_subconfig()
if (
- "allow_dynoption" not in types and not ("dynoption_or_uncalculated" in types and kwargs.get("uncalculated", False) is True)
+ "allow_dynoption" not in types
+ and not (
+ "dynoption_or_uncalculated" in types
+ and kwargs.get("uncalculated", False) is True
+ )
) and self._subconfig.is_dynamic_without_identifiers:
raise AttributeOptionError(self._subconfig.path, "option-dynamic")
@@ -237,7 +244,13 @@ def option_type(types):
self.__class__.__name__, func.__name__
)
raise ConfigError(msg)
- if self._index is None and ("with_index" in types or ("with_index_or_uncalculated" in types and kwargs.get("uncalculated", False) is False)):
+ if self._index is None and (
+ "with_index" in types
+ or (
+ "with_index_or_uncalculated" in types
+ and kwargs.get("uncalculated", False) is False
+ )
+ ):
msg = _(
"please specify index with a follower option ({0}.{1})"
).format(self.__class__.__name__, func.__name__)
@@ -280,7 +293,7 @@ class CommonTiramisuOption(CommonTiramisu):
path: str,
index: Optional[int],
config_bag: ConfigBag,
- subconfig: Optional[SubConfig]=None,
+ subconfig: Optional[SubConfig] = None,
) -> None:
self._path = path
self._index = index
@@ -458,7 +471,11 @@ class _TiramisuOptionOptionDescription:
):
if subconfig.properties is None:
subconfig.properties = undefined
- if is_default and subconfig.config_bag.context.get_owner(subconfig) != owners.default:
+ if (
+ is_default
+ and subconfig.config_bag.context.get_owner(subconfig)
+ != owners.default
+ ):
continue
options.append(
TiramisuOption(
@@ -471,7 +488,11 @@ class _TiramisuOptionOptionDescription:
for subconfig in context.get_dynamic_from_dyn_option(
self._subconfig, option
):
- if is_default and subconfig.config_bag.context.get_owner(subconfig) != owners.default:
+ if (
+ is_default
+ and subconfig.config_bag.context.get_owner(subconfig)
+ != owners.default
+ ):
continue
options.append(
TiramisuOption(
@@ -495,17 +516,21 @@ class _TiramisuOptionOptionDescription:
current_indexes = [None]
for current_index in current_indexes:
t_option = TiramisuOption(
- option.impl_getpath(),
- current_index,
- self._config_bag,
- allow_dynoption=uncalculated,
- )
+ option.impl_getpath(),
+ current_index,
+ self._config_bag,
+ allow_dynoption=uncalculated,
+ )
t_option._set_subconfig()
subconfig = t_option._subconfig
- if is_default and subconfig.config_bag.context.get_owner(subconfig) != owners.default:
+ if (
+ is_default
+ and subconfig.config_bag.context.get_owner(subconfig)
+ != owners.default
+ ):
continue
options.append(
- t_option,
+ t_option,
)
return options
@@ -630,7 +655,10 @@ class _TiramisuOptionOptionDescription:
dynconfig = None
_subconfig = subconfig
while not dynconfig:
- if _subconfig.option.impl_is_optiondescription() and _subconfig.option.impl_is_dynoptiondescription():
+ if (
+ _subconfig.option.impl_is_optiondescription()
+ and _subconfig.option.impl_is_dynoptiondescription()
+ ):
dynconfig = _subconfig
else:
_subconfig = _subconfig.parent
@@ -649,18 +677,30 @@ class _TiramisuOptionOptionDescription:
"""
identifiers = []
while True:
- if subconfig.option.impl_is_optiondescription() and subconfig.option.impl_is_dynoptiondescription():
+ if (
+ subconfig.option.impl_is_optiondescription()
+ and subconfig.option.impl_is_dynoptiondescription()
+ ):
if not subconfig.is_self_dynamic_without_identifiers:
new_identifiers = [subconfig.identifiers[-1]]
else:
- new_identifiers = subconfig.option.get_identifiers(subconfig.parent, uncalculated=uncalculated, convert=convert)
+ new_identifiers = subconfig.option.get_identifiers(
+ subconfig.parent, uncalculated=uncalculated, convert=convert
+ )
if isinstance(new_identifiers, Calculation):
if identifiers:
- identifiers = [[new_identifiers] + old_identifiers for old_identifiers in identifiers]
+ identifiers = [
+ [new_identifiers] + old_identifiers
+ for old_identifiers in identifiers
+ ]
else:
identifiers = [new_identifiers]
elif identifiers:
- identifiers = [[identifier] + old_identifiers for identifier in new_identifiers for old_identifiers in identifiers]
+ identifiers = [
+ [identifier] + old_identifiers
+ for identifier in new_identifiers
+ for old_identifiers in identifiers
+ ]
else:
identifiers = [[identifier] for identifier in new_identifiers]
subconfig = subconfig.parent
@@ -682,7 +722,10 @@ class _TiramisuOptionOptionDescription:
dynconfig = None
_subconfig = subconfig
while not dynconfig:
- if _subconfig.option.impl_is_optiondescription() and _subconfig.option.impl_is_dynoptiondescription():
+ if (
+ _subconfig.option.impl_is_optiondescription()
+ and _subconfig.option.impl_is_dynoptiondescription()
+ ):
dynconfig = _subconfig
_subconfig = _subconfig.parent
return dynconfig.option.get_identifiers(
@@ -809,10 +852,7 @@ class TiramisuOptionOwner(CommonTiramisuOption):
"""Is option has defaut value"""
subconfig = self._subconfig
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
context = self._config_bag.context
subconfig = context._get(
@@ -844,7 +884,13 @@ class TiramisuOptionProperty(CommonTiramisuOption):
_validate_properties = False
@option_type(
- ["option", "optiondescription", "with_index_or_uncalculated", "symlink", "allow_dynoption"]
+ [
+ "option",
+ "optiondescription",
+ "with_index_or_uncalculated",
+ "symlink",
+ "allow_dynoption",
+ ]
)
def get(
self,
@@ -1065,7 +1111,15 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
_validate_properties = True
- @option_type(["option", "symlink", "with_index", "optiondescription", "dynoption_or_uncalculated"])
+ @option_type(
+ [
+ "option",
+ "symlink",
+ "with_index",
+ "optiondescription",
+ "dynoption_or_uncalculated",
+ ]
+ )
def get(
self,
*,
@@ -1129,7 +1183,13 @@ class TiramisuOptionValue(CommonTiramisuOption, _TiramisuODGet):
values.reset(self._subconfig)
@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(
self,
@@ -1338,7 +1398,7 @@ class TiramisuOption(
if subfunc in ["forcepermissive", "unrestraint", "nowarnings"]:
if subfunc == "unrestraint" and self._config_bag.is_unrestraint:
return self
- #if self._orig_config_bags:
+ # if self._orig_config_bags:
# msg = _(
# "do not use unrestraint, nowarnings or forcepermissive together"
# )
@@ -1428,6 +1488,8 @@ class TiramisuOption(
if self._tiramisu_dict is None: # pragma: no cover
self._load_dict()
return self._tiramisu_dict.set_updates(body)
+
+
#
# def forcepermissive(self):
# self._set_subconfig()
@@ -1502,20 +1564,25 @@ class TiramisuContextValue(TiramisuConfig, _TiramisuODGet):
only_mandatory=True,
):
if id(subconfig.config_bag) != id(config_bag):
- old_is_dynamic_without_identifiers = subconfig.is_self_dynamic_without_identifiers
- subconfig = subconfig.__class__(option=subconfig.option,
- index=subconfig.index,
- path=subconfig.path,
- config_bag=config_bag,
- parent=subconfig.parent,
- identifiers=subconfig.identifiers,
- identifier=None,
- true_path=subconfig.true_path,
- properties=subconfig.properties,
- validate_properties=False,
- check_dynamic_without_identifiers=False,
- )
- subconfig.is_self_dynamic_without_identifiers = old_is_dynamic_without_identifiers
+ old_is_dynamic_without_identifiers = (
+ subconfig.is_self_dynamic_without_identifiers
+ )
+ subconfig = subconfig.__class__(
+ option=subconfig.option,
+ index=subconfig.index,
+ path=subconfig.path,
+ config_bag=config_bag,
+ parent=subconfig.parent,
+ identifiers=subconfig.identifiers,
+ identifier=None,
+ true_path=subconfig.true_path,
+ properties=subconfig.properties,
+ validate_properties=False,
+ check_dynamic_without_identifiers=False,
+ )
+ subconfig.is_self_dynamic_without_identifiers = (
+ old_is_dynamic_without_identifiers
+ )
else:
subconfig._length = None
options.append(
@@ -2229,6 +2296,7 @@ class TiramisuAPI(TiramisuHelp):
class ConfigProp(TiramisuAPI, TiramisuContextOption):
pass
+
class Config(TiramisuAPI, TiramisuContextOption):
"""Root config object that enables us to handle the configuration options"""
@@ -2255,6 +2323,8 @@ class Config(TiramisuAPI, TiramisuContextOption):
permissives=permissives,
)
super().__init__(config_bag)
+
+
#
# def __del__(self):
# try:
diff --git a/tiramisu/autolib.py b/tiramisu/autolib.py
index 96074d8..6830f92 100644
--- a/tiramisu/autolib.py
+++ b/tiramisu/autolib.py
@@ -157,9 +157,9 @@ class ParamDynOption(ParamOption):
)
if not isinstance(identifiers, (list, Calculation)):
raise Exception(
- _("identifiers in ParamDynOption must be a list or a calculation, not {0}").format(
- identifiers
- )
+ _(
+ "identifiers in ParamDynOption must be a list or a calculation, not {0}"
+ ).format(identifiers)
)
if not isinstance(optional, bool):
raise Exception(
@@ -628,21 +628,26 @@ def manager_callback(
properties = config_bag.context.get_settings().getproperties(
subconfig,
uncalculated=True,
- ) - {'validator', 'mandatory', 'empty'}
+ ) - {"validator", "mandatory", "empty"}
for subconfig_ in subconfigs:
if subconfig.path == subconfig_.path:
values.append(orig_value)
else:
subconfig_.properties = properties
- values.append(get_value(
- config_bag,
- subconfig_,
- param,
- True,
- ))
+ values.append(
+ get_value(
+ config_bag,
+ subconfig_,
+ param,
+ True,
+ )
+ )
if callback.__name__ not in FUNCTION_WAITING_FOR_DICT:
return values
- return {"name": search_option.impl_get_display_name(subconfig), "value": values}
+ return {
+ "name": search_option.impl_get_display_name(subconfig),
+ "value": values,
+ }
else:
value = calc_self(
param,
@@ -779,7 +784,9 @@ def manager_callback(
or param.raisepropertyerror
):
raise err from err
- raise ConfigError(str(err), subconfig=subconfig) from err
+ raise ConfigError(
+ str(err), subconfig=subconfig
+ ) from err
parents = new_parents
if subconfigs_is_a_list:
subconfigs = parents
@@ -882,18 +889,19 @@ def carry_out_calculation(
config_bag = config_bag.copy()
config_bag.set_permissive()
old_is_dynamic_without_identifiers = subconfig.is_dynamic_without_identifiers
- subconfig = subconfig.__class__(option=subconfig.option,
- index=subconfig.index,
- path=subconfig.path,
- config_bag=config_bag,
- parent=subconfig.parent,
- identifiers=subconfig.identifiers,
- identifier=None,
- true_path=subconfig.true_path,
- properties=subconfig.properties,
- validate_properties=False,
- check_dynamic_without_identifiers=False,
- )
+ subconfig = subconfig.__class__(
+ option=subconfig.option,
+ index=subconfig.index,
+ path=subconfig.path,
+ config_bag=config_bag,
+ parent=subconfig.parent,
+ identifiers=subconfig.identifiers,
+ identifier=None,
+ true_path=subconfig.true_path,
+ properties=subconfig.properties,
+ validate_properties=False,
+ check_dynamic_without_identifiers=False,
+ )
subconfig.is_dynamic_without_identifiers = old_is_dynamic_without_identifiers
if callback_params:
for key, param in chain(
diff --git a/tiramisu/config.py b/tiramisu/config.py
index 7554f85..3fef8d1 100644
--- a/tiramisu/config.py
+++ b/tiramisu/config.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""options handler global entry point
-"""
+"""options handler global entry point"""
import weakref
from copy import copy, deepcopy
from typing import Optional, List, Any, Union
@@ -49,7 +48,7 @@ def get_common_path(path1, path2):
if common_path in all_paths:
# od.st is not the common_path of od.st_in
all_paths.remove(common_path)
- if all_paths[0].startswith(common_path + '.'):
+ if all_paths[0].startswith(common_path + "."):
return common_path
if common_path.endswith("."):
return common_path[:-1]
@@ -103,9 +102,11 @@ class CCache:
resetted_opts.append(subconfig.path)
config_bag = subconfig.config_bag
if not force:
- # if is_default and config_bag.context.get_owner(subconfig) != owners.default:
- # return
- for is_default, woption in subconfig.option.get_dependencies(subconfig.option):
+ # if is_default and config_bag.context.get_owner(subconfig) != owners.default:
+ # return
+ for is_default, woption in subconfig.option.get_dependencies(
+ subconfig.option
+ ):
option = woption()
if option.issubdyn():
# it's an option in dynoptiondescription, remove cache for all generated option
@@ -343,7 +344,13 @@ class SubConfig:
self.config_bag.context.get_settings().validate_properties(self)
self._properties = undefined
self.config_bag.context.get_settings().validate_properties(self)
- if validate_properties and self.apply_requires and self.option.impl_is_optiondescription() and self.path and self.properties is not None:
+ if (
+ 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()
self.transitive_properties = settings.calc_transitive_properties(
self,
@@ -526,7 +533,10 @@ class SubConfig:
)
if check_index and index is not None:
if option.impl_is_optiondescription() or not option.impl_is_follower():
- raise ConfigError("index must be set only with a follower option", subconfig=subsubconfig,)
+ raise ConfigError(
+ "index must be set only with a follower option",
+ subconfig=subsubconfig,
+ )
length = self.get_length_leadership()
if index >= length:
raise LeadershipError(
@@ -567,9 +577,11 @@ class SubConfig:
None,
validate_properties=False,
)
- subconfig.is_self_dynamic_without_identifiers = self.is_self_dynamic_without_identifiers
- #FIXME
- #self._length = len(cconfig_bag.context.get_value(subconfig))
+ subconfig.is_self_dynamic_without_identifiers = (
+ self.is_self_dynamic_without_identifiers
+ )
+ # FIXME
+ # self._length = len(cconfig_bag.context.get_value(subconfig))
length = len(cconfig_bag.context.get_value(subconfig))
return length
@@ -681,7 +693,9 @@ class SubConfig:
true_path=self.true_path,
validate_properties=False,
)
- subconfig.is_self_dynamic_without_identifiers = self.is_self_dynamic_without_identifiers
+ subconfig.is_self_dynamic_without_identifiers = (
+ self.is_self_dynamic_without_identifiers
+ )
return subconfig
@@ -1073,6 +1087,7 @@ class _Config(CCache):
class _CommonConfig(_Config):
"abstract base class for the Config, KernelGroupConfig and the KernelMetaConfig"
+
__slots__ = (
"_impl_values",
"_impl_values_cache",
@@ -1905,9 +1920,7 @@ class KernelMetaConfig(KernelMixConfig):
if descr is None:
descr = child.get_description()
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():
raise ValueError(
_(
diff --git a/tiramisu/error.py b/tiramisu/error.py
index 55b50d2..8dc116e 100644
--- a/tiramisu/error.py
+++ b/tiramisu/error.py
@@ -39,9 +39,9 @@ TiramisuErrorCode = Literal[
def display_list(
lst,
*,
- separator: str="and",
- add_quote: bool=False,
- sort: bool=True,
+ separator: str = "and",
+ add_quote: bool = False,
+ sort: bool = True,
) -> str():
if not lst:
return '""'
@@ -212,7 +212,7 @@ class ConfigError(Exception):
exp,
*,
prefix: Optional[str] = None,
- subconfig: Optional["Subconfig"]=None,
+ subconfig: Optional["Subconfig"] = None,
):
super().__init__(exp)
self.err_msg = exp
@@ -230,6 +230,7 @@ class ConfigError(Exception):
class ConflictError(Exception):
"duplicate options are present in a single config"
+
pass
@@ -308,6 +309,7 @@ class LeadershipError(Exception):
class ConstError(TypeError):
"no uniq value in _NameSpace"
+
pass
@@ -426,7 +428,8 @@ class Errors:
display_name = option.impl_get_display_name(subconfig, with_quote=True)
if original_error:
raise ConfigError(
- message.format(display_name, original_error, *extra_keys), subconfig=subconfig,
+ message.format(display_name, original_error, *extra_keys),
+ subconfig=subconfig,
) from original_error
raise ConfigError(message.format(display_name, extra_keys), subconfig=subconfig)
diff --git a/tiramisu/function.py b/tiramisu/function.py
index 8cbe94f..2d7f6df 100644
--- a/tiramisu/function.py
+++ b/tiramisu/function.py
@@ -12,8 +12,7 @@
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
-"""some functions to validates or calculates value
-"""
+"""some functions to validates or calculates value"""
from typing import Any, List, Optional
from operator import add, mul, sub, truediv
from ipaddress import ip_address, ip_interface, ip_network
diff --git a/tiramisu/option/__init__.py b/tiramisu/option/__init__.py
index 570d7dd..7c37117 100644
--- a/tiramisu/option/__init__.py
+++ b/tiramisu/option/__init__.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""all official option
-"""
+"""all official option"""
from .optiondescription import OptionDescription
from .dynoptiondescription import DynOptionDescription
from .leadership import Leadership
diff --git a/tiramisu/option/baseoption.py b/tiramisu/option/baseoption.py
index c3e7bd4..69786ce 100644
--- a/tiramisu/option/baseoption.py
+++ b/tiramisu/option/baseoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""base option
-"""
+"""base option"""
from typing import FrozenSet, Set, Any, List, Optional, Dict
import weakref
from itertools import chain
@@ -27,7 +26,13 @@ from itertools import chain
from ..i18n import _
from ..setting import undefined
-from ..autolib import Calculation, ParamOption, ParamSelfOption, ParamInformation, ParamSelfInformation
+from ..autolib import (
+ Calculation,
+ ParamOption,
+ ParamSelfOption,
+ ParamInformation,
+ ParamSelfInformation,
+)
STATIC_TUPLE = frozenset()
@@ -390,10 +395,7 @@ class BaseOption(Base):
self.value_dependency(value, is_identifier)
def value_dependency(
- self,
- value: Any,
- is_identifier: bool = False,
- type_: str = 'default'
+ self, value: Any, is_identifier: bool = False, type_: str = "default"
) -> Any:
if not isinstance(is_identifier, bool):
raise Exception()
diff --git a/tiramisu/option/booloption.py b/tiramisu/option/booloption.py
index 5428d84..75e421f 100644
--- a/tiramisu/option/booloption.py
+++ b/tiramisu/option/booloption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""BoolOption
-"""
+"""BoolOption"""
from ..i18n import _
from .option import Option
diff --git a/tiramisu/option/broadcastoption.py b/tiramisu/option/broadcastoption.py
index 8f8b8c0..1870d9a 100644
--- a/tiramisu/option/broadcastoption.py
+++ b/tiramisu/option/broadcastoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""BroadcastOption
-"""
+"""BroadcastOption"""
from ipaddress import ip_address
from ..i18n import _
diff --git a/tiramisu/option/choiceoption.py b/tiramisu/option/choiceoption.py
index 041e5de..e7bc634 100644
--- a/tiramisu/option/choiceoption.py
+++ b/tiramisu/option/choiceoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""ChoiceOption
-"""
+"""ChoiceOption"""
from typing import Any
from itertools import chain
diff --git a/tiramisu/option/dateoption.py b/tiramisu/option/dateoption.py
index a80b897..2db1efe 100644
--- a/tiramisu/option/dateoption.py
+++ b/tiramisu/option/dateoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""DateOption
-"""
+"""DateOption"""
from datetime import datetime
from ..i18n import _
diff --git a/tiramisu/option/domainnameoption.py b/tiramisu/option/domainnameoption.py
index d20de7e..d87a495 100644
--- a/tiramisu/option/domainnameoption.py
+++ b/tiramisu/option/domainnameoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""DomainnameOption
-"""
+"""DomainnameOption"""
import re
import socket
from ipaddress import ip_interface
diff --git a/tiramisu/option/dynoptiondescription.py b/tiramisu/option/dynoptiondescription.py
index 387a20f..89396b7 100644
--- a/tiramisu/option/dynoptiondescription.py
+++ b/tiramisu/option/dynoptiondescription.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""DynOptionDescription
-"""
+"""DynOptionDescription"""
import re
import weakref
from typing import List, Any, Optional, Dict
diff --git a/tiramisu/option/emailoption.py b/tiramisu/option/emailoption.py
index 9dc475a..e923f16 100644
--- a/tiramisu/option/emailoption.py
+++ b/tiramisu/option/emailoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""EmailOption
-"""
+"""EmailOption"""
import re
from ..i18n import _
diff --git a/tiramisu/option/filenameoption.py b/tiramisu/option/filenameoption.py
index 536c652..bb7e280 100644
--- a/tiramisu/option/filenameoption.py
+++ b/tiramisu/option/filenameoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""FilenameOption
-"""
+"""FilenameOption"""
from pathlib import Path
from ..i18n import _
diff --git a/tiramisu/option/floatoption.py b/tiramisu/option/floatoption.py
index eace175..7e6b8a0 100644
--- a/tiramisu/option/floatoption.py
+++ b/tiramisu/option/floatoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""FloatOption
-"""
+"""FloatOption"""
from ..i18n import _
from .option import Option
diff --git a/tiramisu/option/intoption.py b/tiramisu/option/intoption.py
index 98e90c6..e6f7541 100644
--- a/tiramisu/option/intoption.py
+++ b/tiramisu/option/intoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""IntOption
-"""
+"""IntOption"""
from ..i18n import _
from .option import Option
@@ -27,6 +26,7 @@ from .option import Option
class IntOption(Option):
"represents a choice of an integer"
+
__slots__ = tuple()
_type = "integer"
_t_type = _("integer")
diff --git a/tiramisu/option/ipoption.py b/tiramisu/option/ipoption.py
index 62705df..b612f98 100644
--- a/tiramisu/option/ipoption.py
+++ b/tiramisu/option/ipoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""IPOption
-"""
+"""IPOption"""
from ipaddress import ip_address, ip_interface
from ..i18n import _
diff --git a/tiramisu/option/leadership.py b/tiramisu/option/leadership.py
index 732a46d..7970341 100644
--- a/tiramisu/option/leadership.py
+++ b/tiramisu/option/leadership.py
@@ -74,7 +74,9 @@ class Leadership(OptionDescription):
self._check_default_value(child)
# remove empty property for follower
if not child.impl_is_submulti():
- child._properties = frozenset(child._properties - {"empty", "unique"})
+ child._properties = frozenset(
+ child._properties - {"empty", "unique"}
+ )
followers.append(child)
child._add_dependency(self, "leadership")
child._leadership = weakref.ref(self)
diff --git a/tiramisu/option/macoption.py b/tiramisu/option/macoption.py
index af3f47d..ef41582 100644
--- a/tiramisu/option/macoption.py
+++ b/tiramisu/option/macoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""MACOption
-"""
+"""MACOption"""
import re
from ..i18n import _
diff --git a/tiramisu/option/netmaskoption.py b/tiramisu/option/netmaskoption.py
index 3e6bed7..aed7180 100644
--- a/tiramisu/option/netmaskoption.py
+++ b/tiramisu/option/netmaskoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""NetmaskOption
-"""
+"""NetmaskOption"""
from ipaddress import ip_network
from ..i18n import _
from .stroption import StrOption
diff --git a/tiramisu/option/networkoption.py b/tiramisu/option/networkoption.py
index e5f6f9f..f8974a1 100644
--- a/tiramisu/option/networkoption.py
+++ b/tiramisu/option/networkoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""NetworkOption
-"""
+"""NetworkOption"""
from ipaddress import ip_network
from ..i18n import _
@@ -29,6 +28,7 @@ from .stroption import StrOption
class NetworkOption(IPOption):
"represents the choice of a network"
+
__slots__ = tuple()
_type = "network address"
_t_type = _("network address")
diff --git a/tiramisu/option/optiondescription.py b/tiramisu/option/optiondescription.py
index 09dacc3..d995706 100644
--- a/tiramisu/option/optiondescription.py
+++ b/tiramisu/option/optiondescription.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""OptionDescription
-"""
+"""OptionDescription"""
import weakref
from typing import Optional, Iterator, Union, List, Dict
@@ -29,7 +28,12 @@ from ..setting import ConfigBag, groups, undefined, owners, Undefined
from .baseoption import BaseOption
# from .syndynoption import SubDynOptionDescription, SynDynOptionDescription
-from ..error import ConfigError, ConflictError, AttributeOptionError, PropertiesOptionError
+from ..error import (
+ ConfigError,
+ ConflictError,
+ AttributeOptionError,
+ PropertiesOptionError,
+)
class CacheOptionDescription(BaseOption):
diff --git a/tiramisu/option/passwordoption.py b/tiramisu/option/passwordoption.py
index 2ae5804..5650db1 100644
--- a/tiramisu/option/passwordoption.py
+++ b/tiramisu/option/passwordoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""PasswordOption
-"""
+"""PasswordOption"""
from ..i18n import _
from ..error import display_list
diff --git a/tiramisu/option/permissionsoption.py b/tiramisu/option/permissionsoption.py
index 4d95356..1303a16 100644
--- a/tiramisu/option/permissionsoption.py
+++ b/tiramisu/option/permissionsoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""PermissionsOption
-"""
+"""PermissionsOption"""
import re
from ..i18n import _
diff --git a/tiramisu/option/portoption.py b/tiramisu/option/portoption.py
index 80ba461..5b2c2dc 100644
--- a/tiramisu/option/portoption.py
+++ b/tiramisu/option/portoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""PortOption
-"""
+"""PortOption"""
from ..i18n import _
from .stroption import StrOption
diff --git a/tiramisu/option/stroption.py b/tiramisu/option/stroption.py
index 3e08658..26564a4 100644
--- a/tiramisu/option/stroption.py
+++ b/tiramisu/option/stroption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""StrOption and RegexpOption
-"""
+"""StrOption and RegexpOption"""
from typing import Any
from ..i18n import _
diff --git a/tiramisu/option/symlinkoption.py b/tiramisu/option/symlinkoption.py
index 3233db5..89cb7c8 100644
--- a/tiramisu/option/symlinkoption.py
+++ b/tiramisu/option/symlinkoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# 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 .baseoption import BaseOption, valid_name
from ..i18n import _
diff --git a/tiramisu/option/urloption.py b/tiramisu/option/urloption.py
index d54509a..139e8bb 100644
--- a/tiramisu/option/urloption.py
+++ b/tiramisu/option/urloption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# the whole pypy projet is under MIT licence
# ____________________________________________________________
-"""URLOption to check url value
-"""
+"""URLOption to check url value"""
import re
from typing import Any, Optional, List, Dict
diff --git a/tiramisu/option/usernameoption.py b/tiramisu/option/usernameoption.py
index 79c1586..ecc0219 100644
--- a/tiramisu/option/usernameoption.py
+++ b/tiramisu/option/usernameoption.py
@@ -18,8 +18,7 @@
# the rough pypy's guys: http://codespeak.net/svn/pypy/dist/pypy/config/
# 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
from ..i18n import _
diff --git a/tiramisu/setting.py b/tiramisu/setting.py
index 82d3ce9..b6cde28 100644
--- a/tiramisu/setting.py
+++ b/tiramisu/setting.py
@@ -144,8 +144,7 @@ RW_REMOVE = frozenset(
PROPERTIES_MAKE_SENSE = (
- "cache"
- "demoting_error_warning",
+ "cache" "demoting_error_warning",
"disabled",
"empty",
"everything_frozen",
@@ -378,6 +377,7 @@ forbidden_owners = (owners.default, owners.forced) # pylint: disable=no-member
# ____________________________________________________________
class Settings:
"``config.Config()``'s configuration options settings"
+
__slots__ = (
"_properties",
"_permissives",
diff --git a/tiramisu/value.py b/tiramisu/value.py
index ebd7249..d878ebf 100644
--- a/tiramisu/value.py
+++ b/tiramisu/value.py
@@ -122,8 +122,8 @@ class Values:
# get it
value = self.get_default_value(subconfig)
if owner == owners.default:
- if(
- "force_store_value" in subconfig.config_bag.properties
+ if (
+ "force_store_value" in subconfig.config_bag.properties
and "force_store_value" in self_properties
):
value = self.get_default_value(subconfig)
@@ -163,9 +163,7 @@ class Values:
msubconfig = self._get_modified_parent(subconfig)
if msubconfig is not None:
# 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
def get_default_value(
@@ -342,7 +340,7 @@ class Values:
subconfig,
value,
)
-# parent._length = len(value)
+ # parent._length = len(value)
leader.follower_force_store_value(
value,
parent,
@@ -569,14 +567,11 @@ class Values:
:returns: a `setting.owners.Owner` object
"""
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
setting_properties = subconfig.config_bag.properties
if (
- "force_store_value" in setting_properties
+ "force_store_value" in setting_properties
and "force_store_value" in self_properties
):
self.set_force_store_value(subconfig)