[tor-commits] [chutney/master] TorNet: replace for loop with list comprehension

nickm at torproject.org nickm at torproject.org
Sat Jul 18 15:41:23 UTC 2020


commit bc7abead8e2be29bc89d485cb86c01b92c5165b1
Author: c <c at chroniko.jp>
Date:   Sun Jul 5 08:09:31 2020 +0000

    TorNet: replace for loop with list comprehension
    
    seems easier to read
---
 lib/chutney/TorNet.py | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/chutney/TorNet.py b/lib/chutney/TorNet.py
index b19c2f2..f31b254 100644
--- a/lib/chutney/TorNet.py
+++ b/lib/chutney/TorNet.py
@@ -2540,13 +2540,11 @@ def ConfigureNodes(nodelist):
             network._dfltEnv['hasbridgeauth'] = True
 
 def getTests():
-    tests = []
     chutney_path = get_absolute_chutney_path()
     chutney_tests_path = chutney_path / "scripts" / "chutney_tests"
-    for x in chutney_tests_path.glob("*.py"):
-        if not x.startswith("_"):
-            tests.append(x.with_suffix(""))
-    return tests
+
+    return [test.name for test in chutney_tests_path.glob("*.py")
+            if not test.name.startswith("_")]
 
 
 def usage(network):





More information about the tor-commits mailing list