From 0eff0cd9890953f095c3d4a157b2898f6044c2c4 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 12 Oct 2016 21:55:01 +0200 Subject: [PATCH] refactore _launch_consistency --- tiramisu/option/baseoption.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tiramisu/option/baseoption.py b/tiramisu/option/baseoption.py index de2e35f..2f43ffd 100644 --- a/tiramisu/option/baseoption.py +++ b/tiramisu/option/baseoption.py @@ -395,10 +395,12 @@ class Option(OnlyOption): all_cons_vals = [] val_consistencies = True for opt in all_cons_opts: - #get value + if (isinstance(opt, DynSymLinkOption) and option._dyn == opt._dyn) or \ option == opt: - opt_value = value + # option is current option + # we have already value, so use it + all_cons_vals.append(value) else: #if context, calculate value, otherwise get default value if context is not undefined: @@ -407,6 +409,7 @@ class Option(OnlyOption): else: path = descr.impl_get_path_by_opt(opt) opt_value = context.getattr(path, validate=False, + index=index, force_permissive=True, returns_raise=True) if isinstance(opt_value, Exception): @@ -419,20 +422,16 @@ class Option(OnlyOption): return else: return opt_value - else: + elif index is None: opt_value = opt.impl_getdefault() - - #append value - if not self.impl_is_multi() or (isinstance(opt, DynSymLinkOption) - and option._dyn == opt._dyn) or \ - option == opt: - all_cons_vals.append(opt_value) - else: - if index is not None: - all_cons_vals.append(opt_value[index]) else: - #only check properties for slaves + opt_value = opt.impl_getdefault()[index] + + if self.impl_is_multi() and index is None: + # only check propertyerror for master/slaves is transitive val_consistencies = False + all_cons_vals.append(opt_value) + if val_consistencies: return getattr(self, func)(current_opt, all_cons_opts, all_cons_vals, warnings_only)