From: Daira Hopwood Date: Thu, 23 Jul 2015 22:15:24 +0000 (+0100) Subject: Simplify and document the type of MagicFolder._download_scan_batch. X-Git-Url: https://git.rkrishnan.org/specifications/%5B/%5D%20/flags/running.html?a=commitdiff_plain;h=4045f5844fde99181dc22f42ecf2d79e609014fa;p=tahoe-lafs%2Ftahoe-lafs.git Simplify and document the type of MagicFolder._download_scan_batch. Signed-off-by: Daira Hopwood --- 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