From d504ad118f382c0b009e3e22c9092f1c6d809b7d Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone Date: Mon, 11 Mar 2019 12:08:22 -0400 Subject: [PATCH] Avoid the extra lookup inside this loop Get the key and value at the same time during iteration. --- src/allmydata/frontends/magic_folder.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 3b16eb412..f7ce5f1a4 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -1830,10 +1830,8 @@ class Downloader(QueueMixin, WriteFileMixin): with SCAN_REMOTE_DMD(nickname=nickname).context(): d = DeferredContext(dirnode.list()) def scan_listing(listing_map): - for encoded_relpath_u in listing_map: + for encoded_relpath_u, (file_node, metadata) in listing_map.iteritems(): relpath_u = magicpath.magic2path(encoded_relpath_u) - - file_node, metadata = listing_map[encoded_relpath_u] local_dbentry = self._get_local_latest(relpath_u) # XXX FIXME this is *awefully* similar to