[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 logging
import os import os
import socket import socket
from itertools import izip from future_builtins import zip # pylint: disable=redefined-builtin
from urlparse import urlparse from urlparse import urlparse
from twisted.internet.defer import Deferred, DeferredList from twisted.internet.defer import Deferred, DeferredList
@ -829,7 +829,7 @@ class Torrent(object):
if not self.has_metadata: if not self.has_metadata:
return 0.0 return 0.0
return [progress / _file.size if _file.size else 0.0 for progress, _file in 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): def get_tracker_host(self):
"""Get the hostname of the currently connected tracker. """Get the hostname of the currently connected tracker.
@ -1370,7 +1370,7 @@ class Torrent(object):
pieces = None pieces = None
else: else:
pieces = [] 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: if piece:
pieces.append(3) # Completed. pieces.append(3) # Completed.
elif avail_piece: elif avail_piece:

View File

@ -9,7 +9,7 @@
import logging import logging
import os.path import os.path
from itertools import izip from future_builtins import zip # pylint: disable=redefined-builtin
import gtk import gtk
@ -266,7 +266,7 @@ class PeersTab(Tab):
if peer["ip"].count(":") == 1: if peer["ip"].count(":") == 1:
# This is an IPv4 address # This is an IPv4 address
ip_int = sum([int(byte) << shift 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"] peer_ip = peer["ip"]
else: else:
# This is an IPv6 address # This is an IPv6 address