From ef66d487b78c77a2c7c228f979b828438a44a40d Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Sat, 17 Nov 2018 23:02:03 +0100 Subject: [PATCH] remove warnings when execute option.list --- tiramisu/api.py | 23 ++++++++++++++++------- tiramisu/config.py | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/tiramisu/api.py b/tiramisu/api.py index 1fc6cc2..b4cdbc2 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -1003,14 +1003,15 @@ class TiramisuContextOption(TiramisuContext): def _filter(self, opt, - subconfig): + subconfig, + config_bag): option_bag = OptionBag() option_bag.set_option(opt, opt.impl_getpath(), None, - self._config_bag) + config_bag) if opt.impl_is_optiondescription(): - self._config_bag.context.cfgimpl_get_settings().validate_properties(option_bag) + config_bag.context.cfgimpl_get_settings().validate_properties(option_bag) return subconfig.get_subconfig(option_bag) subconfig.getattr(opt.impl_getname(), option_bag) @@ -1020,11 +1021,13 @@ class TiramisuContextOption(TiramisuContext): recursive, type_, group_type, + config_bag, subconfig): - for opt in option.get_children(self._config_bag): + for opt in option.get_children(config_bag): try: subsubconfig = self._filter(opt, - subconfig) + subconfig, + config_bag) except PropertiesOptionError: continue if opt.impl_is_optiondescription(): @@ -1033,6 +1036,7 @@ class TiramisuContextOption(TiramisuContext): recursive, type_, group_type, + config_bag, subsubconfig): yield toption if type_ == 'option' or (type_ == 'optiondescription' and \ @@ -1056,12 +1060,17 @@ class TiramisuContextOption(TiramisuContext): assert type in ('all', 'option', 'optiondescription'), _('unknown list type {}').format(type) assert group_type is None or isinstance(group_type, groups.GroupType), \ _("unknown group_type: {0}").format(group_type) - option = self._config_bag.context.cfgimpl_get_description() + config_bag = self._config_bag + if config_bag.properties and 'warnings' in config_bag.properties: + config_bag = config_bag.copy() + config_bag.properties = config_bag.properties - {'warnings'} + option = config_bag.context.cfgimpl_get_description() for toption in self._walk(option, recursive, type, group_type, - self._config_bag.context): + config_bag, + config_bag.context): yield toption diff --git a/tiramisu/config.py b/tiramisu/config.py index 82081cb..131e647 100644 --- a/tiramisu/config.py +++ b/tiramisu/config.py @@ -28,7 +28,7 @@ from .option import SynDynOptionDescription, DynOptionDescription, MasterSlaves from .option.baseoption import BaseOption, valid_name from .setting import OptionBag, ConfigBag, groups, Settings, undefined from .storage import get_storages, gen_storage_id, get_default_values_storages -from .value import Values # , Multi +from .value import Values from .i18n import _