From 7fa9b0637ea0ee823d4da3967c61128e47d35112 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Wed, 5 Sep 2018 20:22:53 +0200 Subject: [PATCH] do not duplicate valid_consistency --- tiramisu/option/option.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/tiramisu/option/option.py b/tiramisu/option/option.py index ad042a4..a8d07f5 100644 --- a/tiramisu/option/option.py +++ b/tiramisu/option/option.py @@ -305,11 +305,12 @@ class Option(OnlyOption): do_validation(val, idx) - self.valid_consistency(option_bag, - value, - context, - check_error, - is_warnings_only) + if not is_warnings_only or not check_error: + self.valid_consistency(option_bag, + value, + context, + check_error, + is_warnings_only) except ValueError as err: #raise err if debug: # pragma: no cover @@ -476,7 +477,14 @@ class Option(OnlyOption): cconfig_bag = option_bag.config_bag.copy() cconfig_bag.properties = cconfig_bag.properties - {'warnings'} cconfig_bag.set_permissive() + if not option_bag.fromconsistency: + fromconsistency_is_empty = True + option_bag.fromconsistency = [cons_id for cons_id, f, a, p in consistencies] + else: + fromconsistency_is_empty = False for cons_id, func, all_cons_opts, params in consistencies: + if not fromconsistency_is_empty and cons_id in option_bag.fromconsistency: + return warnings_only = option_warnings_only or params.get('warnings_only', False) if (warnings_only and not check_error) or (not warnings_only and check_error): transitive = params.get('transitive', True) @@ -500,6 +508,8 @@ class Option(OnlyOption): warnings_only, transitive, cconfig_bag) + if fromconsistency_is_empty: + option_bag.fromconsistency = [] def _get_consistency_value(self, option_bag, @@ -574,8 +584,6 @@ class Option(OnlyOption): :param transitive: propertyerror is transitive :type transitive: `boolean` """ - if cons_id in option_bag.fromconsistency: - return all_cons_vals = [] all_cons_opts = [] length = None