From 9626c7518479d7f4a70da751dcc257e098381fd8 Mon Sep 17 00:00:00 2001 From: Aaron LI Date: Mon, 7 Nov 2016 11:08:11 +0800 Subject: configs/manager.py: Replace a filter with list comprehension Replace the filter hack with a cleaner list comprehension. Be Pythonic :) --- fg21sim/configs/manager.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'fg21sim/configs/manager.py') diff --git a/fg21sim/configs/manager.py b/fg21sim/configs/manager.py index c3408ec..c03222d 100644 --- a/fg21sim/configs/manager.py +++ b/fg21sim/configs/manager.py @@ -31,10 +31,7 @@ logger = logging.getLogger(__name__) def _get_configspec(): """Found and read all the configuration specifications""" files = sorted(pkg_resources.resource_listdir(__name__, "")) - # NOTE: - # Explicit convert the filter results to a list, since the returned - # iterator can ONLY be used ONCE. - specfiles = list(filter(lambda fn: fn.endswith(".conf.spec"), files)) + specfiles = [fn for fn in files if fn.endswith(".conf.spec")] if os.environ.get("DEBUG_FG21SIM"): print("DEBUG: Found config specifications: %s" % ", ".join(specfiles), file=sys.stderr) -- cgit v1.2.2