summaryrefslogtreecommitdiffstats
path: root/deluge/core/core.py
diff options
context:
space:
mode:
authorDjLegolas <djlegolas@protonmail.com>2021-12-25 14:34:49 +0200
committerCalum Lind <calumlind+deluge@gmail.com>2021-12-28 19:26:38 +0000
commit897955f0a164349d3191c778cfcb37ee9bff9daf (patch)
treefd91795cd3fd9a7e226e18e3e14008af3ba03247 /deluge/core/core.py
parentff309ea4c5009049cdcb0ea876d9a98d84c52e14 (diff)
downloaddeluge-897955f0a164349d3191c778cfcb37ee9bff9daf.tar.gz
deluge-897955f0a164349d3191c778cfcb37ee9bff9daf.tar.bz2
deluge-897955f0a164349d3191c778cfcb37ee9bff9daf.zip
Remove all Python 2 supportdeluge-2.1.0.dev0
* Removed all __future__ imports from code * Removed all six dependencies * Removed all future_builtins imports * Removed all Python 2 related code Closes: deluge-torrent/deluge#325
Diffstat (limited to 'deluge/core/core.py')
-rw-r--r--deluge/core/core.py16
1 files changed, 4 insertions, 12 deletions
diff --git a/deluge/core/core.py b/deluge/core/core.py
index 881f0065d..acd3a0b47 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import glob
import logging
import os
@@ -17,8 +15,8 @@ import shutil
import tempfile
import threading
from base64 import b64decode, b64encode
+from urllib.request import URLError, urlopen
-from six import string_types
from twisted.internet import defer, reactor, task
from twisted.web.client import Agent, readBody
@@ -56,12 +54,6 @@ from deluge.event import (
)
from deluge.httpdownloader import download_file
-try:
- from urllib.request import URLError, urlopen
-except ImportError:
- # PY2 fallback
- from urllib2 import URLError, urlopen
-
log = logging.getLogger(__name__)
DEPR_SESSION_STATUS_KEYS = {
@@ -666,7 +658,7 @@ class Core(component.Component):
def pause_torrent(self, torrent_id):
"""Pauses a torrent"""
log.debug('Pausing: %s', torrent_id)
- if not isinstance(torrent_id, string_types):
+ if not isinstance(torrent_id, str):
self.pause_torrents(torrent_id)
else:
self.torrentmanager[torrent_id].pause()
@@ -717,7 +709,7 @@ class Core(component.Component):
def resume_torrent(self, torrent_id):
"""Resumes a torrent"""
log.debug('Resuming: %s', torrent_id)
- if not isinstance(torrent_id, string_types):
+ if not isinstance(torrent_id, str):
self.resume_torrents(torrent_id)
else:
self.torrentmanager[torrent_id].resume()
@@ -901,7 +893,7 @@ class Core(component.Component):
if 'owner' in options and not self.authmanager.has_account(options['owner']):
raise DelugeError('Username "%s" is not known.' % options['owner'])
- if isinstance(torrent_ids, string_types):
+ if isinstance(torrent_ids, str):
torrent_ids = [torrent_ids]
for torrent_id in torrent_ids: