context is not needed for impl_getpath
This commit is contained in:
parent
4b0c142e3e
commit
09c9fa4906
|
@ -50,7 +50,7 @@ def manager_callback(callbk: Union[ParamOption, ParamValue],
|
||||||
if opt.issubdyn():
|
if opt.issubdyn():
|
||||||
opt = opt.impl_get_dynoption(option._rootpath,
|
opt = opt.impl_get_dynoption(option._rootpath,
|
||||||
option.impl_getsuffix())
|
option.impl_getsuffix())
|
||||||
path = opt.impl_getpath(context)
|
path = opt.impl_getpath()
|
||||||
if index is not None and opt.impl_is_master_slaves() and \
|
if index is not None and opt.impl_is_master_slaves() and \
|
||||||
opt.impl_get_master_slaves().in_same_group(option):
|
opt.impl_get_master_slaves().in_same_group(option):
|
||||||
if opt == option:
|
if opt == option:
|
||||||
|
|
|
@ -96,12 +96,7 @@ class SubConfig(object):
|
||||||
option_bag):
|
option_bag):
|
||||||
if option_bag.option.impl_is_symlinkoption():
|
if option_bag.option.impl_is_symlinkoption():
|
||||||
context = self.cfgimpl_get_context()
|
context = self.cfgimpl_get_context()
|
||||||
#soption_bag = OptionBag()
|
path = option_bag.option.impl_getopt().impl_getpath()
|
||||||
#soption_bag.set_option(option_bag.option.impl_getopt(),
|
|
||||||
# option_bag.option.impl_getopt().impl_getpath(context),
|
|
||||||
# None,
|
|
||||||
# option_bag.config_bag)
|
|
||||||
path = option_bag.option.impl_getopt().impl_getpath(context)
|
|
||||||
subconfig, _ = context.cfgimpl_get_home_by_path(path,
|
subconfig, _ = context.cfgimpl_get_home_by_path(path,
|
||||||
option_bag.config_bag)
|
option_bag.config_bag)
|
||||||
return subconfig.cfgimpl_get_length()
|
return subconfig.cfgimpl_get_length()
|
||||||
|
@ -123,7 +118,7 @@ class SubConfig(object):
|
||||||
if option.impl_is_dynoptiondescription():
|
if option.impl_is_dynoptiondescription():
|
||||||
for doption in option.get_syndynoptiondescriptions(option_bag,
|
for doption in option.get_syndynoptiondescriptions(option_bag,
|
||||||
remove_none=True):
|
remove_none=True):
|
||||||
doption_path = doption.impl_getpath(self)
|
doption_path = doption.impl_getpath()
|
||||||
doption_bag = OptionBag()
|
doption_bag = OptionBag()
|
||||||
doption_bag.set_option(doption,
|
doption_bag.set_option(doption,
|
||||||
doption_path,
|
doption_path,
|
||||||
|
@ -136,13 +131,13 @@ class SubConfig(object):
|
||||||
doption_bag)
|
doption_bag)
|
||||||
elif option.issubdyn():
|
elif option.issubdyn():
|
||||||
doption_bag = OptionBag()
|
doption_bag = OptionBag()
|
||||||
doption_path = option.impl_getpath(self)
|
doption_path = option.impl_getpath()
|
||||||
doption_bag.set_option(option,
|
doption_bag.set_option(option,
|
||||||
doption_path,
|
doption_path,
|
||||||
option_bag.index,
|
option_bag.index,
|
||||||
option_bag.config_bag)
|
option_bag.config_bag)
|
||||||
for doption in desc.build_dynoptions(doption_bag):
|
for doption in desc.build_dynoptions(doption_bag):
|
||||||
doption_path = doption.impl_getpath(self)
|
doption_path = doption.impl_getpath()
|
||||||
doption_bag = OptionBag()
|
doption_bag = OptionBag()
|
||||||
doption_bag.set_option(doption,
|
doption_bag.set_option(doption,
|
||||||
doption_path,
|
doption_path,
|
||||||
|
@ -154,7 +149,7 @@ class SubConfig(object):
|
||||||
resetted_opts,
|
resetted_opts,
|
||||||
doption_bag)
|
doption_bag)
|
||||||
else:
|
else:
|
||||||
option_path = option.impl_getpath(self)
|
option_path = option.impl_getpath()
|
||||||
doption_bag = OptionBag()
|
doption_bag = OptionBag()
|
||||||
doption_bag.set_option(option,
|
doption_bag.set_option(option,
|
||||||
option_path,
|
option_path,
|
||||||
|
@ -625,8 +620,7 @@ class SubConfig(object):
|
||||||
dyn=True):
|
dyn=True):
|
||||||
descr = self.cfgimpl_get_description()
|
descr = self.cfgimpl_get_description()
|
||||||
if not dyn and descr.impl_is_dynoptiondescription():
|
if not dyn and descr.impl_is_dynoptiondescription():
|
||||||
context_descr = self.cfgimpl_get_context().cfgimpl_get_description()
|
return descr.impl_getopt().impl_getpath()
|
||||||
return descr.impl_getopt().impl_getpath(context_descr)
|
|
||||||
return self._impl_path
|
return self._impl_path
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -415,10 +415,8 @@ class BaseOption(Base):
|
||||||
name))
|
name))
|
||||||
super(BaseOption, self).__setattr__(name, value)
|
super(BaseOption, self).__setattr__(name, value)
|
||||||
|
|
||||||
def impl_getpath(self,
|
def impl_getpath(self):
|
||||||
context):
|
|
||||||
return self._path
|
return self._path
|
||||||
#return context.cfgimpl_get_description().impl_get_path_by_opt(self)
|
|
||||||
|
|
||||||
def impl_has_callback(self):
|
def impl_has_callback(self):
|
||||||
"to know if a callback has been defined or not"
|
"to know if a callback has been defined or not"
|
||||||
|
|
|
@ -105,7 +105,7 @@ class DynOptionDescription(OptionDescription):
|
||||||
def get_syndynoptiondescriptions(self,
|
def get_syndynoptiondescriptions(self,
|
||||||
option_bag,
|
option_bag,
|
||||||
remove_none=False):
|
remove_none=False):
|
||||||
subpath = self.impl_getpath(option_bag.config_bag.context).rsplit('.', 1)[0]
|
subpath = self.impl_getpath().rsplit('.', 1)[0]
|
||||||
for suffix in self.impl_get_suffixes(option_bag,
|
for suffix in self.impl_get_suffixes(option_bag,
|
||||||
remove_none=remove_none):
|
remove_none=remove_none):
|
||||||
yield SynDynOptionDescription(self,
|
yield SynDynOptionDescription(self,
|
||||||
|
|
|
@ -57,8 +57,7 @@ class DynSymLinkOption(object):
|
||||||
def impl_getsuffix(self):
|
def impl_getsuffix(self):
|
||||||
return self._suffix
|
return self._suffix
|
||||||
|
|
||||||
def impl_getpath(self,
|
def impl_getpath(self):
|
||||||
context):
|
|
||||||
return self._rootpath + '.' + self.impl_getname()
|
return self._rootpath + '.' + self.impl_getname()
|
||||||
|
|
||||||
def impl_validate(self,
|
def impl_validate(self,
|
||||||
|
@ -69,7 +68,7 @@ class DynSymLinkOption(object):
|
||||||
context = option_bag.config_bag.context
|
context = option_bag.config_bag.context
|
||||||
soption_bag = OptionBag()
|
soption_bag = OptionBag()
|
||||||
soption_bag.set_option(self._opt,
|
soption_bag.set_option(self._opt,
|
||||||
self.impl_getpath(context),
|
self.impl_getpath(),
|
||||||
option_bag.index,
|
option_bag.index,
|
||||||
option_bag.config_bag)
|
option_bag.config_bag)
|
||||||
soption_bag.ori_option = option_bag.option
|
soption_bag.ori_option = option_bag.option
|
||||||
|
|
|
@ -125,7 +125,7 @@ class MasterSlaves(OptionDescription):
|
||||||
config_bag = option_bag.config_bag.copy()
|
config_bag = option_bag.config_bag.copy()
|
||||||
config_bag.remove_validation()
|
config_bag.remove_validation()
|
||||||
for slave in self.getslaves():
|
for slave in self.getslaves():
|
||||||
slave_path = slave.impl_getpath(option_bag.config_bag.context)
|
slave_path = slave.impl_getpath()
|
||||||
soption_bag = OptionBag()
|
soption_bag = OptionBag()
|
||||||
soption_bag.set_option(slave,
|
soption_bag.set_option(slave,
|
||||||
slave_path,
|
slave_path,
|
||||||
|
@ -140,13 +140,12 @@ class MasterSlaves(OptionDescription):
|
||||||
option_bag,
|
option_bag,
|
||||||
slaves=undefined):
|
slaves=undefined):
|
||||||
|
|
||||||
context = option_bag.config_bag.context
|
|
||||||
if slaves is undefined:
|
if slaves is undefined:
|
||||||
slaves = self.getslaves()
|
slaves = self.getslaves()
|
||||||
config_bag = option_bag.config_bag.copy()
|
config_bag = option_bag.config_bag.copy()
|
||||||
config_bag.remove_validation()
|
config_bag.remove_validation()
|
||||||
for slave in slaves:
|
for slave in slaves:
|
||||||
slave_path = slave.impl_getpath(context)
|
slave_path = slave.impl_getpath()
|
||||||
slavelen = values._p_.get_max_length(slave_path)
|
slavelen = values._p_.get_max_length(slave_path)
|
||||||
soption_bag = OptionBag()
|
soption_bag = OptionBag()
|
||||||
soption_bag.set_option(slave,
|
soption_bag.set_option(slave,
|
||||||
|
@ -191,14 +190,13 @@ class MasterSlaves(OptionDescription):
|
||||||
values,
|
values,
|
||||||
settings,
|
settings,
|
||||||
resetted_opts)
|
resetted_opts)
|
||||||
context = values.context()
|
mpath = master.impl_getpath()
|
||||||
mpath = master.impl_getpath(context)
|
|
||||||
master.reset_cache(mpath,
|
master.reset_cache(mpath,
|
||||||
values,
|
values,
|
||||||
settings,
|
settings,
|
||||||
None)
|
None)
|
||||||
for slave in slaves:
|
for slave in slaves:
|
||||||
spath = slave.impl_getpath(context)
|
spath = slave.impl_getpath()
|
||||||
slave.reset_cache(spath,
|
slave.reset_cache(spath,
|
||||||
values,
|
values,
|
||||||
settings,
|
settings,
|
||||||
|
|
|
@ -535,7 +535,7 @@ class Option(OnlyOption):
|
||||||
#if no context get default value
|
#if no context get default value
|
||||||
return current_option.impl_getdefault()
|
return current_option.impl_getdefault()
|
||||||
#otherwise calculate value
|
#otherwise calculate value
|
||||||
path = current_option.impl_getpath(context)
|
path = current_option.impl_getpath()
|
||||||
coption_bag = OptionBag()
|
coption_bag = OptionBag()
|
||||||
coption_bag.set_option(current_option,
|
coption_bag.set_option(current_option,
|
||||||
path,
|
path,
|
||||||
|
|
|
@ -231,10 +231,9 @@ class OptionDescriptionWalk(CacheOptionDescription):
|
||||||
option_bag):
|
option_bag):
|
||||||
option = option_bag.option
|
option = option_bag.option
|
||||||
dynopt = option.getsubdyn()
|
dynopt = option.getsubdyn()
|
||||||
rootpath = dynopt.impl_getpath(option_bag.config_bag.context)
|
rootpath = dynopt.impl_getpath()
|
||||||
ori_index = len(rootpath) + 1
|
ori_index = len(rootpath) + 1
|
||||||
subpaths = [rootpath] + option.impl_getpath(
|
subpaths = [rootpath] + option.impl_getpath()[ori_index:].split('.')[:-1]
|
||||||
option_bag.config_bag.context)[ori_index:].split('.')[:-1]
|
|
||||||
for suffix in dynopt.impl_get_suffixes(option_bag):
|
for suffix in dynopt.impl_get_suffixes(option_bag):
|
||||||
subpath = '.'.join([subp + suffix for subp in subpaths])
|
subpath = '.'.join([subp + suffix for subp in subpaths])
|
||||||
if isinstance(option, OnlyOption):
|
if isinstance(option, OnlyOption):
|
||||||
|
@ -268,7 +267,7 @@ class OptionDescriptionWalk(CacheOptionDescription):
|
||||||
config_bag)
|
config_bag)
|
||||||
for doption in self.build_dynoptions(option_bag):
|
for doption in self.build_dynoptions(option_bag):
|
||||||
if byname == doption.impl_getname():
|
if byname == doption.impl_getname():
|
||||||
dpath = doption.impl_getpath(config_bag.context)
|
dpath = doption.impl_getpath()
|
||||||
return (dpath, doption)
|
return (dpath, doption)
|
||||||
elif byname == name:
|
elif byname == name:
|
||||||
return (path, option)
|
return (path, option)
|
||||||
|
@ -327,7 +326,7 @@ class OptionDescriptionWalk(CacheOptionDescription):
|
||||||
if config_bag.context.cfgimpl_get_description() == self:
|
if config_bag.context.cfgimpl_get_description() == self:
|
||||||
subpath = ''
|
subpath = ''
|
||||||
else:
|
else:
|
||||||
subpath = self.impl_getpath(config_bag.context)
|
subpath = self.impl_getpath()
|
||||||
option_bag = OptionBag()
|
option_bag = OptionBag()
|
||||||
option_bag.set_option(child,
|
option_bag.set_option(child,
|
||||||
subpath,
|
subpath,
|
||||||
|
|
|
@ -66,13 +66,13 @@ class SynDynOptionDescription(object):
|
||||||
config_bag,
|
config_bag,
|
||||||
dyn=True):
|
dyn=True):
|
||||||
children = []
|
children = []
|
||||||
subpath = self.impl_getpath(config_bag.context)
|
subpath = self.impl_getpath()
|
||||||
for child in self._opt.impl_getchildren(config_bag):
|
for child in self._opt.impl_getchildren(config_bag):
|
||||||
yield(self._opt._impl_get_dynchild(child,
|
yield(self._opt._impl_get_dynchild(child,
|
||||||
self._suffix,
|
self._suffix,
|
||||||
subpath))
|
subpath))
|
||||||
|
|
||||||
def impl_getpath(self, context):
|
def impl_getpath(self):
|
||||||
subpath = self._subpath
|
subpath = self._subpath
|
||||||
if subpath != '':
|
if subpath != '':
|
||||||
subpath += '.'
|
subpath += '.'
|
||||||
|
@ -80,11 +80,11 @@ class SynDynOptionDescription(object):
|
||||||
|
|
||||||
def getmaster(self):
|
def getmaster(self):
|
||||||
master = self._opt.getmaster()
|
master = self._opt.getmaster()
|
||||||
return master.impl_get_dynoption(self.impl_getpath(None),
|
return master.impl_get_dynoption(self.impl_getpath(),
|
||||||
self._suffix)
|
self._suffix)
|
||||||
|
|
||||||
def getslaves(self):
|
def getslaves(self):
|
||||||
subpath = self.impl_getpath(None)
|
subpath = self.impl_getpath()
|
||||||
for slave in self._opt.getslaves():
|
for slave in self._opt.getslaves():
|
||||||
yield slave.impl_get_dynoption(subpath,
|
yield slave.impl_get_dynoption(subpath,
|
||||||
self._suffix)
|
self._suffix)
|
||||||
|
|
|
@ -138,7 +138,7 @@ class OptionBag:
|
||||||
index,
|
index,
|
||||||
config_bag):
|
config_bag):
|
||||||
if path is None:
|
if path is None:
|
||||||
path = option.impl_getpath(config_bag.context)
|
path = option.impl_getpath()
|
||||||
self.path = path
|
self.path = path
|
||||||
self.index = index
|
self.index = index
|
||||||
self.option = option
|
self.option = option
|
||||||
|
@ -379,7 +379,7 @@ class Settings(object):
|
||||||
index = option_bag.index
|
index = option_bag.index
|
||||||
if opt.impl_is_symlinkoption():
|
if opt.impl_is_symlinkoption():
|
||||||
opt = opt.impl_getopt()
|
opt = opt.impl_getopt()
|
||||||
path = opt.impl_getpath(self._getcontext())
|
path = opt.impl_getpath()
|
||||||
|
|
||||||
if apply_requires:
|
if apply_requires:
|
||||||
props = config_bag.properties
|
props = config_bag.properties
|
||||||
|
@ -415,7 +415,7 @@ class Settings(object):
|
||||||
path):
|
path):
|
||||||
if opt and opt.impl_is_symlinkoption():
|
if opt and opt.impl_is_symlinkoption():
|
||||||
opt = opt.impl_getopt()
|
opt = opt.impl_getopt()
|
||||||
path = opt.impl_getpath(self._getcontext())
|
path = opt.impl_getpath()
|
||||||
return self._pp_.getpermissives(path)
|
return self._pp_.getpermissives(path)
|
||||||
|
|
||||||
def apply_requires(self,
|
def apply_requires(self,
|
||||||
|
@ -485,7 +485,7 @@ class Settings(object):
|
||||||
if option.issubdyn():
|
if option.issubdyn():
|
||||||
option = option.impl_get_dynoption(option_bag.option._rootpath,
|
option = option.impl_get_dynoption(option_bag.option._rootpath,
|
||||||
option_bag.option.impl_getsuffix())
|
option_bag.option.impl_getsuffix())
|
||||||
reqpath = option.impl_getpath(context)
|
reqpath = option.impl_getpath()
|
||||||
#FIXME too later!
|
#FIXME too later!
|
||||||
if reqpath.startswith(option_bag.path + '.'):
|
if reqpath.startswith(option_bag.path + '.'):
|
||||||
raise RequirementError(_("malformed requirements "
|
raise RequirementError(_("malformed requirements "
|
||||||
|
|
|
@ -338,7 +338,7 @@ class Values(object):
|
||||||
return False
|
return False
|
||||||
if option_bag.option.impl_is_master_slaves('slave'):
|
if option_bag.option.impl_is_master_slaves('slave'):
|
||||||
master = option_bag.option.impl_get_master_slaves().getmaster()
|
master = option_bag.option.impl_get_master_slaves().getmaster()
|
||||||
masterp = master.impl_getpath(context)
|
masterp = master.impl_getpath()
|
||||||
# slave could be a "meta" only if master hasn't value
|
# slave could be a "meta" only if master hasn't value
|
||||||
if self._p_.hasvalue(masterp,
|
if self._p_.hasvalue(masterp,
|
||||||
index=None):
|
index=None):
|
||||||
|
@ -378,7 +378,7 @@ class Values(object):
|
||||||
option_bag.ori_option = opt
|
option_bag.ori_option = opt
|
||||||
opt = opt.impl_getopt()
|
opt = opt.impl_getopt()
|
||||||
option_bag.option = opt
|
option_bag.option = opt
|
||||||
option_bag.path = opt.impl_getpath(context)
|
option_bag.path = opt.impl_getpath()
|
||||||
settings = context.cfgimpl_get_settings()
|
settings = context.cfgimpl_get_settings()
|
||||||
settings.validate_properties(option_bag)
|
settings.validate_properties(option_bag)
|
||||||
if 'frozen' in option_bag.properties and \
|
if 'frozen' in option_bag.properties and \
|
||||||
|
|
Loading…
Reference in New Issue