From 40a28bd2afed71a774a4900ea0b855fbf9ebf7f3 Mon Sep 17 00:00:00 2001 From: Valerio Setti Date: Thu, 26 Sep 2024 12:36:50 +0200 Subject: [PATCH] config_common.py: make get_matching() a generator Signed-off-by: Valerio Setti --- scripts/mbedtls_framework/config_common.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scripts/mbedtls_framework/config_common.py b/scripts/mbedtls_framework/config_common.py index 95d53ef27..d594dc189 100644 --- a/scripts/mbedtls_framework/config_common.py +++ b/scripts/mbedtls_framework/config_common.py @@ -98,14 +98,12 @@ class Config: def get_matching(self, regexs, only_enabled): """Get all symbols matching one of the regexs.""" if not regexs: - return None - match_list = [] + return regex = re.compile('|'.join(regexs)) for setting in self.settings.values(): if regex.search(setting.name): - if (not only_enabled) or (only_enabled and setting.active): - match_list.append(setting.name) - return match_list + if setting.active or not only_enabled: + yield setting.name def __setitem__(self, name, value): """If name is known, set its value.