From 2c3887ece9135d565f501f2abdcace77412337d2 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Mon, 24 Oct 2016 18:13:05 +0100 Subject: [PATCH] [Py2to3] Use open() instead of file() --- deluge/core/torrentmanager.py | 2 +- deluge/metafile.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index dac17b48b..6ec76b801 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -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 diff --git a/deluge/metafile.py b/deluge/metafile.py index b34416caf..8586205cd 100644 --- a/deluge/metafile.py +++ b/deluge/metafile.py @@ -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())