PathConfig => MixConfig

This commit is contained in:
Emmanuel Garette 2018-10-31 18:26:20 +01:00
parent 4f4ecfd3a8
commit f83937a143
5 changed files with 1128 additions and 1128 deletions

1112
test/test_mixconfig.py Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -15,7 +15,7 @@
from .function import Params, ParamOption, ParamValue, ParamContext
from .option import *
from .error import APIError
from .api import Config, MetaConfig, GroupConfig, PathConfig
from .api import Config, MetaConfig, GroupConfig, MixConfig
from .option import __all__ as all_options
from .setting import owners, undefined
@ -25,7 +25,7 @@ allfuncs = ['Params',
'ParamValue',
'ParamContext',
'MetaConfig',
'PathConfig',
'MixConfig',
'GroupConfig',
'Config',
'APIError',

View file

@ -22,7 +22,7 @@ from typing import List, Any, Optional, Callable, Union, Dict
from .error import APIError, ConfigError, SlaveError, PropertiesOptionError
from .i18n import _
from .setting import ConfigBag, OptionBag, owners, groups, Undefined, undefined, FORBIDDEN_SET_PROPERTIES
from .config import KernelConfig, SubConfig, KernelGroupConfig, KernelMetaConfig, KernelPathConfig
from .config import KernelConfig, SubConfig, KernelGroupConfig, KernelMetaConfig, KernelMixConfig
from .option import ChoiceOption, OptionDescription
@ -1140,8 +1140,8 @@ class _TiramisuContextGroupConfig(TiramisuContext):
return Config(config)
class _TiramisuContextPathConfig(_TiramisuContextGroupConfig, _TiramisuContextConfigReset):
"""Actions to PathConfig"""
class _TiramisuContextMixConfig(_TiramisuContextGroupConfig, _TiramisuContextConfigReset):
"""Actions to MixConfig"""
pass
@ -1193,8 +1193,8 @@ class TiramisuAPI(TiramisuHelp):
config = _TiramisuContextGroupConfig
elif config_type == 'meta':
config = _TiramisuContextMetaConfig
elif config_type == 'path':
config = _TiramisuContextPathConfig
elif config_type == 'mix':
config = _TiramisuContextMixConfig
else:
config = _TiramisuContextConfig
return config(self._config_bag)
@ -1267,7 +1267,7 @@ class MetaConfig(TiramisuAPI):
super().__init__(config)
class PathConfig(TiramisuAPI):
class MixConfig(TiramisuAPI):
"""MetaConfig object that enables us to handle the sub configuration's options"""
def __init__(self,
optiondescription: OptionDescription,
@ -1281,7 +1281,7 @@ class PathConfig(TiramisuAPI):
else:
_children.append(child)
config = KernelPathConfig(optiondescription,
config = KernelMixConfig(optiondescription,
_children,
session_id=session_id,
persistent=persistent)

View file

@ -671,7 +671,7 @@ class _CommonConfig(SubConfig):
metaconfig_prefix=None,
child=None,
deep=False):
assert isinstance(self, (KernelConfig, KernelPathConfig)), _('cannot duplicate {}').format(self.__class__.__name__)
assert isinstance(self, (KernelConfig, KernelMixConfig)), _('cannot duplicate {}').format(self.__class__.__name__)
if isinstance(self, KernelConfig):
duplicated_config = KernelConfig(self._impl_descr,
_duplicate=True,
@ -812,7 +812,7 @@ class KernelGroupConfig(_CommonConfig):
resetted_opts=None):
if resetted_opts is None:
resetted_opts = []
if isinstance(self, KernelPathConfig):
if isinstance(self, KernelMixConfig):
super().cfgimpl_reset_cache(option_bag,
resetted_opts=copy(resetted_opts))
for child in self._impl_children:
@ -889,7 +889,7 @@ class KernelGroupConfig(_CommonConfig):
#so search only one time the option for all children
if bypath is undefined and byname is not None and \
isinstance(self,
KernelPathConfig):
KernelMixConfig):
bypath = next(self.find(bytype=None,
byvalue=undefined,
byname=byname,
@ -959,9 +959,9 @@ class KernelGroupConfig(_CommonConfig):
raise ConfigError(_('unknown config "{}"').format(name))
class KernelPathConfig(KernelGroupConfig):
class KernelMixConfig(KernelGroupConfig):
__slots__ = tuple()
impl_type = 'path'
impl_type = 'mix'
def __init__(self,
optiondescription,
@ -1147,7 +1147,7 @@ class KernelPathConfig(KernelGroupConfig):
_commit=False)
except AttributeError:
pass
if isinstance(child, KernelPathConfig):
if isinstance(child, KernelMixConfig):
child.reset(path,
False,
rconfig_bag,
@ -1160,7 +1160,7 @@ class KernelPathConfig(KernelGroupConfig):
self.cfgimpl_get_values()._p_.commit()
class KernelMetaConfig(KernelPathConfig):
class KernelMetaConfig(KernelMixConfig):
__slots__ = tuple()
impl_type = 'meta'