mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-10-07 01:07:22 +00:00
config_common.py: make get_matching() a generator
Signed-off-by: Valerio Setti <[email protected]>
This commit is contained in:
@@ -98,14 +98,12 @@ class Config:
|
|||||||
def get_matching(self, regexs, only_enabled):
|
def get_matching(self, regexs, only_enabled):
|
||||||
"""Get all symbols matching one of the regexs."""
|
"""Get all symbols matching one of the regexs."""
|
||||||
if not regexs:
|
if not regexs:
|
||||||
return None
|
return
|
||||||
match_list = []
|
|
||||||
regex = re.compile('|'.join(regexs))
|
regex = re.compile('|'.join(regexs))
|
||||||
for setting in self.settings.values():
|
for setting in self.settings.values():
|
||||||
if regex.search(setting.name):
|
if regex.search(setting.name):
|
||||||
if (not only_enabled) or (only_enabled and setting.active):
|
if setting.active or not only_enabled:
|
||||||
match_list.append(setting.name)
|
yield setting.name
|
||||||
return match_list
|
|
||||||
|
|
||||||
def __setitem__(self, name, value):
|
def __setitem__(self, name, value):
|
||||||
"""If name is known, set its value.
|
"""If name is known, set its value.
|
||||||
|
|||||||
Reference in New Issue
Block a user