remove unecessary unwrap_from_path function
This commit is contained in:
parent
41c17004d2
commit
87e2f422b7
|
@ -21,7 +21,6 @@ def test_option_valid_name():
|
|||
IntOption("test1", "")
|
||||
raises(ValueError, 'IntOption("impl_test", "")')
|
||||
raises(ValueError, 'IntOption("_test", "")')
|
||||
raises(ValueError, 'IntOption("unwrap_from_path", "")')
|
||||
raises(ValueError, 'IntOption(" ", "")')
|
||||
|
||||
|
||||
|
|
|
@ -51,7 +51,6 @@ def test_optname_shall_not_start_with_numbers():
|
|||
|
||||
def test_option_has_an_api_name():
|
||||
raises(ValueError, "BoolOption('cfgimpl_get_settings', 'dummy', default=False)")
|
||||
raises(ValueError, "BoolOption('unwrap_from_path', 'dummy', default=False)")
|
||||
raises(ValueError, "BoolOption('impl_getdoc', 'dummy', default=False)")
|
||||
raises(ValueError, "BoolOption('_unvalid', 'dummy', default=False)")
|
||||
raises(ValueError, "BoolOption('6unvalid', 'dummy', default=False)")
|
||||
|
|
|
@ -613,8 +613,6 @@ class TiramisuOption(CommonTiramisu):
|
|||
option_bag: Optional[OptionBag]=None) -> None:
|
||||
self._name = name
|
||||
self.subconfig = subconfig
|
||||
if subconfig == None:
|
||||
raise Exception()
|
||||
self._path = path
|
||||
self.index = index
|
||||
self.config_bag = config_bag
|
||||
|
|
|
@ -401,8 +401,15 @@ class SubConfig(object):
|
|||
elif config_bag.validate_properties:
|
||||
#remove option with propertyerror, ...
|
||||
try:
|
||||
self.unwrap_from_path(path,
|
||||
config_bag)
|
||||
if '.' in path:
|
||||
subconfig, subpath = self.cfgimpl_get_home_by_path(path,
|
||||
config_bag)
|
||||
else:
|
||||
subconfig = self
|
||||
subpath = path
|
||||
subconfig.cfgimpl_get_description().impl_getchild(subpath,
|
||||
config_bag,
|
||||
subconfig)
|
||||
self.cfgimpl_get_settings().validate_properties(option_bag)
|
||||
except PropertiesOptionError:
|
||||
continue
|
||||
|
@ -476,8 +483,15 @@ class SubConfig(object):
|
|||
_subpath=self.cfgimpl_get_path(False),
|
||||
config_bag=config_bag):
|
||||
path = '.'.join(path.split('.')[:-1])
|
||||
opt = context.unwrap_from_path(path,
|
||||
config_bag)
|
||||
if '.' in path:
|
||||
subconfig, subpath = context.cfgimpl_get_home_by_path(path,
|
||||
config_bag)
|
||||
else:
|
||||
subconfig = context
|
||||
subpath = path
|
||||
opt = subconfig.cfgimpl_get_description().impl_getchild(subpath,
|
||||
config_bag,
|
||||
subconfig)
|
||||
soption_bag = OptionBag()
|
||||
soption_bag.set_option(opt,
|
||||
path,
|
||||
|
@ -588,36 +602,6 @@ class _CommonConfig(SubConfig):
|
|||
descr._build_cache(self)
|
||||
descr.impl_build_force_store_values(self)
|
||||
|
||||
def unwrap_from_path(self,
|
||||
path,
|
||||
config_bag):
|
||||
"""convenience method to extract and Option() object from the Config()
|
||||
and it is **fast**: finds the option directly in the appropriate
|
||||
namespace
|
||||
|
||||
:returns: Option()
|
||||
"""
|
||||
if '.' in path:
|
||||
self, path = self.cfgimpl_get_home_by_path(path,
|
||||
config_bag)
|
||||
option = self.cfgimpl_get_description().impl_getchild(path,
|
||||
config_bag,
|
||||
self)
|
||||
if not config_bag.validate_properties:
|
||||
return option
|
||||
else:
|
||||
if option.impl_is_symlinkoption():
|
||||
true_option = option.impl_getopt()
|
||||
context = self.cfgimpl_get_context()
|
||||
true_path = true_option.impl_getpath(context)
|
||||
self, path = context.cfgimpl_get_home_by_path(path,
|
||||
config_bag)
|
||||
config_bag.option = true_option
|
||||
else:
|
||||
true_path = path
|
||||
#config_bag.option = option
|
||||
return option
|
||||
|
||||
def cfgimpl_get_path(self, dyn=True):
|
||||
return None
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ STATIC_TUPLE = frozenset()
|
|||
submulti = 2
|
||||
NAME_REGEXP = re.compile(r'^[a-zA-Z][a-zA-Z\d_-]*$')
|
||||
FORBIDDEN_NAMES = frozenset(['iter_all', 'iter_group', 'find', 'find_first',
|
||||
'make_dict', 'unwrap_from_path', 'read_only',
|
||||
'make_dict', 'read_only',
|
||||
'read_write', 'getowner', 'set_contexts'])
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue