aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron LI <aaronly.me@outlook.com>2016-11-07 11:08:11 +0800
committerAaron LI <aaronly.me@outlook.com>2016-11-07 11:12:38 +0800
commit9626c7518479d7f4a70da751dcc257e098381fd8 (patch)
tree8455eb2ad974665f3838543ee773d74c01042579
parentbfd8e66f6d3f6a46a42f2e880dcbd94d9abe51dc (diff)
downloadfg21sim-9626c7518479d7f4a70da751dcc257e098381fd8.tar.bz2
configs/manager.py: Replace a filter with list comprehension
Replace the filter hack with a cleaner list comprehension. Be Pythonic :)
-rw-r--r--fg21sim/configs/manager.py5
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)