]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/commitdiff
replace calls to filter with list comprehension
authorDavid Stainton <dstainton415@gmail.com>
Tue, 14 Jul 2015 23:43:49 +0000 (16:43 -0700)
committerDaira Hopwood <daira@jacaranda.org>
Tue, 15 Sep 2015 16:56:02 +0000 (17:56 +0100)
src/allmydata/frontends/magic_folder.py

index 46e0960e6a8b9bd80651c32748b186c79365f64f..4cdc5752681d776f8b8d698ab133b4c6fe597924 100644 (file)
@@ -132,9 +132,7 @@ class MagicFolder(service.MultiService):
         upload_readonly_dircap = self._upload_dirnode.get_readonly_uri()
         collective_dirmap_d = self._collective_dirnode.list()
         def do_filter(result):
-            def not_mine(x):
-                return result[x][0].get_readonly_uri() != upload_readonly_dircap
-            others = filter(not_mine, result.keys())
+            others = [x for x in result.keys() if result[x][0].get_readonly_uri() != upload_readonly_dircap]
             return result, others
         collective_dirmap_d.addCallback(do_filter)
         def scan_collective(result):
@@ -180,9 +178,7 @@ class MagicFolder(service.MultiService):
         upload_readonly_dircap = self._upload_dirnode.get_readonly_uri()
         collective_dirmap_d = self._collective_dirnode.list()
         def do_filter(result):
-            def not_mine(x):
-                return result[x][0].get_readonly_uri() != upload_readonly_dircap
-            others = filter(not_mine, result.keys())
+            others = [x for x in result.keys() if result[x][0].get_readonly_uri() != upload_readonly_dircap]
             return result, others
         collective_dirmap_d.addCallback(do_filter)
         def scan_collective(result):