Module: deluge Branch: chunked-sessionproxy-and-gtkui-speedups Commit: 6a8e3f1c49856b27a444f3810ed96cebac551712
Author: Pedro Algarvio <pe...@algarvio.me> Date: Wed May 11 09:06:21 2011 +0100 Minor code cleanup. --- deluge/ui/sessionproxy.py | 15 ++++++++++----- 1 files changed, 10 insertions(+), 5 deletions(-) diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py index 5e33a62..af485a4 100644 --- a/deluge/ui/sessionproxy.py +++ b/deluge/ui/sessionproxy.py @@ -75,11 +75,11 @@ class SessionProxy(component.Component): def on_torrent_status(status): # Save the time we got the torrent status t = time.time() - for key, value in status.items(): + for key, value in status.iteritems(): self.torrents[key] = [t, value] self.cache_times[key] = {} - for k, v in value.items(): - self.cache_times[key][k] = t + for ikey in value.iterkeys(): + self.cache_times[key][ikey] = t return client.core.get_torrents_status({}, [], True).addCallback(on_torrent_status) @@ -105,7 +105,10 @@ class SessionProxy(component.Component): sd = {} for torrent_id in torrent_ids: if keys: - sd[torrent_id] = dict([(x, y) for x, y in self.torrents[torrent_id][1].iteritems() if x in keys]) + sd[torrent_id] = dict([ + (x, y) for x, y in self.torrents[torrent_id][1].iteritems() + if x in keys + ]) else: sd[torrent_id] = dict(self.torrents[torrent_id][1]) @@ -135,7 +138,9 @@ class SessionProxy(component.Component): keys_to_get.append(key) if not keys_to_get: - return succeed(self.create_status_dict([torrent_id], keys)[torrent_id]) + return succeed( + self.create_status_dict([torrent_id], keys)[torrent_id] + ) else: d = client.core.get_torrent_status(torrent_id, keys_to_get, True) def on_status(result, torrent_id): -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to deluge-commit@googlegroups.com. To unsubscribe from this group, send email to deluge-commit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.