mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 09:28:41 +00:00
[Py2to3] Use open() instead of file()
This commit is contained in:
parent
9fab98a6ce
commit
2c3887ece9
2 changed files with 4 additions and 4 deletions
|
@ -197,7 +197,7 @@ class TorrentManager(component.Component):
|
||||||
archive_file("torrents.state")
|
archive_file("torrents.state")
|
||||||
archive_file("torrents.fastresume")
|
archive_file("torrents.fastresume")
|
||||||
else:
|
else:
|
||||||
with file(self.temp_file, 'a'):
|
with open(self.temp_file, 'a'):
|
||||||
os.utime(self.temp_file, None)
|
os.utime(self.temp_file, None)
|
||||||
|
|
||||||
# Try to load the state from file
|
# Try to load the state from 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)
|
info = makeinfo(path, piece_length, progress, name, content_type, private)
|
||||||
|
|
||||||
# check_info(info)
|
# check_info(info)
|
||||||
h = file(f, 'wb')
|
h = open(f, 'wb')
|
||||||
|
|
||||||
data['info'] = info
|
data['info'] = info
|
||||||
if title:
|
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!
|
'content_type': content_type}) # HEREDAVE. bad for batch!
|
||||||
else:
|
else:
|
||||||
fs.append({'length': size, 'path': p2})
|
fs.append({'length': size, 'path': p2})
|
||||||
h = file(f, 'rb')
|
h = open(f, 'rb')
|
||||||
while pos < size:
|
while pos < size:
|
||||||
a = min(size - pos, piece_length - done)
|
a = min(size - pos, piece_length - done)
|
||||||
sh.update(h.read(a))
|
sh.update(h.read(a))
|
||||||
|
@ -224,7 +224,7 @@ def makeinfo(path, piece_length, progress, name=None, content_type=None, private
|
||||||
|
|
||||||
pieces = []
|
pieces = []
|
||||||
p = 0
|
p = 0
|
||||||
h = file(path, 'rb')
|
h = open(path, 'rb')
|
||||||
while p < size:
|
while p < size:
|
||||||
x = h.read(min(piece_length, size - p))
|
x = h.read(min(piece_length, size - p))
|
||||||
pieces.append(sha(x).digest())
|
pieces.append(sha(x).digest())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue