diff options
author | Aaron LI <aaronly.me@outlook.com> | 2016-11-07 11:08:11 +0800 |
---|---|---|
committer | Aaron LI <aaronly.me@outlook.com> | 2016-11-07 11:12:38 +0800 |
commit | 9626c7518479d7f4a70da751dcc257e098381fd8 (patch) | |
tree | 8455eb2ad974665f3838543ee773d74c01042579 /fg21sim/configs/manager.py | |
parent | bfd8e66f6d3f6a46a42f2e880dcbd94d9abe51dc (diff) | |
download | fg21sim-9626c7518479d7f4a70da751dcc257e098381fd8.tar.bz2 |
configs/manager.py: Replace a filter with list comprehension
Replace the filter hack with a cleaner list comprehension.
Be Pythonic :)
Diffstat (limited to 'fg21sim/configs/manager.py')
-rw-r--r-- | fg21sim/configs/manager.py | 5 |
1 files changed, 1 insertions, 4 deletions
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) |