From 4045f5844fde99181dc22f42ecf2d79e609014fa Mon Sep 17 00:00:00 2001 From: Daira Hopwood Date: Thu, 23 Jul 2015 23:15:24 +0100 Subject: [PATCH] Simplify and document the type of MagicFolder._download_scan_batch. Signed-off-by: Daira Hopwood --- src/allmydata/frontends/magic_folder.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/allmydata/frontends/magic_folder.py b/src/allmydata/frontends/magic_folder.py index 995b652a..7532f2b1 100644 --- a/src/allmydata/frontends/magic_folder.py +++ b/src/allmydata/frontends/magic_folder.py @@ -51,7 +51,7 @@ class MagicFolder(service.MultiService): self._local_dir = local_dir self._upload_lazy_tail = defer.succeed(None) self._upload_pending = set() - self._download_scan_batch = {} + self._download_scan_batch = {} # path -> [(filenode, metadata)] self._download_lazy_tail = defer.succeed(None) self._download_pending = set() self._collective_dirnode = None @@ -168,9 +168,9 @@ class MagicFolder(service.MultiService): for name in listing_map.keys(): file_node, metadata = listing_map[name] if self._download_scan_batch.has_key(name): - self._download_scan_batch[name] += [(name, file_node, metadata)] + self._download_scan_batch[name] += [(file_node, metadata)] else: - self._download_scan_batch[name] = [(name, file_node, metadata)] + self._download_scan_batch[name] = [(file_node, metadata)] listing_d.addCallback(scan_listing) return listing_d @@ -200,11 +200,11 @@ class MagicFolder(service.MultiService): self._download_pending.update(map(lambda x: x[0], result)) def _filter_scan_batch(self, result): - extension = [] + extension = [] # consider whether this should be a dict for name in self._download_scan_batch.keys(): if name in self._download_pending: continue - name, file_node, metadata = max(self._download_scan_batch[name], key=lambda x: x[2]['version']) + file_node, metadata = max(self._download_scan_batch[name], key=lambda x: x[1]['version']) if self._should_download(name, metadata['version']): extension += [(name, file_node, metadata)] return extension -- 2.45.2