From: David Stainton Date: Tue, 14 Jul 2015 23:43:49 +0000 (-0700) Subject: replace calls to filter with list comprehension X-Git-Url: https://git.rkrishnan.org/Site/Content/Exhibitors/provisioning?a=commitdiff_plain;h=89caa7de9b91383394afbc8bce42d0807ba0e93d;p=tahoe-lafs%2Ftahoe-lafs.git replace calls to filter with list comprehension --- diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 46e0960e..4cdc5752 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -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):