]> code.delx.au - monosys/commitdiff
aptorphan: use generators
authorJames Bunton <jamesbunton@delx.net.au>
Sat, 13 Aug 2016 05:22:26 +0000 (15:22 +1000)
committerJames Bunton <jamesbunton@delx.net.au>
Sat, 13 Aug 2016 05:22:26 +0000 (15:22 +1000)
aptorphan

index 0126a43abe0383fa499f04e73dd0ada04757f737..564cbb63a00a3ac6ce132fe86e1f143733217589 100755 (executable)
--- a/aptorphan
+++ b/aptorphan
@@ -8,12 +8,10 @@ import sys
 APTORPHAN_PATH = os.path.expanduser("~/.aptorphan")
 
 def run(cmd):
-    result = []
     for line in subprocess.check_output(cmd).decode("utf-8").split("\n"):
         line = line.strip()
         if line:
-            result.append(line)
-    return result
+            yield line
 
 def strip_comment(line):
     pos = line.find("#")