[Py2to3] Use future_builtins zip instead of izip for Py3 compat

This commit is contained in:
Andrew Resch 2016-10-16 20:08:28 -07:00 committed by Calum Lind
parent 7ad8a3cbb5
commit 837dae242c
2 changed files with 5 additions and 5 deletions

View File

@ -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:

View File

@ -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