[Py2to3] Use open() instead of file()

This commit is contained in:
Calum Lind 2016-10-24 18:13:05 +01:00
parent 9fab98a6ce
commit 2c3887ece9
2 changed files with 4 additions and 4 deletions

View File

@ -197,7 +197,7 @@ class TorrentManager(component.Component):
archive_file("torrents.state")
archive_file("torrents.fastresume")
else:
with file(self.temp_file, 'a'):
with open(self.temp_file, 'a'):
os.utime(self.temp_file, None)
# Try to load the state from file

View File

@ -95,7 +95,7 @@ def make_meta_file(path, url, piece_length, progress=None, title=None, comment=N
info = makeinfo(path, piece_length, progress, name, content_type, private)
# check_info(info)
h = file(f, 'wb')
h = open(f, 'wb')
data['info'] = info
if title:
@ -184,7 +184,7 @@ def makeinfo(path, piece_length, progress, name=None, content_type=None, private
'content_type': content_type}) # HEREDAVE. bad for batch!
else:
fs.append({'length': size, 'path': p2})
h = file(f, 'rb')
h = open(f, 'rb')
while pos < size:
a = min(size - pos, piece_length - done)
sh.update(h.read(a))
@ -224,7 +224,7 @@ def makeinfo(path, piece_length, progress, name=None, content_type=None, private
pieces = []
p = 0
h = file(path, 'rb')
h = open(path, 'rb')
while p < size:
x = h.read(min(piece_length, size - p))
pieces.append(sha(x).digest())