feat: name and type for a config
This commit is contained in:
parent
71fbe6dcbd
commit
2c091f7a12
2 changed files with 18 additions and 8 deletions
|
|
@ -50,7 +50,13 @@ def make_metaconfig(double=False):
|
||||||
conf2.property.read_write()
|
conf2.property.read_write()
|
||||||
meta = MetaConfig([conf1, conf2], name='meta')
|
meta = MetaConfig([conf1, conf2], name='meta')
|
||||||
assert meta.config.type() == 'metaconfig'
|
assert meta.config.type() == 'metaconfig'
|
||||||
|
assert meta.type() == 'metaconfig'
|
||||||
assert meta.config.name() == 'meta'
|
assert meta.config.name() == 'meta'
|
||||||
|
assert meta.name() == 'meta'
|
||||||
|
assert conf1.config.type() == 'config'
|
||||||
|
assert conf1.type() == 'config'
|
||||||
|
assert conf1.config.name() == 'conf1'
|
||||||
|
assert conf1.name() == 'conf1'
|
||||||
if double:
|
if double:
|
||||||
meta.owner.set(owners.meta2)
|
meta.owner.set(owners.meta2)
|
||||||
meta = MetaConfig([meta], name='doublemeta')
|
meta = MetaConfig([meta], name='doublemeta')
|
||||||
|
|
|
||||||
|
|
@ -1211,6 +1211,18 @@ class TiramisuConfig(TiramisuHelp, _TiramisuOptionWalk):
|
||||||
if isinstance(config, KernelGroupConfig):
|
if isinstance(config, KernelGroupConfig):
|
||||||
return GroupConfig(config)
|
return GroupConfig(config)
|
||||||
|
|
||||||
|
def type(self):
|
||||||
|
"""get the type"""
|
||||||
|
config = self._config_bag.context
|
||||||
|
if isinstance(config, KernelConfig):
|
||||||
|
return "config"
|
||||||
|
if isinstance(config, KernelMetaConfig):
|
||||||
|
return "metaconfig"
|
||||||
|
if isinstance(config, KernelMixConfig):
|
||||||
|
return "mixconfig"
|
||||||
|
if isinstance(config, KernelGroupConfig):
|
||||||
|
return "groupconfig"
|
||||||
|
|
||||||
def name(self):
|
def name(self):
|
||||||
"""get the name"""
|
"""get the name"""
|
||||||
return self._config_bag.context.impl_getname()
|
return self._config_bag.context.impl_getname()
|
||||||
|
|
@ -1826,10 +1838,6 @@ class TiramisuContextOption(TiramisuConfig, _TiramisuOptionWalk):
|
||||||
None,
|
None,
|
||||||
)
|
)
|
||||||
|
|
||||||
def name(self):
|
|
||||||
"""Get option name"""
|
|
||||||
return None
|
|
||||||
|
|
||||||
def path(
|
def path(
|
||||||
self,
|
self,
|
||||||
):
|
):
|
||||||
|
|
@ -1851,10 +1859,6 @@ class TiramisuContextOption(TiramisuConfig, _TiramisuOptionWalk):
|
||||||
"""Test if option is a dynamic optiondescription"""
|
"""Test if option is a dynamic optiondescription"""
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def type(self):
|
|
||||||
"""Get de option type"""
|
|
||||||
return "optiondescription"
|
|
||||||
|
|
||||||
def list(
|
def list(
|
||||||
self,
|
self,
|
||||||
*,
|
*,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue