From 13ec51f468c80826956e23eb4b698b29a73a0933 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 3 Apr 2018 21:15:58 +0200 Subject: [PATCH] better reset_cache --- tiramisu/config.py | 17 +++++------------ tiramisu/option/baseoption.py | 15 +++++++-------- tiramisu/option/masterslave.py | 14 +++++++------- 3 files changed, 19 insertions(+), 27 deletions(-) diff --git a/tiramisu/config.py b/tiramisu/config.py index b5c825a..239d9e2 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -92,24 +92,17 @@ class SubConfig(object): opt, path): - tresetted_opts = copy(resetted_opts) opt.reset_cache(opt, path, values, - 'values', - tresetted_opts) - tresetted_opts = copy(resetted_opts) - opt.reset_cache(opt, - path, settings, - 'settings', - tresetted_opts) - resetted_opts.extend(tresetted_opts) + resetted_opts) for woption in opt._get_dependencies(self): option = woption() - if option in resetted_opts: - continue option_path = option.impl_getpath(self) + print(option_path, resetted_opts) + if option_path in resetted_opts: + continue self.reset_one_option_cache(values, settings, resetted_opts, @@ -135,7 +128,7 @@ class SubConfig(object): settings = context.cfgimpl_get_settings() if not None in (opt, path): - if opt not in resetted_opts: + if path not in resetted_opts: self.reset_one_option_cache(values, settings, resetted_opts, diff --git a/tiramisu/option/baseoption.py b/tiramisu/option/baseoption.py index 23b6060..faee934 100644 --- a/tiramisu/option/baseoption.py +++ b/tiramisu/option/baseoption.py @@ -498,17 +498,16 @@ class BaseOption(Base): def reset_cache(self, opt, path, - obj, - type_, + values, + settings, resetted_opts): if opt in resetted_opts: return - if not type_ == 'values' or not opt.impl_is_optiondescription(): - if type_ != 'permissives': - obj._p_.delcache(path) - if type_ in ['settings', 'permissives']: - obj._pp_.delcache(path) - resetted_opts.append(opt) + settings._p_.delcache(path) + settings._pp_.delcache(path) + if not opt.impl_is_optiondescription(): + values._p_.delcache(path) + resetted_opts.append(path) def impl_is_symlinkoption(self): return False diff --git a/tiramisu/option/masterslave.py b/tiramisu/option/masterslave.py index cee4a10..98f3960 100644 --- a/tiramisu/option/masterslave.py +++ b/tiramisu/option/masterslave.py @@ -146,24 +146,24 @@ class MasterSlaves(OptionDescription): def reset_cache(self, opt, path, - obj, - type_, + values, + settings, resetted_opts): - context = obj._getcontext() + context = values._getcontext() #FIXME pb avec dyn, devrait etre une option mopt = self.getmaster() mpath = mopt.impl_getpath(context) mopt.reset_cache(mopt, mpath, - obj, - type_, + values, + settings, resetted_opts) for slave in self.getslaves(): spath = slave.impl_getpath(context) slave.reset_cache(slave, spath, - obj, - type_, + values, + settings, resetted_opts) def impl_validate_value(self,