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