From 837dae242c0948f224026e2a6783ab64844ff716 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sun, 16 Oct 2016 20:08:28 -0700 Subject: [PATCH] [Py2to3] Use future_builtins zip instead of izip for Py3 compat --- deluge/core/torrent.py | 6 +++--- deluge/ui/gtkui/peers_tab.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index c452e38cd..43dc1299b 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -19,7 +19,7 @@ from __future__ import division import logging import os import socket -from itertools import izip +from future_builtins import zip # pylint: disable=redefined-builtin from urlparse import urlparse from twisted.internet.defer import Deferred, DeferredList @@ -829,7 +829,7 @@ class Torrent(object): if not self.has_metadata: return 0.0 return [progress / _file.size if _file.size else 0.0 for progress, _file in - izip(self.handle.file_progress(), self.torrent_info.files())] + zip(self.handle.file_progress(), self.torrent_info.files())] def get_tracker_host(self): """Get the hostname of the currently connected tracker. @@ -1370,7 +1370,7 @@ class Torrent(object): pieces = None else: pieces = [] - for piece, avail_piece in izip(self.status.pieces, self.handle.piece_availability()): + for piece, avail_piece in zip(self.status.pieces, self.handle.piece_availability()): if piece: pieces.append(3) # Completed. elif avail_piece: diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index 23bfb50f7..0fc227807 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -9,7 +9,7 @@ import logging import os.path -from itertools import izip +from future_builtins import zip # pylint: disable=redefined-builtin import gtk @@ -266,7 +266,7 @@ class PeersTab(Tab): if peer["ip"].count(":") == 1: # This is an IPv4 address ip_int = sum([int(byte) << shift - for byte, shift in izip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))]) + for byte, shift in zip(peer["ip"].split(":")[0].split("."), (24, 16, 8, 0))]) peer_ip = peer["ip"] else: # This is an IPv6 address