summaryrefslogtreecommitdiffstats
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
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
-rw-r--r--.pylintrc7
-rw-r--r--CHANGELOG.md4
-rw-r--r--DEPENDS.md3
-rw-r--r--deluge/_libtorrent.py2
-rw-r--r--deluge/argparserbase.py2
-rw-r--r--deluge/bencode.py12
-rw-r--r--deluge/common.py83
-rw-r--r--deluge/component.py11
-rw-r--r--deluge/config.py5
-rw-r--r--deluge/configmanager.py2
-rw-r--r--deluge/core/alertmanager.py12
-rw-r--r--deluge/core/authmanager.py2
-rw-r--r--deluge/core/core.py16
-rw-r--r--deluge/core/daemon.py2
-rw-r--r--deluge/core/daemon_entry.py2
-rw-r--r--deluge/core/eventmanager.py2
-rw-r--r--deluge/core/filtermanager.py6
-rw-r--r--deluge/core/pluginmanager.py2
-rw-r--r--deluge/core/preferencesmanager.py11
-rw-r--r--deluge/core/rpcserver.py2
-rw-r--r--deluge/core/torrent.py15
-rw-r--r--deluge/core/torrentmanager.py10
-rw-r--r--deluge/crypto_utils.py6
-rw-r--r--deluge/decorators.py2
-rw-r--r--deluge/error.py3
-rw-r--r--deluge/event.py6
-rw-r--r--deluge/httpdownloader.py2
-rw-r--r--deluge/i18n/languages.py2
-rw-r--r--deluge/i18n/util.py10
-rw-r--r--deluge/log.py7
-rw-r--r--deluge/maketorrent.py2
-rw-r--r--deluge/metafile.py2
-rw-r--r--deluge/path_chooser_common.py9
-rw-r--r--deluge/pluginmanagerbase.py2
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/__init__.py2
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/common.py2
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/core.py2
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py2
-rw-r--r--deluge/plugins/AutoAdd/deluge_autoadd/webui.py2
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/__init__.py2
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/common.py5
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/core.py9
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/decompressers.py2
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/detect.py2
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/gtkui.py2
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py5
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/readers.py2
-rw-r--r--deluge/plugins/Blocklist/deluge_blocklist/webui.py2
-rw-r--r--deluge/plugins/Execute/deluge_execute/__init__.py2
-rw-r--r--deluge/plugins/Execute/deluge_execute/common.py2
-rw-r--r--deluge/plugins/Execute/deluge_execute/core.py2
-rw-r--r--deluge/plugins/Execute/deluge_execute/gtkui.py2
-rw-r--r--deluge/plugins/Execute/deluge_execute/webui.py2
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/__init__.py2
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/common.py2
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/core.py7
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/gtkui.py2
-rw-r--r--deluge/plugins/Extractor/deluge_extractor/webui.py2
-rw-r--r--deluge/plugins/Label/deluge_label/__init__.py2
-rw-r--r--deluge/plugins/Label/deluge_label/common.py2
-rw-r--r--deluge/plugins/Label/deluge_label/core.py2
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/__init__.py2
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/label_config.py2
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py2
-rw-r--r--deluge/plugins/Label/deluge_label/gtkui/submenu.py2
-rw-r--r--deluge/plugins/Label/deluge_label/test.py2
-rw-r--r--deluge/plugins/Label/deluge_label/webui.py2
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/__init__.py2
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/common.py2
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/core.py3
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/gtkui.py2
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/test.py2
-rw-r--r--deluge/plugins/Notifications/deluge_notifications/webui.py2
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/__init__.py2
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/common.py2
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/core.py2
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/gtkui.py2
-rw-r--r--deluge/plugins/Scheduler/deluge_scheduler/webui.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/__init__.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/common.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/core.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/graph.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/gtkui.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/tests/test_stats.py2
-rw-r--r--deluge/plugins/Stats/deluge_stats/webui.py2
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/__init__.py2
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/common.py2
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/core.py2
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/gtkui.py2
-rw-r--r--deluge/plugins/Toggle/deluge_toggle/webui.py2
-rw-r--r--deluge/plugins/WebUi/deluge_webui/__init__.py2
-rw-r--r--deluge/plugins/WebUi/deluge_webui/common.py2
-rw-r--r--deluge/plugins/WebUi/deluge_webui/core.py2
-rw-r--r--deluge/plugins/WebUi/deluge_webui/gtkui.py2
-rw-r--r--deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py2
-rw-r--r--deluge/plugins/init.py2
-rw-r--r--deluge/plugins/pluginbase.py2
-rw-r--r--deluge/scripts/create_plugin.py2
-rw-r--r--deluge/scripts/deluge_remote.py2
-rw-r--r--deluge/tests/__init__.py2
-rw-r--r--deluge/tests/basetest.py2
-rw-r--r--deluge/tests/common.py2
-rw-r--r--deluge/tests/common_web.py2
-rw-r--r--deluge/tests/daemon_base.py2
-rw-r--r--deluge/tests/test_alertmanager.py2
-rw-r--r--deluge/tests/test_authmanager.py2
-rw-r--r--deluge/tests/test_bencode.py2
-rw-r--r--deluge/tests/test_client.py2
-rw-r--r--deluge/tests/test_common.py2
-rw-r--r--deluge/tests/test_component.py2
-rw-r--r--deluge/tests/test_config.py2
-rw-r--r--deluge/tests/test_core.py6
-rw-r--r--deluge/tests/test_decorators.py2
-rw-r--r--deluge/tests/test_error.py2
-rw-r--r--deluge/tests/test_files_tab.py2
-rw-r--r--deluge/tests/test_httpdownloader.py2
-rw-r--r--deluge/tests/test_json_api.py2
-rw-r--r--deluge/tests/test_log.py2
-rw-r--r--deluge/tests/test_maketorrent.py2
-rw-r--r--deluge/tests/test_metafile.py2
-rw-r--r--deluge/tests/test_plugin_metadata.py2
-rw-r--r--deluge/tests/test_rpcserver.py2
-rw-r--r--deluge/tests/test_security.py2
-rw-r--r--deluge/tests/test_sessionproxy.py2
-rw-r--r--deluge/tests/test_torrent.py2
-rw-r--r--deluge/tests/test_torrentmanager.py6
-rw-r--r--deluge/tests/test_torrentview.py2
-rw-r--r--deluge/tests/test_tracker_icons.py2
-rw-r--r--deluge/tests/test_transfer.py2
-rw-r--r--deluge/tests/test_ui_common.py5
-rw-r--r--deluge/tests/test_ui_console.py2
-rw-r--r--deluge/tests/test_ui_entry.py13
-rw-r--r--deluge/tests/test_ui_gtk3.py2
-rw-r--r--deluge/tests/test_web_api.py2
-rw-r--r--deluge/tests/test_web_auth.py2
-rw-r--r--deluge/tests/test_webserver.py2
-rw-r--r--deluge/tests/twisted/plugins/delugereporter.py2
-rw-r--r--deluge/transfer.py2
-rw-r--r--deluge/ui/client.py2
-rw-r--r--deluge/ui/common.py2
-rw-r--r--deluge/ui/console/__init__.py2
-rw-r--r--deluge/ui/console/cmdline/command.py2
-rw-r--r--deluge/ui/console/cmdline/commands/__init__.py2
-rw-r--r--deluge/ui/console/cmdline/commands/add.py12
-rw-r--r--deluge/ui/console/cmdline/commands/cache.py2
-rw-r--r--deluge/ui/console/cmdline/commands/config.py2
-rw-r--r--deluge/ui/console/cmdline/commands/connect.py2
-rw-r--r--deluge/ui/console/cmdline/commands/debug.py2
-rw-r--r--deluge/ui/console/cmdline/commands/gui.py2
-rw-r--r--deluge/ui/console/cmdline/commands/halt.py2
-rw-r--r--deluge/ui/console/cmdline/commands/help.py2
-rw-r--r--deluge/ui/console/cmdline/commands/info.py2
-rw-r--r--deluge/ui/console/cmdline/commands/manage.py2
-rw-r--r--deluge/ui/console/cmdline/commands/move.py2
-rw-r--r--deluge/ui/console/cmdline/commands/pause.py2
-rw-r--r--deluge/ui/console/cmdline/commands/plugin.py2
-rw-r--r--deluge/ui/console/cmdline/commands/quit.py2
-rw-r--r--deluge/ui/console/cmdline/commands/recheck.py2
-rw-r--r--deluge/ui/console/cmdline/commands/resume.py2
-rw-r--r--deluge/ui/console/cmdline/commands/rm.py2
-rw-r--r--deluge/ui/console/cmdline/commands/status.py2
-rw-r--r--deluge/ui/console/cmdline/commands/update_tracker.py2
-rw-r--r--deluge/ui/console/console.py2
-rw-r--r--deluge/ui/console/main.py4
-rw-r--r--deluge/ui/console/modes/add_util.py4
-rw-r--r--deluge/ui/console/modes/addtorrents.py8
-rw-r--r--deluge/ui/console/modes/basemode.py2
-rw-r--r--deluge/ui/console/modes/cmdline.py7
-rw-r--r--deluge/ui/console/modes/connectionmanager.py2
-rw-r--r--deluge/ui/console/modes/eventview.py2
-rw-r--r--deluge/ui/console/modes/preferences/__init__.py2
-rw-r--r--deluge/ui/console/modes/preferences/preference_panes.py2
-rw-r--r--deluge/ui/console/modes/preferences/preferences.py2
-rw-r--r--deluge/ui/console/modes/torrentdetail.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/__init__.py3
-rw-r--r--deluge/ui/console/modes/torrentlist/add_torrents_popup.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/filtersidebar.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/queue_mode.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/search_mode.py5
-rw-r--r--deluge/ui/console/modes/torrentlist/torrentactions.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/torrentlist.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/torrentview.py2
-rw-r--r--deluge/ui/console/modes/torrentlist/torrentviewcolumns.py2
-rw-r--r--deluge/ui/console/parser.py2
-rw-r--r--deluge/ui/console/utils/colors.py2
-rw-r--r--deluge/ui/console/utils/column.py2
-rw-r--r--deluge/ui/console/utils/common.py2
-rw-r--r--deluge/ui/console/utils/curses_util.py2
-rw-r--r--deluge/ui/console/utils/format_utils.py2
-rw-r--r--deluge/ui/console/widgets/__init__.py2
-rw-r--r--deluge/ui/console/widgets/fields.py5
-rw-r--r--deluge/ui/console/widgets/inputpane.py2
-rw-r--r--deluge/ui/console/widgets/popup.py2
-rw-r--r--deluge/ui/console/widgets/sidebar.py2
-rw-r--r--deluge/ui/console/widgets/statusbars.py2
-rw-r--r--deluge/ui/console/widgets/window.py2
-rw-r--r--deluge/ui/coreconfig.py2
-rw-r--r--deluge/ui/countries.py2
-rw-r--r--deluge/ui/gtk3/__init__.py2
-rw-r--r--deluge/ui/gtk3/aboutdialog.py2
-rw-r--r--deluge/ui/gtk3/addtorrentdialog.py2
-rw-r--r--deluge/ui/gtk3/common.py16
-rw-r--r--deluge/ui/gtk3/connectionmanager.py9
-rw-r--r--deluge/ui/gtk3/createtorrentdialog.py2
-rw-r--r--deluge/ui/gtk3/details_tab.py2
-rw-r--r--deluge/ui/gtk3/dialogs.py2
-rw-r--r--deluge/ui/gtk3/edittrackersdialog.py2
-rw-r--r--deluge/ui/gtk3/files_tab.py2
-rw-r--r--deluge/ui/gtk3/filtertreeview.py2
-rw-r--r--deluge/ui/gtk3/gtkui.py2
-rw-r--r--deluge/ui/gtk3/ipcinterface.py12
-rw-r--r--deluge/ui/gtk3/listview.py8
-rw-r--r--deluge/ui/gtk3/mainwindow.py2
-rw-r--r--deluge/ui/gtk3/menubar.py2
-rw-r--r--deluge/ui/gtk3/menubar_osx.py2
-rw-r--r--deluge/ui/gtk3/new_release_dialog.py2
-rw-r--r--deluge/ui/gtk3/options_tab.py2
-rw-r--r--deluge/ui/gtk3/path_chooser.py2
-rwxr-xr-xdeluge/ui/gtk3/path_combo_chooser.py8
-rw-r--r--deluge/ui/gtk3/peers_tab.py8
-rw-r--r--deluge/ui/gtk3/piecesbar.py5
-rw-r--r--deluge/ui/gtk3/pluginmanager.py2
-rw-r--r--deluge/ui/gtk3/preferences.py9
-rw-r--r--deluge/ui/gtk3/queuedtorrents.py2
-rw-r--r--deluge/ui/gtk3/removetorrentdialog.py2
-rw-r--r--deluge/ui/gtk3/sidebar.py2
-rw-r--r--deluge/ui/gtk3/status_tab.py2
-rw-r--r--deluge/ui/gtk3/statusbar.py2
-rw-r--r--deluge/ui/gtk3/systemtray.py2
-rw-r--r--deluge/ui/gtk3/tab_data_funcs.py2
-rw-r--r--deluge/ui/gtk3/toolbar.py2
-rw-r--r--deluge/ui/gtk3/torrentdetails.py2
-rw-r--r--deluge/ui/gtk3/torrentview.py2
-rw-r--r--deluge/ui/gtk3/torrentview_data_funcs.py2
-rw-r--r--deluge/ui/gtk3/trackers_tab.py2
-rw-r--r--deluge/ui/hostlist.py2
-rw-r--r--deluge/ui/sessionproxy.py2
-rw-r--r--deluge/ui/tracker_icons.py12
-rw-r--r--deluge/ui/ui.py2
-rw-r--r--deluge/ui/ui_entry.py2
-rw-r--r--deluge/ui/web/__init__.py2
-rw-r--r--deluge/ui/web/auth.py2
-rw-r--r--deluge/ui/web/common.py6
-rw-r--r--deluge/ui/web/json_api.py2
-rw-r--r--deluge/ui/web/pluginmanager.py2
-rw-r--r--deluge/ui/web/server.py2
-rw-r--r--deluge/ui/web/web.py2
-rw-r--r--docs/source/conf.py2
-rw-r--r--docs/source/devguide/how-to/update-1.3-plugin.md15
-rwxr-xr-xgen_web_gettext.py2
-rwxr-xr-xgenerate_pot.py2
-rwxr-xr-xminify_web_js.py9
-rwxr-xr-xmsgfmt.py10
-rwxr-xr-xpackaging/source/make_release.py7
-rw-r--r--pyproject.toml2
-rw-r--r--requirements.txt1
-rwxr-xr-xsetup.py13
-rw-r--r--tox.ini2
-rwxr-xr-xversion.py2
259 files changed, 87 insertions, 818 deletions
diff --git a/.pylintrc b/.pylintrc
index becbe3f28..75fa0e6e4 100644
--- a/.pylintrc
+++ b/.pylintrc
@@ -289,7 +289,7 @@ callbacks=cb_,_cb
# List of qualified module names which can have objects that can redefine
# builtins.
-redefining-builtins-modules=six.moves,future.builtins,future_builtins
+redefining-builtins-modules=
[TYPECHECK]
@@ -359,11 +359,6 @@ known-standard-library=
# Force import order to recognize a module as part of a third party library.
known-third-party=enchant
-# Analyse import fallback blocks. This can be used to support both Python 2 and
-# 3 compatible code, which means that the block might have code that exists
-# only in one or another interpreter, leading to false positives when analysed.
-analyse-fallback-blocks=no
-
[DESIGN]
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 928ee76dd..251b68102 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,8 @@
# Changelog
-## 2.0.6 (WIP)
+## 2.1.0 (WIP)
+
+- Removed Python 2 support.
## 2.0.5 (2021-12-15)
diff --git a/DEPENDS.md b/DEPENDS.md
index 0844718c4..076069566 100644
--- a/DEPENDS.md
+++ b/DEPENDS.md
@@ -23,7 +23,6 @@ All modules will require the [common](#common) section dependencies.
- [rencode] _>= 1.0.2_ - Encoding library.
- [PyXDG] - Access freedesktop.org standards for \*nix.
- [xdg-utils] - Provides xdg-open for \*nix.
-- [six]
- [zope.interface]
- [chardet] - Optional: Encoding detection.
- [setproctitle] - Optional: Renaming processes.
@@ -81,14 +80,12 @@ All modules will require the [common](#common) section dependencies.
[distro]: https://github.com/nir0s/distro
[pywin32]: https://github.com/mhammond/pywin32
[certifi]: https://pypi.org/project/certifi/
-[py2-ipaddress]: https://pypi.org/project/py2-ipaddress/
[dbus-python]: https://pypi.org/project/dbus-python/
[setproctitle]: https://pypi.org/project/setproctitle/
[gtkosxapplication]: https://github.com/jralls/gtk-mac-integration
[chardet]: https://chardet.github.io/
[rencode]: https://github.com/aresch/rencode
[pyxdg]: https://www.freedesktop.org/wiki/Software/pyxdg/
-[six]: https://pythonhosted.org/six/
[xdg-utils]: https://www.freedesktop.org/wiki/Software/xdg-utils/
[gtk+]: https://www.gtk.org/
[pycairo]: https://cairographics.org/pycairo/
diff --git a/deluge/_libtorrent.py b/deluge/_libtorrent.py
index 0020184e5..86025b56a 100644
--- a/deluge/_libtorrent.py
+++ b/deluge/_libtorrent.py
@@ -15,8 +15,6 @@ Example:
>>> from deluge._libtorrent import lt
"""
-from __future__ import unicode_literals
-
from deluge.common import VersionSplit, get_version
from deluge.error import LibtorrentImportError
diff --git a/deluge/argparserbase.py b/deluge/argparserbase.py
index 547c1c71c..a27ba1aaf 100644
--- a/deluge/argparserbase.py
+++ b/deluge/argparserbase.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import argparse
import logging
import os
diff --git a/deluge/bencode.py b/deluge/bencode.py
index 0c2674b9b..f065783e9 100644
--- a/deluge/bencode.py
+++ b/deluge/bencode.py
@@ -9,13 +9,7 @@
# License.
# Written by Petru Paler
-# Updated by Calum Lind to support both Python 2 and Python 3.
-
-from __future__ import unicode_literals
-
-from sys import version_info
-
-PY2 = version_info.major == 2
+# Updated by Calum Lind to support Python 3.
class BTFailure(Exception):
@@ -146,10 +140,6 @@ encode_func[dict] = encode_dict
encode_func[bool] = encode_bool
encode_func[str] = encode_string
encode_func[bytes] = encode_bytes
-if PY2:
- encode_func[long] = encode_int # noqa: F821
- encode_func[str] = encode_bytes
- encode_func[unicode] = encode_string # noqa: F821
def bencode(x):
diff --git a/deluge/common.py b/deluge/common.py
index a0e3fdd3b..0bb085813 100644
--- a/deluge/common.py
+++ b/deluge/common.py
@@ -8,8 +8,6 @@
#
"""Common functions for various parts of Deluge to use."""
-from __future__ import division, print_function, unicode_literals
-
import base64
import binascii
import functools
@@ -27,6 +25,8 @@ import time
from contextlib import closing
from datetime import datetime
from io import BytesIO, open
+from urllib.parse import unquote_plus, urljoin
+from urllib.request import pathname2url
import pkg_resources
@@ -38,14 +38,6 @@ try:
except ImportError:
chardet = None
-try:
- from urllib.parse import unquote_plus, urljoin
- from urllib.request import pathname2url
-except ImportError:
- # PY2 fallback
- from urllib import pathname2url, unquote_plus # pylint: disable=ungrouped-imports
- from urlparse import urljoin # pylint: disable=ungrouped-imports
-
# Windows workaround for HTTPS requests requiring certificate authority bundle.
# see: https://twistedmatrix.com/trac/ticket/9209
if platform.system() in ('Windows', 'Microsoft'):
@@ -84,8 +76,6 @@ JSON_FORMAT = {'indent': 4, 'sort_keys': True, 'ensure_ascii': False}
DBUS_FM_ID = 'org.freedesktop.FileManager1'
DBUS_FM_PATH = '/org/freedesktop/FileManager1'
-PY2 = sys.version_info.major == 2
-
def get_version():
"""The program version from the egg metadata.
@@ -111,10 +101,8 @@ def get_default_config_dir(filename=None):
def save_config_path(resource):
app_data_path = os.environ.get('APPDATA')
if not app_data_path:
- try:
- import winreg
- except ImportError:
- import _winreg as winreg # For Python 2.
+ import winreg
+
hkey = winreg.OpenKey(
winreg.HKEY_CURRENT_USER,
'Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders',
@@ -178,8 +166,8 @@ def archive_files(arc_name, filepaths, message=None, rotate=10):
from deluge.configmanager import get_config_dir
- # Set archive compression to lzma with bz2 fallback.
- arc_comp = 'xz' if not PY2 else 'bz2'
+ # Set archive compression to lzma
+ arc_comp = 'xz'
archive_dir = os.path.join(get_config_dir(), 'archive')
timestamp = datetime.now().replace(microsecond=0).isoformat().replace(':', '-')
@@ -1239,11 +1227,7 @@ def set_env_variable(name, value):
http://sourceforge.net/p/gramps/code/HEAD/tree/branches/maintenance/gramps32/src/TransUtils.py
"""
# Update Python's copy of the environment variables
- try:
- os.environ[name] = value
- except UnicodeEncodeError:
- # Python 2
- os.environ[name] = value.encode('utf8')
+ os.environ[name] = value
if windows_check():
from ctypes import cdll, windll
@@ -1271,45 +1255,22 @@ def set_env_variable(name, value):
def unicode_argv():
""" Gets sys.argv as list of unicode objects on any platform."""
- if windows_check():
- # Versions 2.x of Python don't support Unicode in sys.argv on
- # Windows, with the underlying Windows API instead replacing multi-byte
- # characters with '?'.
- from ctypes import POINTER, byref, c_int, cdll, windll
- from ctypes.wintypes import LPCWSTR, LPWSTR
-
- get_cmd_linew = cdll.kernel32.GetCommandLineW
- get_cmd_linew.argtypes = []
- get_cmd_linew.restype = LPCWSTR
-
- cmdline_to_argvw = windll.shell32.CommandLineToArgvW
- cmdline_to_argvw.argtypes = [LPCWSTR, POINTER(c_int)]
- cmdline_to_argvw.restype = POINTER(LPWSTR)
-
- cmd = get_cmd_linew()
- argc = c_int(0)
- argv = cmdline_to_argvw(cmd, byref(argc))
- if argc.value > 0:
- # Remove Python executable and commands if present
- start = argc.value - len(sys.argv)
- return [argv[i] for i in range(start, argc.value)]
- else:
- # On other platforms, we have to find the likely encoding of the args and decode
- # First check if sys.stdout or stdin have encoding set
- encoding = getattr(sys.stdout, 'encoding') or getattr(sys.stdin, 'encoding')
- # If that fails, check what the locale is set to
- encoding = encoding or locale.getpreferredencoding()
- # As a last resort, just default to utf-8
- encoding = encoding or 'utf-8'
-
- arg_list = []
- for arg in sys.argv:
- try:
- arg_list.append(arg.decode(encoding))
- except AttributeError:
- arg_list.append(arg)
+ # On platforms other than Windows, we have to find the likely encoding of the args and decode
+ # First check if sys.stdout or stdin have encoding set
+ encoding = getattr(sys.stdout, 'encoding') or getattr(sys.stdin, 'encoding')
+ # If that fails, check what the locale is set to
+ encoding = encoding or locale.getpreferredencoding()
+ # As a last resort, just default to utf-8
+ encoding = encoding or 'utf-8'
+
+ arg_list = []
+ for arg in sys.argv:
+ try:
+ arg_list.append(arg.decode(encoding))
+ except AttributeError:
+ arg_list.append(arg)
- return arg_list
+ return arg_list
def run_profiled(func, *args, **kwargs):
diff --git a/deluge/component.py b/deluge/component.py
index b7b7ab3e4..bbbd33b6f 100644
--- a/deluge/component.py
+++ b/deluge/component.py
@@ -7,13 +7,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import traceback
from collections import defaultdict
-from six import string_types
from twisted.internet import reactor
from twisted.internet.defer import DeferredList, fail, maybeDeferred, succeed
from twisted.internet.task import LoopingCall, deferLater
@@ -325,7 +322,7 @@ class ComponentRegistry(object):
# Start all the components if names is empty
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
def on_depends_started(result, name):
@@ -359,7 +356,7 @@ class ComponentRegistry(object):
"""
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
def on_dependents_stopped(result, name):
@@ -399,7 +396,7 @@ class ComponentRegistry(object):
"""
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
deferreds = []
@@ -425,7 +422,7 @@ class ComponentRegistry(object):
"""
if not names:
names = list(self.components)
- elif isinstance(names, string_types):
+ elif isinstance(names, str):
names = [names]
deferreds = []
diff --git a/deluge/config.py b/deluge/config.py
index 80b30faf5..0900e7a36 100644
--- a/deluge/config.py
+++ b/deluge/config.py
@@ -39,18 +39,15 @@ this can only be done for the 'config file version' and not for the 'format'
version as this will be done internally.
"""
-from __future__ import unicode_literals
-
import json
import logging
import os
+import pickle
import shutil
from codecs import getwriter
from io import open
from tempfile import NamedTemporaryFile
-import six.moves.cPickle as pickle # noqa: N813
-
from deluge.common import JSON_FORMAT, get_default_config_dir
log = logging.getLogger(__name__)
diff --git a/deluge/configmanager.py b/deluge/configmanager.py
index bbb0389a5..dcd71916a 100644
--- a/deluge/configmanager.py
+++ b/deluge/configmanager.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
diff --git a/deluge/core/alertmanager.py b/deluge/core/alertmanager.py
index 2fe42224d..9d5c18ccb 100644
--- a/deluge/core/alertmanager.py
+++ b/deluge/core/alertmanager.py
@@ -15,10 +15,8 @@ This should typically only be used by the Core. Plugins should utilize the
`:mod:EventManager` for similar functionality.
"""
-from __future__ import unicode_literals
-
import logging
-import types
+from types import SimpleNamespace
from twisted.internet import reactor
@@ -28,14 +26,6 @@ from deluge.common import decode_bytes
log = logging.getLogger(__name__)
-try:
- SimpleNamespace = types.SimpleNamespace # Python 3.3+
-except AttributeError:
-
- class SimpleNamespace(object): # Python 2.7
- def __init__(self, **attr):
- self.__dict__.update(attr)
-
class AlertManager(component.Component):
"""AlertManager fetches and processes libtorrent alerts"""
diff --git a/deluge/core/authmanager.py b/deluge/core/authmanager.py
index 713373e99..ecb4948b9 100644
--- a/deluge/core/authmanager.py
+++ b/deluge/core/authmanager.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import shutil
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:
diff --git a/deluge/core/daemon.py b/deluge/core/daemon.py
index 3c2ac643b..269558928 100644
--- a/deluge/core/daemon.py
+++ b/deluge/core/daemon.py
@@ -8,8 +8,6 @@
#
"""The Deluge daemon"""
-from __future__ import unicode_literals
-
import logging
import os
import socket
diff --git a/deluge/core/daemon_entry.py b/deluge/core/daemon_entry.py
index 8b3746c43..33304fd08 100644
--- a/deluge/core/daemon_entry.py
+++ b/deluge/core/daemon_entry.py
@@ -7,8 +7,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import os
import sys
from logging import DEBUG, FileHandler, getLogger
diff --git a/deluge/core/eventmanager.py b/deluge/core/eventmanager.py
index 5ba2989f9..da60ac7e3 100644
--- a/deluge/core/eventmanager.py
+++ b/deluge/core/eventmanager.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/core/filtermanager.py b/deluge/core/filtermanager.py
index 90589ef1f..c4f342097 100644
--- a/deluge/core/filtermanager.py
+++ b/deluge/core/filtermanager.py
@@ -7,12 +7,8 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
-from six import string_types
-
import deluge.component as component
from deluge.common import TORRENT_STATE
@@ -136,7 +132,7 @@ class FilterManager(component.Component):
# Sanitize input: filter-value must be a list of strings
for key, value in filter_dict.items():
- if isinstance(value, string_types):
+ if isinstance(value, str):
filter_dict[key] = [value]
# Optimized filter for id
diff --git a/deluge/core/pluginmanager.py b/deluge/core/pluginmanager.py
index 7d2f3a1e8..74b7d0039 100644
--- a/deluge/core/pluginmanager.py
+++ b/deluge/core/pluginmanager.py
@@ -9,8 +9,6 @@
"""PluginManager for Core"""
-from __future__ import unicode_literals
-
import logging
from twisted.internet import defer
diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py
index c250130c0..f3d104103 100644
--- a/deluge/core/preferencesmanager.py
+++ b/deluge/core/preferencesmanager.py
@@ -8,13 +8,13 @@
#
-from __future__ import unicode_literals
-
import logging
import os
import platform
import random
import threading
+from urllib.parse import quote_plus
+from urllib.request import urlopen
from twisted.internet.task import LoopingCall
@@ -29,13 +29,6 @@ try:
except ImportError:
GeoIP = None
-try:
- from urllib.parse import quote_plus
- from urllib.request import urlopen
-except ImportError:
- from urllib import quote_plus
- from urllib2 import urlopen
-
log = logging.getLogger(__name__)
DEFAULT_PREFS = {
diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py
index 4fa94c387..db570d175 100644
--- a/deluge/core/rpcserver.py
+++ b/deluge/core/rpcserver.py
@@ -8,8 +8,6 @@
#
"""RPCServer Module"""
-from __future__ import unicode_literals
-
import logging
import os
import sys
diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py
index ede5200f0..ee3669338 100644
--- a/deluge/core/torrent.py
+++ b/deluge/core/torrent.py
@@ -14,11 +14,10 @@ Attributes:
"""
-from __future__ import division, unicode_literals
-
import logging
import os
import socket
+from urllib.parse import urlparse
from twisted.internet.defer import Deferred, DeferredList
@@ -34,18 +33,6 @@ from deluge.event import (
TorrentTrackerStatusEvent,
)
-try:
- from urllib.parse import urlparse
-except ImportError:
- # PY2 fallback
- from urlparse import urlparse # pylint: disable=ungrouped-imports
-
-try:
- from future_builtins import zip
-except ImportError:
- # Ignore on Py3.
- pass
-
log = logging.getLogger(__name__)
LT_TORRENT_STATE_MAP = {
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 365f37233..84d147a49 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -8,17 +8,15 @@
#
"""TorrentManager handles Torrent objects"""
-from __future__ import unicode_literals
-
import datetime
import logging
import operator
import os
+import pickle
import time
from collections import namedtuple
from tempfile import gettempdir
-import six.moves.cPickle as pickle # noqa: N813
from twisted.internet import defer, error, reactor, threads
from twisted.internet.defer import Deferred, DeferredList
from twisted.internet.task import LoopingCall
@@ -26,7 +24,6 @@ from twisted.internet.task import LoopingCall
import deluge.component as component
from deluge._libtorrent import LT_VERSION, lt
from deluge.common import (
- PY2,
VersionSplit,
archive_files,
decode_bytes,
@@ -821,10 +818,7 @@ class TorrentManager(component.Component):
try:
with open(filepath, 'rb') as _file:
- if PY2:
- state = pickle.load(_file)
- else:
- state = pickle.load(_file, encoding='utf8')
+ state = pickle.load(_file, encoding='utf8')
except (IOError, EOFError, pickle.UnpicklingError) as ex:
message = 'Unable to load {}: {}'.format(filepath, ex)
log.error(message)
diff --git a/deluge/crypto_utils.py b/deluge/crypto_utils.py
index 978eb0410..840a24533 100644
--- a/deluge/crypto_utils.py
+++ b/deluge/crypto_utils.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, print_function, unicode_literals
-
import os
import stat
@@ -105,9 +103,7 @@ def generate_ssl_keys():
"""
This method generates a new SSL key/cert.
"""
- from deluge.common import PY2
-
- digest = 'sha256' if not PY2 else b'sha256'
+ digest = 'sha256'
# Generate key pair
pkey = crypto.PKey()
diff --git a/deluge/decorators.py b/deluge/decorators.py
index a601bf7e0..0c66572f0 100644
--- a/deluge/decorators.py
+++ b/deluge/decorators.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import inspect
import re
import warnings
diff --git a/deluge/error.py b/deluge/error.py
index 46e8e0cf1..ba8529452 100644
--- a/deluge/error.py
+++ b/deluge/error.py
@@ -9,9 +9,6 @@
#
-from __future__ import unicode_literals
-
-
class DelugeError(Exception):
def __new__(cls, *args, **kwargs):
inst = super(DelugeError, cls).__new__(cls, *args, **kwargs)
diff --git a/deluge/event.py b/deluge/event.py
index c5d5ff910..a90707060 100644
--- a/deluge/event.py
+++ b/deluge/event.py
@@ -14,10 +14,6 @@ This module describes the types of events that can be generated by the daemon
and subsequently emitted to the clients.
"""
-from __future__ import unicode_literals
-
-import six
-
known_events = {}
@@ -32,7 +28,7 @@ class DelugeEventMetaClass(type):
known_events[name] = cls
-class DelugeEvent(six.with_metaclass(DelugeEventMetaClass, object)):
+class DelugeEvent(metaclass=DelugeEventMetaClass):
"""
The base class for all events.
diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py
index f0fe09ec0..da7bf3a16 100644
--- a/deluge/httpdownloader.py
+++ b/deluge/httpdownloader.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import cgi
import logging
import os.path
diff --git a/deluge/i18n/languages.py b/deluge/i18n/languages.py
index 49dc53026..5f7defc80 100644
--- a/deluge/i18n/languages.py
+++ b/deluge/i18n/languages.py
@@ -3,8 +3,6 @@
# This file is public domain.
#
-from __future__ import unicode_literals
-
# Language code for this installation. All choices can be found here:
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = 'en-us'
diff --git a/deluge/i18n/util.py b/deluge/i18n/util.py
index 6ed4b97da..897f412f2 100644
--- a/deluge/i18n/util.py
+++ b/deluge/i18n/util.py
@@ -7,8 +7,7 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
+import builtins
import ctypes
import gettext
import locale
@@ -17,8 +16,6 @@ import os
import sys
from glob import glob
-from six.moves import builtins
-
import deluge.common
from .languages import LANGUAGES
@@ -113,10 +110,7 @@ def setup_translation():
gettext.bindtextdomain(I18N_DOMAIN, translations_path)
gettext.textdomain(I18N_DOMAIN)
- # Workaround for Python 2 unicode gettext (keyword removed in Py3).
- kwargs = {} if not deluge.common.PY2 else {'unicode': True}
-
- gettext.install(I18N_DOMAIN, translations_path, names=['ngettext'], **kwargs)
+ gettext.install(I18N_DOMAIN, translations_path, names=['ngettext'])
builtins.__dict__['_n'] = builtins.__dict__['ngettext']
def load_libintl(libintls):
diff --git a/deluge/log.py b/deluge/log.py
index 99838529f..868be4593 100644
--- a/deluge/log.py
+++ b/deluge/log.py
@@ -9,8 +9,6 @@
#
"""Logging functions"""
-from __future__ import unicode_literals
-
import inspect
import logging
import logging.handlers
@@ -102,10 +100,7 @@ class Logging(LoggingLoggerClass):
continue
rv = (co.co_filename, f.f_lineno, co.co_name, None)
break
- if common.PY2:
- return rv[:-1]
- else:
- return rv
+ return rv
levels = {
diff --git a/deluge/maketorrent.py b/deluge/maketorrent.py
index 528638e43..0a4eb93c9 100644
--- a/deluge/maketorrent.py
+++ b/deluge/maketorrent.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import os
from hashlib import sha1 as sha
diff --git a/deluge/metafile.py b/deluge/metafile.py
index 8c28c7e91..b39da11b1 100644
--- a/deluge/metafile.py
+++ b/deluge/metafile.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import os.path
import time
diff --git a/deluge/path_chooser_common.py b/deluge/path_chooser_common.py
index 0f93feef6..002a6e80a 100644
--- a/deluge/path_chooser_common.py
+++ b/deluge/path_chooser_common.py
@@ -8,12 +8,8 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
-from deluge.common import PY2
-
def is_hidden(filepath):
def has_hidden_attribute(filepath):
@@ -54,10 +50,7 @@ def get_completion_paths(args):
def get_subdirs(dirname):
try:
- if PY2:
- return os.walk(dirname).__next__[1]
- else:
- return next(os.walk(dirname))[1]
+ return next(os.walk(dirname))[1]
except StopIteration:
# Invalid dirname
return []
diff --git a/deluge/pluginmanagerbase.py b/deluge/pluginmanagerbase.py
index 2c1744555..da016ed66 100644
--- a/deluge/pluginmanagerbase.py
+++ b/deluge/pluginmanagerbase.py
@@ -9,8 +9,6 @@
"""PluginManagerBase"""
-from __future__ import unicode_literals
-
import logging
import os.path
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py b/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py
index a409cfcce..ec98d8848 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/__init__.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/common.py b/deluge/plugins/AutoAdd/deluge_autoadd/common.py
index 9b4b1e703..f6783de42 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/common.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/core.py b/deluge/plugins/AutoAdd/deluge_autoadd/core.py
index 9a2260610..33f5350f3 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/core.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/core.py
@@ -13,8 +13,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import shutil
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
index 35531419b..969a1638f 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/gtkui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
diff --git a/deluge/plugins/AutoAdd/deluge_autoadd/webui.py b/deluge/plugins/AutoAdd/deluge_autoadd/webui.py
index 7f36ba659..41dc4d80e 100644
--- a/deluge/plugins/AutoAdd/deluge_autoadd/webui.py
+++ b/deluge/plugins/AutoAdd/deluge_autoadd/webui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/__init__.py b/deluge/plugins/Blocklist/deluge_blocklist/__init__.py
index 96ccc02ae..80775cc1d 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/__init__.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/__init__.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/common.py b/deluge/plugins/Blocklist/deluge_blocklist/common.py
index a9299cd2e..b45de94b0 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/common.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/common.py
@@ -12,13 +12,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from functools import wraps
from sys import exc_info
-import six
from pkg_resources import resource_filename
@@ -47,7 +44,7 @@ def raises_errors_as(error):
return func(self, *args, **kwargs)
except Exception:
(value, tb) = exc_info()[1:]
- six.reraise(error, value, tb)
+ raise error(value).with_traceback(tb) from None
return wrapper
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/core.py b/deluge/plugins/Blocklist/deluge_blocklist/core.py
index a096b8ac9..53e36705d 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/core.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/core.py
@@ -8,14 +8,13 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import os
import shutil
import time
from datetime import datetime, timedelta
from email.utils import formatdate
+from urllib.parse import urljoin
from twisted.internet import defer, threads
from twisted.internet.task import LoopingCall
@@ -32,12 +31,6 @@ from .common import IP, BadIP
from .detect import UnknownFormatError, create_reader, detect_compression, detect_format
from .readers import ReaderParseError
-try:
- from urllib.parse import urljoin
-except ImportError:
- # PY2 fallback
- from urlparse import urljoin # pylint: disable=ungrouped-imports
-
# TODO: check return values for deferred callbacks
# TODO: review class attributes for redundancy
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py b/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py
index 35211b706..4a0f0a05e 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/decompressers.py
@@ -8,8 +8,6 @@
#
# pylint: disable=redefined-builtin
-from __future__ import unicode_literals
-
import bz2
import gzip
import zipfile
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/detect.py b/deluge/plugins/Blocklist/deluge_blocklist/detect.py
index 262d5de4f..5d7858d68 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/detect.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/detect.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from .decompressers import BZipped2, GZipped, Zipped
from .readers import EmuleReader, PeerGuardianReader, SafePeerReader
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py b/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py
index b6e5d5508..215c71231 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/gtkui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from datetime import datetime
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py b/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py
index ba410c2cf..f5389016f 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/peerguardian.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import gzip
import logging
import socket
@@ -65,8 +63,5 @@ class PGReader(object):
return (start, end)
- # Python 2 compatibility
- next = __next__
-
def close(self):
self.fd.close()
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/readers.py b/deluge/plugins/Blocklist/deluge_blocklist/readers.py
index 4079e849e..6eda027a8 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/readers.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/readers.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import re
diff --git a/deluge/plugins/Blocklist/deluge_blocklist/webui.py b/deluge/plugins/Blocklist/deluge_blocklist/webui.py
index 3da43c451..7d7b0c846 100644
--- a/deluge/plugins/Blocklist/deluge_blocklist/webui.py
+++ b/deluge/plugins/Blocklist/deluge_blocklist/webui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Execute/deluge_execute/__init__.py b/deluge/plugins/Execute/deluge_execute/__init__.py
index c6d55f4ec..d515d4911 100644
--- a/deluge/plugins/Execute/deluge_execute/__init__.py
+++ b/deluge/plugins/Execute/deluge_execute/__init__.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Execute/deluge_execute/common.py b/deluge/plugins/Execute/deluge_execute/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/Execute/deluge_execute/common.py
+++ b/deluge/plugins/Execute/deluge_execute/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Execute/deluge_execute/core.py b/deluge/plugins/Execute/deluge_execute/core.py
index f5fa2c2e6..388e47eb7 100644
--- a/deluge/plugins/Execute/deluge_execute/core.py
+++ b/deluge/plugins/Execute/deluge_execute/core.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import hashlib
import logging
import os
diff --git a/deluge/plugins/Execute/deluge_execute/gtkui.py b/deluge/plugins/Execute/deluge_execute/gtkui.py
index c0c720089..15d735cbd 100644
--- a/deluge/plugins/Execute/deluge_execute/gtkui.py
+++ b/deluge/plugins/Execute/deluge_execute/gtkui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import gi # isort:skip (Required before Gtk import).
diff --git a/deluge/plugins/Execute/deluge_execute/webui.py b/deluge/plugins/Execute/deluge_execute/webui.py
index 8327001b8..de337e73c 100644
--- a/deluge/plugins/Execute/deluge_execute/webui.py
+++ b/deluge/plugins/Execute/deluge_execute/webui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Extractor/deluge_extractor/__init__.py b/deluge/plugins/Extractor/deluge_extractor/__init__.py
index 6db72b63b..63e88bd47 100644
--- a/deluge/plugins/Extractor/deluge_extractor/__init__.py
+++ b/deluge/plugins/Extractor/deluge_extractor/__init__.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Extractor/deluge_extractor/common.py b/deluge/plugins/Extractor/deluge_extractor/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/Extractor/deluge_extractor/common.py
+++ b/deluge/plugins/Extractor/deluge_extractor/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Extractor/deluge_extractor/core.py b/deluge/plugins/Extractor/deluge_extractor/core.py
index 8fa5bd3da..54440e446 100644
--- a/deluge/plugins/Extractor/deluge_extractor/core.py
+++ b/deluge/plugins/Extractor/deluge_extractor/core.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import errno
import logging
import os
@@ -37,10 +35,7 @@ if windows_check():
'C:\\Program Files (x86)\\7-Zip\\7z.exe',
]
- try:
- import winreg
- except ImportError:
- import _winreg as winreg # For Python 2.
+ import winreg
try:
hkey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, 'Software\\7-Zip')
diff --git a/deluge/plugins/Extractor/deluge_extractor/gtkui.py b/deluge/plugins/Extractor/deluge_extractor/gtkui.py
index 113b33f6d..5536a0e28 100644
--- a/deluge/plugins/Extractor/deluge_extractor/gtkui.py
+++ b/deluge/plugins/Extractor/deluge_extractor/gtkui.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import gi # isort:skip (Required before Gtk import).
diff --git a/deluge/plugins/Extractor/deluge_extractor/webui.py b/deluge/plugins/Extractor/deluge_extractor/webui.py
index feb7b4a83..eaab79a74 100644
--- a/deluge/plugins/Extractor/deluge_extractor/webui.py
+++ b/deluge/plugins/Extractor/deluge_extractor/webui.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Label/deluge_label/__init__.py b/deluge/plugins/Label/deluge_label/__init__.py
index bc0b0f243..fea7dcdcd 100644
--- a/deluge/plugins/Label/deluge_label/__init__.py
+++ b/deluge/plugins/Label/deluge_label/__init__.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Label/deluge_label/common.py b/deluge/plugins/Label/deluge_label/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/Label/deluge_label/common.py
+++ b/deluge/plugins/Label/deluge_label/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Label/deluge_label/core.py b/deluge/plugins/Label/deluge_label/core.py
index b16156c91..d4200f618 100644
--- a/deluge/plugins/Label/deluge_label/core.py
+++ b/deluge/plugins/Label/deluge_label/core.py
@@ -15,8 +15,6 @@
torrent-label core plugin.
adds a status field for tracker.
"""
-from __future__ import unicode_literals
-
import logging
import re
diff --git a/deluge/plugins/Label/deluge_label/gtkui/__init__.py b/deluge/plugins/Label/deluge_label/gtkui/__init__.py
index eeaeadcc8..88c470d4d 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/__init__.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/__init__.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge import component # for systray
diff --git a/deluge/plugins/Label/deluge_label/gtkui/label_config.py b/deluge/plugins/Label/deluge_label/gtkui/label_config.py
index b1bf56de6..6edf4ddeb 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/label_config.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/label_config.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository.Gtk import Builder
diff --git a/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py
index fe0e86bda..499175bfd 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/sidebar_menu.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import gi # isort:skip (Required before Gtk import).
diff --git a/deluge/plugins/Label/deluge_label/gtkui/submenu.py b/deluge/plugins/Label/deluge_label/gtkui/submenu.py
index c5f80e70c..f41b8457d 100644
--- a/deluge/plugins/Label/deluge_label/gtkui/submenu.py
+++ b/deluge/plugins/Label/deluge_label/gtkui/submenu.py
@@ -8,8 +8,6 @@
#
-from __future__ import unicode_literals
-
import logging
from gi.repository.Gtk import Menu, MenuItem
diff --git a/deluge/plugins/Label/deluge_label/test.py b/deluge/plugins/Label/deluge_label/test.py
index 5c9ffcd00..00d052bfa 100644
--- a/deluge/plugins/Label/deluge_label/test.py
+++ b/deluge/plugins/Label/deluge_label/test.py
@@ -10,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
from deluge.ui.client import sclient
sclient.set_core_uri()
diff --git a/deluge/plugins/Label/deluge_label/webui.py b/deluge/plugins/Label/deluge_label/webui.py
index 58c38e941..cc044e932 100644
--- a/deluge/plugins/Label/deluge_label/webui.py
+++ b/deluge/plugins/Label/deluge_label/webui.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Notifications/deluge_notifications/__init__.py b/deluge/plugins/Notifications/deluge_notifications/__init__.py
index 810e284df..c3001088f 100644
--- a/deluge/plugins/Notifications/deluge_notifications/__init__.py
+++ b/deluge/plugins/Notifications/deluge_notifications/__init__.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Notifications/deluge_notifications/common.py b/deluge/plugins/Notifications/deluge_notifications/common.py
index 6966122ca..2361862dd 100644
--- a/deluge/plugins/Notifications/deluge_notifications/common.py
+++ b/deluge/plugins/Notifications/deluge_notifications/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
diff --git a/deluge/plugins/Notifications/deluge_notifications/core.py b/deluge/plugins/Notifications/deluge_notifications/core.py
index 9eede4576..5f4ab7afe 100644
--- a/deluge/plugins/Notifications/deluge_notifications/core.py
+++ b/deluge/plugins/Notifications/deluge_notifications/core.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import smtplib
from email.utils import formatdate
@@ -119,7 +117,6 @@ Date: %(date)s
message = '\r\n'.join((headers + message).splitlines())
try:
- # Python 2.6
server = smtplib.SMTP(
self.config['smtp_host'], self.config['smtp_port'], timeout=60
)
diff --git a/deluge/plugins/Notifications/deluge_notifications/gtkui.py b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
index cb26901a7..96146f939 100644
--- a/deluge/plugins/Notifications/deluge_notifications/gtkui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/gtkui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from os.path import basename
diff --git a/deluge/plugins/Notifications/deluge_notifications/test.py b/deluge/plugins/Notifications/deluge_notifications/test.py
index 2e6f9755b..16dbbf18d 100644
--- a/deluge/plugins/Notifications/deluge_notifications/test.py
+++ b/deluge/plugins/Notifications/deluge_notifications/test.py
@@ -6,8 +6,6 @@
# License: BSD - Please view the LICENSE file for additional information.
# ==============================================================================
-from __future__ import unicode_literals
-
import logging
from twisted.internet import task
diff --git a/deluge/plugins/Notifications/deluge_notifications/webui.py b/deluge/plugins/Notifications/deluge_notifications/webui.py
index d3529c4f9..9ce1b0012 100644
--- a/deluge/plugins/Notifications/deluge_notifications/webui.py
+++ b/deluge/plugins/Notifications/deluge_notifications/webui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/__init__.py b/deluge/plugins/Scheduler/deluge_scheduler/__init__.py
index 6db72b63b..63e88bd47 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/__init__.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/__init__.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/common.py b/deluge/plugins/Scheduler/deluge_scheduler/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/common.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/core.py b/deluge/plugins/Scheduler/deluge_scheduler/core.py
index 388e4f0f6..008afbcd4 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/core.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/core.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import time
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py b/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py
index 12f5fb63c..3b768eb48 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/gtkui.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
from gi.repository import Gdk, Gtk
diff --git a/deluge/plugins/Scheduler/deluge_scheduler/webui.py b/deluge/plugins/Scheduler/deluge_scheduler/webui.py
index 518eaa6aa..daf5b9955 100644
--- a/deluge/plugins/Scheduler/deluge_scheduler/webui.py
+++ b/deluge/plugins/Scheduler/deluge_scheduler/webui.py
@@ -10,8 +10,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Stats/deluge_stats/__init__.py b/deluge/plugins/Stats/deluge_stats/__init__.py
index a40379b9a..a7ec1b701 100644
--- a/deluge/plugins/Stats/deluge_stats/__init__.py
+++ b/deluge/plugins/Stats/deluge_stats/__init__.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Stats/deluge_stats/common.py b/deluge/plugins/Stats/deluge_stats/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/Stats/deluge_stats/common.py
+++ b/deluge/plugins/Stats/deluge_stats/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Stats/deluge_stats/core.py b/deluge/plugins/Stats/deluge_stats/core.py
index 5f38b69b4..148a4033a 100644
--- a/deluge/plugins/Stats/deluge_stats/core.py
+++ b/deluge/plugins/Stats/deluge_stats/core.py
@@ -10,8 +10,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import time
diff --git a/deluge/plugins/Stats/deluge_stats/graph.py b/deluge/plugins/Stats/deluge_stats/graph.py
index bc18913b3..eb54dbd5f 100644
--- a/deluge/plugins/Stats/deluge_stats/graph.py
+++ b/deluge/plugins/Stats/deluge_stats/graph.py
@@ -14,8 +14,6 @@
port of old plugin by markybob.
"""
-from __future__ import division, unicode_literals
-
import logging
import math
import time
diff --git a/deluge/plugins/Stats/deluge_stats/gtkui.py b/deluge/plugins/Stats/deluge_stats/gtkui.py
index 75e30150e..e207c0471 100644
--- a/deluge/plugins/Stats/deluge_stats/gtkui.py
+++ b/deluge/plugins/Stats/deluge_stats/gtkui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
from gi.repository import Gtk
diff --git a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py
index ab2456877..7b2c2fbff 100644
--- a/deluge/plugins/Stats/deluge_stats/tests/test_stats.py
+++ b/deluge/plugins/Stats/deluge_stats/tests/test_stats.py
@@ -4,8 +4,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import pytest
from twisted.internet import defer
from twisted.trial import unittest
diff --git a/deluge/plugins/Stats/deluge_stats/webui.py b/deluge/plugins/Stats/deluge_stats/webui.py
index 4c11260e5..9e7e6992d 100644
--- a/deluge/plugins/Stats/deluge_stats/webui.py
+++ b/deluge/plugins/Stats/deluge_stats/webui.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/Toggle/deluge_toggle/__init__.py b/deluge/plugins/Toggle/deluge_toggle/__init__.py
index e63e4aa4c..13fa017ef 100644
--- a/deluge/plugins/Toggle/deluge_toggle/__init__.py
+++ b/deluge/plugins/Toggle/deluge_toggle/__init__.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/Toggle/deluge_toggle/common.py b/deluge/plugins/Toggle/deluge_toggle/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/Toggle/deluge_toggle/common.py
+++ b/deluge/plugins/Toggle/deluge_toggle/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/Toggle/deluge_toggle/core.py b/deluge/plugins/Toggle/deluge_toggle/core.py
index dad52ce61..77727e451 100644
--- a/deluge/plugins/Toggle/deluge_toggle/core.py
+++ b/deluge/plugins/Toggle/deluge_toggle/core.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/plugins/Toggle/deluge_toggle/gtkui.py b/deluge/plugins/Toggle/deluge_toggle/gtkui.py
index c54bca46f..f9d8cf917 100644
--- a/deluge/plugins/Toggle/deluge_toggle/gtkui.py
+++ b/deluge/plugins/Toggle/deluge_toggle/gtkui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/plugins/Toggle/deluge_toggle/webui.py b/deluge/plugins/Toggle/deluge_toggle/webui.py
index 8f0fc8c99..c46af6d65 100644
--- a/deluge/plugins/Toggle/deluge_toggle/webui.py
+++ b/deluge/plugins/Toggle/deluge_toggle/webui.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.plugins.pluginbase import WebPluginBase
diff --git a/deluge/plugins/WebUi/deluge_webui/__init__.py b/deluge/plugins/WebUi/deluge_webui/__init__.py
index a3d29805a..5b9aec38b 100644
--- a/deluge/plugins/WebUi/deluge_webui/__init__.py
+++ b/deluge/plugins/WebUi/deluge_webui/__init__.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.plugins.init import PluginInitBase
diff --git a/deluge/plugins/WebUi/deluge_webui/common.py b/deluge/plugins/WebUi/deluge_webui/common.py
index 4c9db09d5..28233e984 100644
--- a/deluge/plugins/WebUi/deluge_webui/common.py
+++ b/deluge/plugins/WebUi/deluge_webui/common.py
@@ -12,8 +12,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os.path
from pkg_resources import resource_filename
diff --git a/deluge/plugins/WebUi/deluge_webui/core.py b/deluge/plugins/WebUi/deluge_webui/core.py
index cc3330fc0..bf6b62e37 100644
--- a/deluge/plugins/WebUi/deluge_webui/core.py
+++ b/deluge/plugins/WebUi/deluge_webui/core.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from twisted.internet import defer
diff --git a/deluge/plugins/WebUi/deluge_webui/gtkui.py b/deluge/plugins/WebUi/deluge_webui/gtkui.py
index ca3a16ea4..8092ff78c 100644
--- a/deluge/plugins/WebUi/deluge_webui/gtkui.py
+++ b/deluge/plugins/WebUi/deluge_webui/gtkui.py
@@ -11,8 +11,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository import Gtk
diff --git a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py
index 56e1cc023..a5fb92315 100644
--- a/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py
+++ b/deluge/plugins/WebUi/deluge_webui/tests/test_plugin_webui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.trial import unittest
import deluge.component as component
diff --git a/deluge/plugins/init.py b/deluge/plugins/init.py
index addeae9f3..28b1efbc1 100644
--- a/deluge/plugins/init.py
+++ b/deluge/plugins/init.py
@@ -10,8 +10,6 @@
"""
This base class is used in plugin's __init__ for the plugin entry points.
"""
-from __future__ import unicode_literals
-
import logging
log = logging.getLogger(__name__)
diff --git a/deluge/plugins/pluginbase.py b/deluge/plugins/pluginbase.py
index e80199df1..6b08c27dc 100644
--- a/deluge/plugins/pluginbase.py
+++ b/deluge/plugins/pluginbase.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py
index 44513ed45..893d1373e 100644
--- a/deluge/scripts/create_plugin.py
+++ b/deluge/scripts/create_plugin.py
@@ -7,8 +7,6 @@ python create_plugin.py --name MyPlugin2 --basepath . --author-name "Your Name"
"""
-from __future__ import print_function, unicode_literals
-
import os
import sys
from argparse import ArgumentParser
diff --git a/deluge/scripts/deluge_remote.py b/deluge/scripts/deluge_remote.py
index bacc4f88d..174254329 100644
--- a/deluge/scripts/deluge_remote.py
+++ b/deluge/scripts/deluge_remote.py
@@ -12,8 +12,6 @@
#
# Authour: Garett Harnish
-from __future__ import unicode_literals
-
import logging
import sys
from optparse import OptionParser
diff --git a/deluge/tests/__init__.py b/deluge/tests/__init__.py
index d3bf10def..7b6afa194 100644
--- a/deluge/tests/__init__.py
+++ b/deluge/tests/__init__.py
@@ -1,7 +1,5 @@
# Increase open file descriptor limit to allow tests to run
# without getting error: what(): epoll: Too many open files
-from __future__ import print_function, unicode_literals
-
from deluge.i18n import setup_translation
try:
diff --git a/deluge/tests/basetest.py b/deluge/tests/basetest.py
index 11ca18e53..ac6514156 100644
--- a/deluge/tests/basetest.py
+++ b/deluge/tests/basetest.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import warnings
from twisted.internet.defer import maybeDeferred
diff --git a/deluge/tests/common.py b/deluge/tests/common.py
index be33f8c58..170a2a288 100644
--- a/deluge/tests/common.py
+++ b/deluge/tests/common.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import os
import sys
import tempfile
diff --git a/deluge/tests/common_web.py b/deluge/tests/common_web.py
index 706eb8d72..f2b82aad5 100644
--- a/deluge/tests/common_web.py
+++ b/deluge/tests/common_web.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.common
import deluge.component as component
import deluge.ui.web.auth
diff --git a/deluge/tests/daemon_base.py b/deluge/tests/daemon_base.py
index 7352e0d32..92ccf0c62 100644
--- a/deluge/tests/daemon_base.py
+++ b/deluge/tests/daemon_base.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import os.path
import pytest
diff --git a/deluge/tests/test_alertmanager.py b/deluge/tests/test_alertmanager.py
index f197882cd..b9dfce5a8 100644
--- a/deluge/tests/test_alertmanager.py
+++ b/deluge/tests/test_alertmanager.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.core.core import Core
diff --git a/deluge/tests/test_authmanager.py b/deluge/tests/test_authmanager.py
index 91e122f73..31a79a857 100644
--- a/deluge/tests/test_authmanager.py
+++ b/deluge/tests/test_authmanager.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.common import get_localhost_auth
from deluge.core.authmanager import AUTH_LEVEL_ADMIN, AuthManager
diff --git a/deluge/tests/test_bencode.py b/deluge/tests/test_bencode.py
index b49c21f83..420869139 100644
--- a/deluge/tests/test_bencode.py
+++ b/deluge/tests/test_bencode.py
@@ -4,8 +4,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.trial import unittest
from deluge import bencode
diff --git a/deluge/tests/test_client.py b/deluge/tests/test_client.py
index ae1e95a71..bccbdd5e0 100644
--- a/deluge/tests/test_client.py
+++ b/deluge/tests/test_client.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.internet import defer
import deluge.component as component
diff --git a/deluge/tests/test_common.py b/deluge/tests/test_common.py
index 4f6aa2fd4..7459997de 100644
--- a/deluge/tests/test_common.py
+++ b/deluge/tests/test_common.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
import sys
import tarfile
diff --git a/deluge/tests/test_component.py b/deluge/tests/test_component.py
index 26f24ad00..5bdb16589 100644
--- a/deluge/tests/test_component.py
+++ b/deluge/tests/test_component.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.internet import defer, threads
from twisted.trial.unittest import SkipTest
diff --git a/deluge/tests/test_config.py b/deluge/tests/test_config.py
index 0f6df3bb5..a514ebcf5 100644
--- a/deluge/tests/test_config.py
+++ b/deluge/tests/test_config.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
from codecs import getwriter
diff --git a/deluge/tests/test_core.py b/deluge/tests/test_core.py
index 15fbc1bcf..5e5815ca0 100644
--- a/deluge/tests/test_core.py
+++ b/deluge/tests/test_core.py
@@ -5,13 +5,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from base64 import b64encode
from hashlib import sha1 as sha
import pytest
-from six import integer_types
from twisted.internet import defer, reactor, task
from twisted.internet.error import CannotListenError
from twisted.python.failure import Failure
@@ -432,8 +429,7 @@ class CoreTestCase(BaseTestCase):
def test_get_free_space(self):
space = self.core.get_free_space('.')
- # get_free_space returns long on Python 2 (32-bit).
- self.assertTrue(isinstance(space, integer_types))
+ self.assertTrue(isinstance(space, int))
self.assertTrue(space >= 0)
self.assertEqual(self.core.get_free_space('/someinvalidpath'), -1)
diff --git a/deluge/tests/test_decorators.py b/deluge/tests/test_decorators.py
index 7d4bd98c8..405a4ffc8 100644
--- a/deluge/tests/test_decorators.py
+++ b/deluge/tests/test_decorators.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.trial import unittest
from deluge.decorators import proxy
diff --git a/deluge/tests/test_error.py b/deluge/tests/test_error.py
index c552e9422..29f19c429 100644
--- a/deluge/tests/test_error.py
+++ b/deluge/tests/test_error.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.trial import unittest
import deluge.error
diff --git a/deluge/tests/test_files_tab.py b/deluge/tests/test_files_tab.py
index 1ec8e18de..108c4db0d 100644
--- a/deluge/tests/test_files_tab.py
+++ b/deluge/tests/test_files_tab.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import pytest
from twisted.trial import unittest
diff --git a/deluge/tests/test_httpdownloader.py b/deluge/tests/test_httpdownloader.py
index ad947a422..649c43cab 100644
--- a/deluge/tests/test_httpdownloader.py
+++ b/deluge/tests/test_httpdownloader.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
import tempfile
from email.utils import formatdate
diff --git a/deluge/tests/test_json_api.py b/deluge/tests/test_json_api.py
index 1da64bf97..0e933e89e 100644
--- a/deluge/tests/test_json_api.py
+++ b/deluge/tests/test_json_api.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import json as json_lib
from mock import MagicMock
diff --git a/deluge/tests/test_log.py b/deluge/tests/test_log.py
index 572693b7c..d5e1fdb53 100644
--- a/deluge/tests/test_log.py
+++ b/deluge/tests/test_log.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import warnings
diff --git a/deluge/tests/test_maketorrent.py b/deluge/tests/test_maketorrent.py
index 4e0099653..ffab14b82 100644
--- a/deluge/tests/test_maketorrent.py
+++ b/deluge/tests/test_maketorrent.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
import tempfile
diff --git a/deluge/tests/test_metafile.py b/deluge/tests/test_metafile.py
index fc6507cb8..d3099c692 100644
--- a/deluge/tests/test_metafile.py
+++ b/deluge/tests/test_metafile.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
import tempfile
diff --git a/deluge/tests/test_plugin_metadata.py b/deluge/tests/test_plugin_metadata.py
index 436fc2c50..e7c14b591 100644
--- a/deluge/tests/test_plugin_metadata.py
+++ b/deluge/tests/test_plugin_metadata.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.pluginmanagerbase import PluginManagerBase
from . import common
diff --git a/deluge/tests/test_rpcserver.py b/deluge/tests/test_rpcserver.py
index 02f9af023..59d84304a 100644
--- a/deluge/tests/test_rpcserver.py
+++ b/deluge/tests/test_rpcserver.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
import deluge.error
from deluge.common import get_localhost_auth
diff --git a/deluge/tests/test_security.py b/deluge/tests/test_security.py
index 4ad66ab51..6154d32d8 100644
--- a/deluge/tests/test_security.py
+++ b/deluge/tests/test_security.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import os
import pytest
diff --git a/deluge/tests/test_sessionproxy.py b/deluge/tests/test_sessionproxy.py
index 03f3cc27e..88400342b 100644
--- a/deluge/tests/test_sessionproxy.py
+++ b/deluge/tests/test_sessionproxy.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.internet.defer import maybeDeferred, succeed
from twisted.internet.task import Clock
diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py
index 5da817924..c8372f5c1 100644
--- a/deluge/tests/test_torrent.py
+++ b/deluge/tests/test_torrent.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import os
import time
from base64 import b64encode
diff --git a/deluge/tests/test_torrentmanager.py b/deluge/tests/test_torrentmanager.py
index e0ff09efc..1be5ba3ac 100644
--- a/deluge/tests/test_torrentmanager.py
+++ b/deluge/tests/test_torrentmanager.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
import shutil
import warnings
@@ -133,8 +131,8 @@ class TorrentmanagerTestCase(BaseTestCase):
InvalidTorrentError, self.tm.remove, 'torrentidthatdoesntexist'
)
- def test_open_state_from_python2(self):
- """Open a Python2 state with a UTF-8 encoded torrent filename."""
+ def test_open_state(self):
+ """Open a state with a UTF-8 encoded torrent filename."""
shutil.copy(
common.get_test_data_file('utf8_filename_torrents.state'),
os.path.join(self.config_dir, 'state', 'torrents.state'),
diff --git a/deluge/tests/test_torrentview.py b/deluge/tests/test_torrentview.py
index 590760d1e..1153e968f 100644
--- a/deluge/tests/test_torrentview.py
+++ b/deluge/tests/test_torrentview.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import pytest
from twisted.trial import unittest
diff --git a/deluge/tests/test_tracker_icons.py b/deluge/tests/test_tracker_icons.py
index e18d33987..8f6dda900 100644
--- a/deluge/tests/test_tracker_icons.py
+++ b/deluge/tests/test_tracker_icons.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import pytest
from twisted.trial.unittest import SkipTest
diff --git a/deluge/tests/test_transfer.py b/deluge/tests/test_transfer.py
index a04830325..f38833f77 100644
--- a/deluge/tests/test_transfer.py
+++ b/deluge/tests/test_transfer.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import base64
import rencode
diff --git a/deluge/tests/test_ui_common.py b/deluge/tests/test_ui_common.py
index b0c311183..d9df0f4d3 100644
--- a/deluge/tests/test_ui_common.py
+++ b/deluge/tests/test_ui_common.py
@@ -6,9 +6,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
-from six import assertCountEqual
from twisted.trial import unittest
from deluge.common import windows_check
@@ -170,4 +167,4 @@ class UICommonTestCase(unittest.TestCase):
{'download': True, 'path': 'unicode_filenames/' + filepath1, 'size': 1771},
]
- assertCountEqual(self, ti.files, result_files)
+ self.assertCountEqual(ti.files, result_files)
diff --git a/deluge/tests/test_ui_console.py b/deluge/tests/test_ui_console.py
index 3667c608e..eacf170da 100644
--- a/deluge/tests/test_ui_console.py
+++ b/deluge/tests/test_ui_console.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import argparse
from deluge.ui.console.cmdline.commands.add import Command
diff --git a/deluge/tests/test_ui_entry.py b/deluge/tests/test_ui_entry.py
index f85bc7d7d..0699dabc6 100644
--- a/deluge/tests/test_ui_entry.py
+++ b/deluge/tests/test_ui_entry.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import argparse
import sys
from io import StringIO
@@ -23,7 +21,7 @@ import deluge.ui.console
import deluge.ui.console.cmdline.commands.quit
import deluge.ui.console.main
import deluge.ui.web.server
-from deluge.common import PY2, get_localhost_auth, windows_check
+from deluge.common import get_localhost_auth, windows_check
from deluge.ui import ui_entry
from deluge.ui.web.server import DelugeWeb
@@ -51,10 +49,7 @@ class StringFileDescriptor(object):
setattr(self, a, getattr(sys_stdout, a))
def write(self, *data, **kwargs):
- # io.StringIO requires unicode strings.
data_string = str(*data)
- if PY2:
- data_string = data_string.decode()
print(data_string, file=self.out, end='')
def flush(self):
@@ -448,11 +443,7 @@ class ConsoleUIWithDaemonBaseTestCase(UIWithDaemonBaseTestCase):
yield self.exec_command()
std_output = fd.out.getvalue()
self.assertTrue(
- std_output.startswith(
- 'Setting "download_location" to: {}\'/downloads\''.format(
- 'u' if PY2 else ''
- )
- )
+ std_output.startswith('Setting "download_location" to: \'/downloads\'')
)
self.assertTrue(
std_output.endswith('Configuration value successfully updated.\n')
diff --git a/deluge/tests/test_ui_gtk3.py b/deluge/tests/test_ui_gtk3.py
index a208bb494..fb8f9e6d3 100644
--- a/deluge/tests/test_ui_gtk3.py
+++ b/deluge/tests/test_ui_gtk3.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import sys
import mock
diff --git a/deluge/tests/test_web_api.py b/deluge/tests/test_web_api.py
index 0180e0bda..96b5234b1 100644
--- a/deluge/tests/test_web_api.py
+++ b/deluge/tests/test_web_api.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import json
from io import BytesIO
diff --git a/deluge/tests/test_web_auth.py b/deluge/tests/test_web_auth.py
index a5185737c..84a5586f4 100644
--- a/deluge/tests/test_web_auth.py
+++ b/deluge/tests/test_web_auth.py
@@ -4,8 +4,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from mock import patch
from twisted.trial import unittest
diff --git a/deluge/tests/test_webserver.py b/deluge/tests/test_webserver.py
index d9684bacd..cdb0ee6ba 100644
--- a/deluge/tests/test_webserver.py
+++ b/deluge/tests/test_webserver.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import json as json_lib
from io import BytesIO
diff --git a/deluge/tests/twisted/plugins/delugereporter.py b/deluge/tests/twisted/plugins/delugereporter.py
index c2a7b52b5..66e9a48b2 100644
--- a/deluge/tests/twisted/plugins/delugereporter.py
+++ b/deluge/tests/twisted/plugins/delugereporter.py
@@ -6,8 +6,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
from twisted.plugin import IPlugin
diff --git a/deluge/transfer.py b/deluge/transfer.py
index 6f8884ad4..92240d2bf 100644
--- a/deluge/transfer.py
+++ b/deluge/transfer.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import struct
import zlib
diff --git a/deluge/ui/client.py b/deluge/ui/client.py
index 180d8ef2b..3d7b2fc06 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import subprocess
import sys
diff --git a/deluge/ui/common.py b/deluge/ui/common.py
index c5064a6f4..ca7d30537 100644
--- a/deluge/ui/common.py
+++ b/deluge/ui/common.py
@@ -11,8 +11,6 @@
"""
The ui common module contains methods and classes that are deemed useful for all the interfaces.
"""
-from __future__ import unicode_literals
-
import logging
import os
from hashlib import sha1 as sha
diff --git a/deluge/ui/console/__init__.py b/deluge/ui/console/__init__.py
index 56e8d629d..0ed345853 100644
--- a/deluge/ui/console/__init__.py
+++ b/deluge/ui/console/__init__.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.ui.console.console import Console
UI_PATH = __path__[0]
diff --git a/deluge/ui/console/cmdline/command.py b/deluge/ui/console/cmdline/command.py
index 2ff32dff9..0db7b2f47 100644
--- a/deluge/ui/console/cmdline/command.py
+++ b/deluge/ui/console/cmdline/command.py
@@ -9,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import logging
import shlex
diff --git a/deluge/ui/console/cmdline/commands/__init__.py b/deluge/ui/console/cmdline/commands/__init__.py
index 628fae597..aa3f32cd5 100644
--- a/deluge/ui/console/cmdline/commands/__init__.py
+++ b/deluge/ui/console/cmdline/commands/__init__.py
@@ -1,6 +1,4 @@
# -*- coding: utf-8 -*-
-from __future__ import unicode_literals
-
from deluge.ui.console.cmdline.command import BaseCommand
__all__ = ['BaseCommand']
diff --git a/deluge/ui/console/cmdline/commands/add.py b/deluge/ui/console/cmdline/commands/add.py
index da42695b5..b1d08cee3 100644
--- a/deluge/ui/console/cmdline/commands/add.py
+++ b/deluge/ui/console/cmdline/commands/add.py
@@ -8,10 +8,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import os
from base64 import b64encode
+from urllib.parse import urlparse
+from urllib.request import url2pathname
from twisted.internet import defer
@@ -21,14 +21,6 @@ from deluge.ui.client import client
from . import BaseCommand
-try:
- from urllib.parse import urlparse
- from urllib.request import url2pathname
-except ImportError:
- # PY2 fallback
- from urllib import url2pathname # pylint: disable=ungrouped-imports
- from urlparse import urlparse # pylint: disable=ungrouped-imports
-
class Command(BaseCommand):
"""Add torrents"""
diff --git a/deluge/ui/console/cmdline/commands/cache.py b/deluge/ui/console/cmdline/commands/cache.py
index e427f085f..724329b8d 100644
--- a/deluge/ui/console/cmdline/commands/cache.py
+++ b/deluge/ui/console/cmdline/commands/cache.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.ui.client import client
from deluge.ui.common import DISK_CACHE_KEYS
diff --git a/deluge/ui/console/cmdline/commands/config.py b/deluge/ui/console/cmdline/commands/config.py
index 9821e47bc..0b2629633 100644
--- a/deluge/ui/console/cmdline/commands/config.py
+++ b/deluge/ui/console/cmdline/commands/config.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import json
import logging
import re
diff --git a/deluge/ui/console/cmdline/commands/connect.py b/deluge/ui/console/cmdline/commands/connect.py
index 6588f7a04..677b15958 100644
--- a/deluge/ui/console/cmdline/commands/connect.py
+++ b/deluge/ui/console/cmdline/commands/connect.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/cmdline/commands/debug.py b/deluge/ui/console/cmdline/commands/debug.py
index 3ca06ed15..b62c85171 100644
--- a/deluge/ui/console/cmdline/commands/debug.py
+++ b/deluge/ui/console/cmdline/commands/debug.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from twisted.internet import defer
import deluge.component as component
diff --git a/deluge/ui/console/cmdline/commands/gui.py b/deluge/ui/console/cmdline/commands/gui.py
index 10e4c499b..6c750f394 100644
--- a/deluge/ui/console/cmdline/commands/gui.py
+++ b/deluge/ui/console/cmdline/commands/gui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/cmdline/commands/halt.py b/deluge/ui/console/cmdline/commands/halt.py
index 635595898..e68bcec33 100644
--- a/deluge/ui/console/cmdline/commands/halt.py
+++ b/deluge/ui/console/cmdline/commands/halt.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.ui.client import client
diff --git a/deluge/ui/console/cmdline/commands/help.py b/deluge/ui/console/cmdline/commands/help.py
index 2711eea99..42b463b3b 100644
--- a/deluge/ui/console/cmdline/commands/help.py
+++ b/deluge/ui/console/cmdline/commands/help.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from twisted.internet import defer
diff --git a/deluge/ui/console/cmdline/commands/info.py b/deluge/ui/console/cmdline/commands/info.py
index 0d22f76a9..c00583958 100644
--- a/deluge/ui/console/cmdline/commands/info.py
+++ b/deluge/ui/console/cmdline/commands/info.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
from os.path import sep as dirsep
import deluge.component as component
diff --git a/deluge/ui/console/cmdline/commands/manage.py b/deluge/ui/console/cmdline/commands/manage.py
index 6375a74c3..714e3dd55 100644
--- a/deluge/ui/console/cmdline/commands/manage.py
+++ b/deluge/ui/console/cmdline/commands/manage.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from twisted.internet import defer
diff --git a/deluge/ui/console/cmdline/commands/move.py b/deluge/ui/console/cmdline/commands/move.py
index 13e475e6f..40f39508d 100644
--- a/deluge/ui/console/cmdline/commands/move.py
+++ b/deluge/ui/console/cmdline/commands/move.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
diff --git a/deluge/ui/console/cmdline/commands/pause.py b/deluge/ui/console/cmdline/commands/pause.py
index 1f7ef31a0..de11a4c19 100644
--- a/deluge/ui/console/cmdline/commands/pause.py
+++ b/deluge/ui/console/cmdline/commands/pause.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.ui.client import client
diff --git a/deluge/ui/console/cmdline/commands/plugin.py b/deluge/ui/console/cmdline/commands/plugin.py
index 72cecb40f..0dcb8062e 100644
--- a/deluge/ui/console/cmdline/commands/plugin.py
+++ b/deluge/ui/console/cmdline/commands/plugin.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
import deluge.configmanager
from deluge.ui.client import client
diff --git a/deluge/ui/console/cmdline/commands/quit.py b/deluge/ui/console/cmdline/commands/quit.py
index 261a01a9b..5daf77262 100644
--- a/deluge/ui/console/cmdline/commands/quit.py
+++ b/deluge/ui/console/cmdline/commands/quit.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from . import BaseCommand
diff --git a/deluge/ui/console/cmdline/commands/recheck.py b/deluge/ui/console/cmdline/commands/recheck.py
index c9b6360c9..7012c92bf 100644
--- a/deluge/ui/console/cmdline/commands/recheck.py
+++ b/deluge/ui/console/cmdline/commands/recheck.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.ui.client import client
diff --git a/deluge/ui/console/cmdline/commands/resume.py b/deluge/ui/console/cmdline/commands/resume.py
index 1f62c5f00..ed2ae0aa6 100644
--- a/deluge/ui/console/cmdline/commands/resume.py
+++ b/deluge/ui/console/cmdline/commands/resume.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.ui.client import client
diff --git a/deluge/ui/console/cmdline/commands/rm.py b/deluge/ui/console/cmdline/commands/rm.py
index c34148ac9..bf1f9a02a 100644
--- a/deluge/ui/console/cmdline/commands/rm.py
+++ b/deluge/ui/console/cmdline/commands/rm.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/cmdline/commands/status.py b/deluge/ui/console/cmdline/commands/status.py
index 948ad6b94..84cf21e94 100644
--- a/deluge/ui/console/cmdline/commands/status.py
+++ b/deluge/ui/console/cmdline/commands/status.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from twisted.internet import defer
diff --git a/deluge/ui/console/cmdline/commands/update_tracker.py b/deluge/ui/console/cmdline/commands/update_tracker.py
index 591b95192..bee933d2f 100644
--- a/deluge/ui/console/cmdline/commands/update_tracker.py
+++ b/deluge/ui/console/cmdline/commands/update_tracker.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.component as component
from deluge.ui.client import client
diff --git a/deluge/ui/console/console.py b/deluge/ui/console/console.py
index f683c749d..494ead972 100644
--- a/deluge/ui/console/console.py
+++ b/deluge/ui/console/console.py
@@ -7,8 +7,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import fnmatch
import logging
import os
diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py
index c74d9022f..aee61fd32 100644
--- a/deluge/ui/console/main.py
+++ b/deluge/ui/console/main.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import locale
import logging
import os
@@ -753,8 +751,6 @@ class EventLog(component.Component):
if date_different:
string = time.strftime(self.date_change_format)
- if deluge.common.PY2:
- string = string.decode()
self.console.write_event(' ')
self.console.write_event(string)
diff --git a/deluge/ui/console/modes/add_util.py b/deluge/ui/console/modes/add_util.py
index ac60b8974..3f7c73428 100644
--- a/deluge/ui/console/modes/add_util.py
+++ b/deluge/ui/console/modes/add_util.py
@@ -9,15 +9,11 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import glob
import logging
import os
from base64 import b64encode
-from six import unichr as chr # noqa: A001 shadowing
-
import deluge.common
from deluge.ui.client import client
from deluge.ui.common import TorrentInfo
diff --git a/deluge/ui/console/modes/addtorrents.py b/deluge/ui/console/modes/addtorrents.py
index 6b2c105d9..6d68e6c42 100644
--- a/deluge/ui/console/modes/addtorrents.py
+++ b/deluge/ui/console/modes/addtorrents.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
from base64 import b64encode
@@ -24,12 +22,6 @@ from deluge.ui.console.utils import format_utils
from deluge.ui.console.widgets.popup import InputPopup, MessagePopup
try:
- from future_builtins import zip
-except ImportError:
- # Ignore on Py3.
- pass
-
-try:
import curses
except ImportError:
pass
diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py
index 5267eae5a..4adf0f2b0 100644
--- a/deluge/ui/console/modes/basemode.py
+++ b/deluge/ui/console/modes/basemode.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import sys
diff --git a/deluge/ui/console/modes/cmdline.py b/deluge/ui/console/modes/cmdline.py
index 2735168db..680bbdc5a 100644
--- a/deluge/ui/console/modes/cmdline.py
+++ b/deluge/ui/console/modes/cmdline.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import re
@@ -17,7 +15,6 @@ from io import open
import deluge.component as component
import deluge.configmanager
-from deluge.common import PY2
from deluge.decorators import overrides
from deluge.ui.console.cmdline.command import Commander
from deluge.ui.console.modes.basemode import BaseMode, move_cursor
@@ -332,10 +329,10 @@ class CmdLine(BaseMode, Commander):
# A key to add to the input string
else:
- if c > 31 and c < 256:
+ if 31 < c < 256:
# Emulate getwch
stroke = chr(c)
- uchar = '' if PY2 else stroke
+ uchar = stroke
while not uchar:
try:
uchar = stroke.decode(self.encoding)
diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py
index a5c596860..755694260 100644
--- a/deluge/ui/console/modes/connectionmanager.py
+++ b/deluge/ui/console/modes/connectionmanager.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/modes/eventview.py b/deluge/ui/console/modes/eventview.py
index cd3308cf9..b2949b71a 100644
--- a/deluge/ui/console/modes/eventview.py
+++ b/deluge/ui/console/modes/eventview.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/modes/preferences/__init__.py b/deluge/ui/console/modes/preferences/__init__.py
index 15d77c4a8..e827d91a3 100644
--- a/deluge/ui/console/modes/preferences/__init__.py
+++ b/deluge/ui/console/modes/preferences/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
from deluge.ui.console.modes.preferences.preferences import Preferences
__all__ = ['Preferences']
diff --git a/deluge/ui/console/modes/preferences/preference_panes.py b/deluge/ui/console/modes/preferences/preference_panes.py
index 8663d8a9c..1aaa66fdc 100644
--- a/deluge/ui/console/modes/preferences/preference_panes.py
+++ b/deluge/ui/console/modes/preferences/preference_panes.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.common import is_ip
diff --git a/deluge/ui/console/modes/preferences/preferences.py b/deluge/ui/console/modes/preferences/preferences.py
index 45a39a621..397ab687a 100644
--- a/deluge/ui/console/modes/preferences/preferences.py
+++ b/deluge/ui/console/modes/preferences/preferences.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from collections import deque
diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py
index 758cac878..bcc22eb35 100644
--- a/deluge/ui/console/modes/torrentdetail.py
+++ b/deluge/ui/console/modes/torrentdetail.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/modes/torrentlist/__init__.py b/deluge/ui/console/modes/torrentlist/__init__.py
index 18c4db377..7b16b9d88 100644
--- a/deluge/ui/console/modes/torrentlist/__init__.py
+++ b/deluge/ui/console/modes/torrentlist/__init__.py
@@ -1,6 +1,3 @@
-from __future__ import unicode_literals
-
-
class ACTION(object):
PAUSE = 'pause'
RESUME = 'resume'
diff --git a/deluge/ui/console/modes/torrentlist/add_torrents_popup.py b/deluge/ui/console/modes/torrentlist/add_torrents_popup.py
index b0ac483a0..ae7370883 100644
--- a/deluge/ui/console/modes/torrentlist/add_torrents_popup.py
+++ b/deluge/ui/console/modes/torrentlist/add_torrents_popup.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.common
diff --git a/deluge/ui/console/modes/torrentlist/filtersidebar.py b/deluge/ui/console/modes/torrentlist/filtersidebar.py
index 0f39b5c3c..114365e04 100644
--- a/deluge/ui/console/modes/torrentlist/filtersidebar.py
+++ b/deluge/ui/console/modes/torrentlist/filtersidebar.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import curses
import logging
diff --git a/deluge/ui/console/modes/torrentlist/queue_mode.py b/deluge/ui/console/modes/torrentlist/queue_mode.py
index 0c44aafdf..f101cea69 100644
--- a/deluge/ui/console/modes/torrentlist/queue_mode.py
+++ b/deluge/ui/console/modes/torrentlist/queue_mode.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.ui.client import client
from deluge.ui.console.utils import curses_util as util
from deluge.ui.console.widgets.popup import MessagePopup, SelectablePopup
diff --git a/deluge/ui/console/modes/torrentlist/search_mode.py b/deluge/ui/console/modes/torrentlist/search_mode.py
index 57a8e5f64..ffe75ee4c 100644
--- a/deluge/ui/console/modes/torrentlist/search_mode.py
+++ b/deluge/ui/console/modes/torrentlist/search_mode.py
@@ -7,11 +7,8 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
-from deluge.common import PY2
from deluge.decorators import overrides
from deluge.ui.console.modes.basemode import InputKeyHandler, move_cursor
from deluge.ui.console.modes.torrentlist.torrentactions import torrent_actions_popup
@@ -176,7 +173,7 @@ class SearchMode(InputKeyHandler):
elif c > 31 and c < 256:
old_search_string = self.search_string
stroke = chr(c)
- uchar = '' if PY2 else stroke
+ uchar = stroke
while not uchar:
try:
uchar = stroke.decode(self.torrentlist.encoding)
diff --git a/deluge/ui/console/modes/torrentlist/torrentactions.py b/deluge/ui/console/modes/torrentlist/torrentactions.py
index f3cd39509..9ec397538 100644
--- a/deluge/ui/console/modes/torrentlist/torrentactions.py
+++ b/deluge/ui/console/modes/torrentlist/torrentactions.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
diff --git a/deluge/ui/console/modes/torrentlist/torrentlist.py b/deluge/ui/console/modes/torrentlist/torrentlist.py
index a427d65b0..522986c89 100644
--- a/deluge/ui/console/modes/torrentlist/torrentlist.py
+++ b/deluge/ui/console/modes/torrentlist/torrentlist.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from collections import deque
diff --git a/deluge/ui/console/modes/torrentlist/torrentview.py b/deluge/ui/console/modes/torrentlist/torrentview.py
index 67de3e786..2668d3aaa 100644
--- a/deluge/ui/console/modes/torrentlist/torrentview.py
+++ b/deluge/ui/console/modes/torrentlist/torrentview.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py b/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py
index 9dff84306..86494cbf4 100644
--- a/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py
+++ b/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.decorators import overrides
from deluge.ui.console.utils import curses_util as util
from deluge.ui.console.utils.column import torrent_data_fields
diff --git a/deluge/ui/console/parser.py b/deluge/ui/console/parser.py
index 917773aef..b39f2a878 100644
--- a/deluge/ui/console/parser.py
+++ b/deluge/ui/console/parser.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import argparse
import shlex
diff --git a/deluge/ui/console/utils/colors.py b/deluge/ui/console/utils/colors.py
index 587c1f3f6..5c35a8327 100644
--- a/deluge/ui/console/utils/colors.py
+++ b/deluge/ui/console/utils/colors.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import re
diff --git a/deluge/ui/console/utils/column.py b/deluge/ui/console/utils/column.py
index d93215957..f59a549d9 100644
--- a/deluge/ui/console/utils/column.py
+++ b/deluge/ui/console/utils/column.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import copy
import logging
diff --git a/deluge/ui/console/utils/common.py b/deluge/ui/console/utils/common.py
index df1c07917..b0dbe0ec4 100644
--- a/deluge/ui/console/utils/common.py
+++ b/deluge/ui/console/utils/common.py
@@ -5,8 +5,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
TORRENT_OPTIONS = {
'max_download_speed': float,
'max_upload_speed': float,
diff --git a/deluge/ui/console/utils/curses_util.py b/deluge/ui/console/utils/curses_util.py
index a0cd6dc4b..0d94d0c51 100644
--- a/deluge/ui/console/utils/curses_util.py
+++ b/deluge/ui/console/utils/curses_util.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
try:
import curses
except ImportError:
diff --git a/deluge/ui/console/utils/format_utils.py b/deluge/ui/console/utils/format_utils.py
index 029fb2011..441d06dea 100644
--- a/deluge/ui/console/utils/format_utils.py
+++ b/deluge/ui/console/utils/format_utils.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import re
from collections import deque
from unicodedata import east_asian_width, normalize
diff --git a/deluge/ui/console/widgets/__init__.py b/deluge/ui/console/widgets/__init__.py
index a11e3f2b8..bc88a3b6b 100644
--- a/deluge/ui/console/widgets/__init__.py
+++ b/deluge/ui/console/widgets/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
from deluge.ui.console.widgets.inputpane import BaseInputPane
from deluge.ui.console.widgets.statusbars import StatusBars
from deluge.ui.console.widgets.window import BaseWindow
diff --git a/deluge/ui/console/widgets/fields.py b/deluge/ui/console/widgets/fields.py
index 021cab738..86a06109e 100644
--- a/deluge/ui/console/widgets/fields.py
+++ b/deluge/ui/console/widgets/fields.py
@@ -9,12 +9,9 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
-from deluge.common import PY2
from deluge.decorators import overrides
from deluge.ui.console.modes.basemode import InputKeyHandler
from deluge.ui.console.utils import colors
@@ -951,7 +948,7 @@ class TextInput(InputField):
elif c > 31 and c < 256:
# Emulate getwch
stroke = chr(c)
- uchar = '' if PY2 else stroke
+ uchar = stroke
while not uchar:
try:
uchar = stroke.decode(self.parent.encoding)
diff --git a/deluge/ui/console/widgets/inputpane.py b/deluge/ui/console/widgets/inputpane.py
index 097a6cb8d..d79d63df0 100644
--- a/deluge/ui/console/widgets/inputpane.py
+++ b/deluge/ui/console/widgets/inputpane.py
@@ -9,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.decorators import overrides
diff --git a/deluge/ui/console/widgets/popup.py b/deluge/ui/console/widgets/popup.py
index d588bbb24..d73dd1a23 100644
--- a/deluge/ui/console/widgets/popup.py
+++ b/deluge/ui/console/widgets/popup.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.decorators import overrides
diff --git a/deluge/ui/console/widgets/sidebar.py b/deluge/ui/console/widgets/sidebar.py
index cc237174d..73f350a7f 100644
--- a/deluge/ui/console/widgets/sidebar.py
+++ b/deluge/ui/console/widgets/sidebar.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import curses
import logging
diff --git a/deluge/ui/console/widgets/statusbars.py b/deluge/ui/console/widgets/statusbars.py
index 44cc15818..f9bd8ba52 100644
--- a/deluge/ui/console/widgets/statusbars.py
+++ b/deluge/ui/console/widgets/statusbars.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import deluge.common
import deluge.component as component
from deluge.ui.client import client
diff --git a/deluge/ui/console/widgets/window.py b/deluge/ui/console/widgets/window.py
index 2ef35281e..1b68346ea 100644
--- a/deluge/ui/console/widgets/window.py
+++ b/deluge/ui/console/widgets/window.py
@@ -9,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from deluge.ui.console.modes.basemode import add_string, mkpad, mkpanel
diff --git a/deluge/ui/coreconfig.py b/deluge/ui/coreconfig.py
index ed6b614a2..f5483e562 100644
--- a/deluge/ui/coreconfig.py
+++ b/deluge/ui/coreconfig.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/countries.py b/deluge/ui/countries.py
index af390853e..b21c8b911 100644
--- a/deluge/ui/countries.py
+++ b/deluge/ui/countries.py
@@ -3,8 +3,6 @@
# This file is public domain.
#
-from __future__ import unicode_literals
-
# ISO 3166-1 country names and codes
COUNTRIES = {
'AF': _('Afghanistan'),
diff --git a/deluge/ui/gtk3/__init__.py b/deluge/ui/gtk3/__init__.py
index 8e8b19613..82bcea1d4 100644
--- a/deluge/ui/gtk3/__init__.py
+++ b/deluge/ui/gtk3/__init__.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from os import environ
diff --git a/deluge/ui/gtk3/aboutdialog.py b/deluge/ui/gtk3/aboutdialog.py
index 9974a13de..2165cbc28 100644
--- a/deluge/ui/gtk3/aboutdialog.py
+++ b/deluge/ui/gtk3/aboutdialog.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from gi.repository import Gtk
import deluge.component as component
diff --git a/deluge/ui/gtk3/addtorrentdialog.py b/deluge/ui/gtk3/addtorrentdialog.py
index 81b8dbaf3..f4df0d29e 100644
--- a/deluge/ui/gtk3/addtorrentdialog.py
+++ b/deluge/ui/gtk3/addtorrentdialog.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import os
from base64 import b64encode
diff --git a/deluge/ui/gtk3/common.py b/deluge/ui/gtk3/common.py
index e7b46c8d5..455a4da2e 100644
--- a/deluge/ui/gtk3/common.py
+++ b/deluge/ui/gtk3/common.py
@@ -7,15 +7,13 @@
# See LICENSE for more details.
#
"""Common functions for various parts of gtkui to use."""
-from __future__ import unicode_literals
-
import contextlib
import logging
import os
+import pickle
import shutil
import sys
-import six.moves.cPickle as pickle # noqa: N813
from gi.repository.Gdk import SELECTION_CLIPBOARD, SELECTION_PRIMARY, Display
from gi.repository.GdkPixbuf import Colorspace, Pixbuf
from gi.repository.GLib import GError
@@ -29,7 +27,7 @@ from gi.repository.Gtk import (
SortType,
)
-from deluge.common import PY2, get_pixmap, is_ip, osx_check, windows_check
+from deluge.common import get_pixmap, is_ip, osx_check, windows_check
log = logging.getLogger(__name__)
@@ -232,10 +230,7 @@ def associate_magnet_links(overwrite=False):
"""
if windows_check():
- try:
- import winreg
- except ImportError:
- import _winreg as winreg # For Python 2.
+ import winreg
try:
hkey = winreg.OpenKey(winreg.HKEY_CLASSES_ROOT, 'Magnet')
@@ -356,10 +351,7 @@ def load_pickled_state_file(filename):
log.info('Opening %s for load: %s', filename, _filepath)
try:
with open(_filepath, 'rb') as _file:
- if PY2:
- state = pickle.load(_file)
- else:
- state = pickle.load(_file, encoding='utf8')
+ state = pickle.load(_file, encoding='utf8')
except (IOError, pickle.UnpicklingError) as ex:
log.warning('Unable to load %s: %s', _filepath, ex)
else:
diff --git a/deluge/ui/gtk3/connectionmanager.py b/deluge/ui/gtk3/connectionmanager.py
index d5883c4b3..89718e0e0 100644
--- a/deluge/ui/gtk3/connectionmanager.py
+++ b/deluge/ui/gtk3/connectionmanager.py
@@ -7,11 +7,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
from socket import gaierror, gethostbyname
+from urllib.parse import urlparse
from gi.repository import Gtk
from twisted.internet import defer, reactor
@@ -26,12 +25,6 @@ from deluge.ui.hostlist import DEFAULT_PORT, LOCALHOST, HostList
from .common import get_clipboard_text
from .dialogs import AuthenticationDialog, ErrorDialog
-try:
- from urllib.parse import urlparse
-except ImportError:
- # PY2 fallback
- from urlparse import urlparse # pylint: disable=ungrouped-imports
-
log = logging.getLogger(__name__)
HOSTLIST_COL_ID = 0
diff --git a/deluge/ui/gtk3/createtorrentdialog.py b/deluge/ui/gtk3/createtorrentdialog.py
index 1e5e73cb6..4108f629a 100644
--- a/deluge/ui/gtk3/createtorrentdialog.py
+++ b/deluge/ui/gtk3/createtorrentdialog.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import os.path
from base64 import b64encode
diff --git a/deluge/ui/gtk3/details_tab.py b/deluge/ui/gtk3/details_tab.py
index 2431e0836..2dde17aa6 100644
--- a/deluge/ui/gtk3/details_tab.py
+++ b/deluge/ui/gtk3/details_tab.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from xml.sax.saxutils import escape as xml_escape
diff --git a/deluge/ui/gtk3/dialogs.py b/deluge/ui/gtk3/dialogs.py
index 4a2a60a7e..5bb332b03 100644
--- a/deluge/ui/gtk3/dialogs.py
+++ b/deluge/ui/gtk3/dialogs.py
@@ -9,8 +9,6 @@
# pylint: disable=super-on-old-class
-from __future__ import unicode_literals
-
from gi.repository import Gtk
from twisted.internet import defer
diff --git a/deluge/ui/gtk3/edittrackersdialog.py b/deluge/ui/gtk3/edittrackersdialog.py
index a21a7d71f..5e4b0e5e6 100644
--- a/deluge/ui/gtk3/edittrackersdialog.py
+++ b/deluge/ui/gtk3/edittrackersdialog.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
diff --git a/deluge/ui/gtk3/files_tab.py b/deluge/ui/gtk3/files_tab.py
index 50f8a4587..61e0b9089 100644
--- a/deluge/ui/gtk3/files_tab.py
+++ b/deluge/ui/gtk3/files_tab.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import json
import logging
import os.path
diff --git a/deluge/ui/gtk3/filtertreeview.py b/deluge/ui/gtk3/filtertreeview.py
index 4272ef018..5b9c1e2fb 100644
--- a/deluge/ui/gtk3/filtertreeview.py
+++ b/deluge/ui/gtk3/filtertreeview.py
@@ -9,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import warnings
diff --git a/deluge/ui/gtk3/gtkui.py b/deluge/ui/gtk3/gtkui.py
index 02b309078..6c4972ba7 100644
--- a/deluge/ui/gtk3/gtkui.py
+++ b/deluge/ui/gtk3/gtkui.py
@@ -8,8 +8,6 @@
#
# pylint: disable=wrong-import-position
-from __future__ import division, unicode_literals
-
import logging
import os
import signal
diff --git a/deluge/ui/gtk3/ipcinterface.py b/deluge/ui/gtk3/ipcinterface.py
index 78858c443..ac176479d 100644
--- a/deluge/ui/gtk3/ipcinterface.py
+++ b/deluge/ui/gtk3/ipcinterface.py
@@ -7,14 +7,14 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import sys
from base64 import b64encode
from glob import glob
from tempfile import mkstemp
+from urllib.parse import urlparse
+from urllib.request import url2pathname
import rencode
import twisted.internet.error
@@ -26,14 +26,6 @@ from deluge.common import decode_bytes, is_magnet, is_url, windows_check
from deluge.configmanager import ConfigManager, get_config_dir
from deluge.ui.client import client
-try:
- from urllib.parse import urlparse
- from urllib.request import url2pathname
-except ImportError:
- # PY2 fallback
- from urllib import url2pathname # pylint: disable=ungrouped-imports
- from urlparse import urlparse # pylint: disable=ungrouped-imports
-
log = logging.getLogger(__name__)
diff --git a/deluge/ui/gtk3/listview.py b/deluge/ui/gtk3/listview.py
index 4e9fe5db8..d828e5d86 100644
--- a/deluge/ui/gtk3/listview.py
+++ b/deluge/ui/gtk3/listview.py
@@ -7,13 +7,11 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository import GObject, Gtk
-from deluge.common import PY2, decode_bytes
+from deluge.common import decode_bytes
from .common import cmp, load_pickled_state_file, save_pickled_state_file
@@ -75,9 +73,7 @@ class ListView(object):
"""
__gsignals__ = {
- 'button-press-event'
- if not PY2
- else b'button-press-event': (GObject.SIGNAL_RUN_LAST, None, (object,))
+ 'button-press-event': (GObject.SIGNAL_RUN_LAST, None, (object,))
}
def __init__(self, title=None, cell_renderer=None, **args):
diff --git a/deluge/ui/gtk3/mainwindow.py b/deluge/ui/gtk3/mainwindow.py
index b7d751410..43a419cb4 100644
--- a/deluge/ui/gtk3/mainwindow.py
+++ b/deluge/ui/gtk3/mainwindow.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
from hashlib import sha1 as sha
diff --git a/deluge/ui/gtk3/menubar.py b/deluge/ui/gtk3/menubar.py
index e09f394fc..77b1d3a10 100644
--- a/deluge/ui/gtk3/menubar.py
+++ b/deluge/ui/gtk3/menubar.py
@@ -9,8 +9,6 @@
#
-from __future__ import unicode_literals
-
import logging
import os.path
diff --git a/deluge/ui/gtk3/menubar_osx.py b/deluge/ui/gtk3/menubar_osx.py
index 1df6fab08..096c5ffd4 100644
--- a/deluge/ui/gtk3/menubar_osx.py
+++ b/deluge/ui/gtk3/menubar_osx.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from gi.repository.Gdk import ModifierType
from gi.repository.Gtk import SeparatorMenuItem, accel_groups_from_object
from gi.repository.Gtk.AccelFlags import VISIBLE
diff --git a/deluge/ui/gtk3/new_release_dialog.py b/deluge/ui/gtk3/new_release_dialog.py
index 6aa328260..a36b6f26d 100644
--- a/deluge/ui/gtk3/new_release_dialog.py
+++ b/deluge/ui/gtk3/new_release_dialog.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from gi.repository.Gtk import IconSize
import deluge.common
diff --git a/deluge/ui/gtk3/options_tab.py b/deluge/ui/gtk3/options_tab.py
index 6a25fd1e8..e592ad53e 100644
--- a/deluge/ui/gtk3/options_tab.py
+++ b/deluge/ui/gtk3/options_tab.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from gi.repository.Gdk import keyval_name
import deluge.component as component
diff --git a/deluge/ui/gtk3/path_chooser.py b/deluge/ui/gtk3/path_chooser.py
index b7228415e..952196916 100644
--- a/deluge/ui/gtk3/path_chooser.py
+++ b/deluge/ui/gtk3/path_chooser.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/gtk3/path_combo_chooser.py b/deluge/ui/gtk3/path_combo_chooser.py
index 72e98e497..755ae5fe1 100755
--- a/deluge/ui/gtk3/path_combo_chooser.py
+++ b/deluge/ui/gtk3/path_combo_chooser.py
@@ -8,15 +8,13 @@
# See LICENSE for more details.
#
-from __future__ import division, print_function, unicode_literals
-
import os
import warnings
from gi.repository import Gdk, GObject, Gtk
from gi.repository.GObject import SignalFlags
-from deluge.common import PY2, resource_filename
+from deluge.common import resource_filename
from deluge.path_chooser_common import get_completion_paths
# Filter the pygobject signal warning:
@@ -1106,9 +1104,7 @@ class PathAutoCompleter(object):
class PathChooserComboBox(Gtk.Box, StoredValuesPopup, GObject.GObject):
__gsignals__ = {
- signal
- if not PY2
- else signal.encode(): (SignalFlags.RUN_FIRST, GObject.TYPE_NONE, (object,))
+ signal: (SignalFlags.RUN_FIRST, GObject.TYPE_NONE, (object,))
for signal in [
'text-changed',
'accelerator-set',
diff --git a/deluge/ui/gtk3/peers_tab.py b/deluge/ui/gtk3/peers_tab.py
index e0282becf..afd4774be 100644
--- a/deluge/ui/gtk3/peers_tab.py
+++ b/deluge/ui/gtk3/peers_tab.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
@@ -42,12 +40,6 @@ from .torrentview_data_funcs import (
cell_data_speed_up,
)
-try:
- from future_builtins import zip
-except ImportError:
- # Ignore on Py3.
- pass
-
log = logging.getLogger(__name__)
diff --git a/deluge/ui/gtk3/piecesbar.py b/deluge/ui/gtk3/piecesbar.py
index 549f9c048..6f0b98052 100644
--- a/deluge/ui/gtk3/piecesbar.py
+++ b/deluge/ui/gtk3/piecesbar.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
from math import pi
import gi # isort:skip (Version check required before import).
@@ -24,7 +22,6 @@ from gi.repository.Gtk import DrawingArea, ProgressBar, StateFlags
from gi.repository.Pango import SCALE, Weight
# isort:imports-firstparty
-from deluge.common import PY2
from deluge.configmanager import ConfigManager
COLOR_STATES = ['missing', 'waiting', 'downloading', 'completed']
@@ -32,7 +29,7 @@ COLOR_STATES = ['missing', 'waiting', 'downloading', 'completed']
class PiecesBar(DrawingArea):
# Draw in response to an draw
- __gsignals__ = {'draw': 'override'} if not PY2 else {b'draw': b'override'}
+ __gsignals__ = {'draw': 'override'}
def __init__(self):
super(PiecesBar, self).__init__()
diff --git a/deluge/ui/gtk3/pluginmanager.py b/deluge/ui/gtk3/pluginmanager.py
index d60f8d390..017798ab9 100644
--- a/deluge/ui/gtk3/pluginmanager.py
+++ b/deluge/ui/gtk3/pluginmanager.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/gtk3/preferences.py b/deluge/ui/gtk3/preferences.py
index 13930fc55..ee6d23dfd 100644
--- a/deluge/ui/gtk3/preferences.py
+++ b/deluge/ui/gtk3/preferences.py
@@ -8,11 +8,10 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
from hashlib import sha1 as sha
+from urllib.parse import urlparse
from gi import require_version
from gi.repository import Gtk
@@ -31,12 +30,6 @@ from .dialogs import AccountDialog, ErrorDialog, InformationDialog, YesNoDialog
from .path_chooser import PathChooser
try:
- from urllib.parse import urlparse
-except ImportError:
- # PY2 fallback
- from urlparse import urlparse # pylint: disable=ungrouped-imports
-
-try:
require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 # noqa: F401
except (ImportError, ValueError):
diff --git a/deluge/ui/gtk3/queuedtorrents.py b/deluge/ui/gtk3/queuedtorrents.py
index 0f08c24c6..f2aa851b8 100644
--- a/deluge/ui/gtk3/queuedtorrents.py
+++ b/deluge/ui/gtk3/queuedtorrents.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os.path
diff --git a/deluge/ui/gtk3/removetorrentdialog.py b/deluge/ui/gtk3/removetorrentdialog.py
index 48806a5d5..cc0cffedc 100644
--- a/deluge/ui/gtk3/removetorrentdialog.py
+++ b/deluge/ui/gtk3/removetorrentdialog.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
diff --git a/deluge/ui/gtk3/sidebar.py b/deluge/ui/gtk3/sidebar.py
index 1d751918f..7cf637761 100644
--- a/deluge/ui/gtk3/sidebar.py
+++ b/deluge/ui/gtk3/sidebar.py
@@ -8,8 +8,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository.Gtk import Label, PolicyType, ScrolledWindow
diff --git a/deluge/ui/gtk3/status_tab.py b/deluge/ui/gtk3/status_tab.py
index 938c2dd7d..c1fe9ccba 100644
--- a/deluge/ui/gtk3/status_tab.py
+++ b/deluge/ui/gtk3/status_tab.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/gtk3/statusbar.py b/deluge/ui/gtk3/statusbar.py
index 18db753fa..fda235eeb 100644
--- a/deluge/ui/gtk3/statusbar.py
+++ b/deluge/ui/gtk3/statusbar.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import logging
from gi.repository import Gtk
diff --git a/deluge/ui/gtk3/systemtray.py b/deluge/ui/gtk3/systemtray.py
index a2435223b..ef497747d 100644
--- a/deluge/ui/gtk3/systemtray.py
+++ b/deluge/ui/gtk3/systemtray.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
diff --git a/deluge/ui/gtk3/tab_data_funcs.py b/deluge/ui/gtk3/tab_data_funcs.py
index 6fa0ba59c..e0fb74587 100644
--- a/deluge/ui/gtk3/tab_data_funcs.py
+++ b/deluge/ui/gtk3/tab_data_funcs.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
from deluge.common import fdate, fsize, fspeed, ftime
from deluge.ui.common import TRACKER_STATUS_TRANSLATION
diff --git a/deluge/ui/gtk3/toolbar.py b/deluge/ui/gtk3/toolbar.py
index 7bc029e4b..600fce738 100644
--- a/deluge/ui/gtk3/toolbar.py
+++ b/deluge/ui/gtk3/toolbar.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from gi.repository.Gtk import SeparatorToolItem, ToolButton
diff --git a/deluge/ui/gtk3/torrentdetails.py b/deluge/ui/gtk3/torrentdetails.py
index a586c2997..888ae5e38 100644
--- a/deluge/ui/gtk3/torrentdetails.py
+++ b/deluge/ui/gtk3/torrentdetails.py
@@ -9,8 +9,6 @@
"""The torrent details component shows info about the selected torrent."""
-from __future__ import unicode_literals
-
import logging
from collections import namedtuple
diff --git a/deluge/ui/gtk3/torrentview.py b/deluge/ui/gtk3/torrentview.py
index 46c0884b1..3bc8bbacd 100644
--- a/deluge/ui/gtk3/torrentview.py
+++ b/deluge/ui/gtk3/torrentview.py
@@ -8,8 +8,6 @@
#
"""The torrent view component that lists all torrents in the session."""
-from __future__ import unicode_literals
-
import logging
from locale import strcoll
diff --git a/deluge/ui/gtk3/torrentview_data_funcs.py b/deluge/ui/gtk3/torrentview_data_funcs.py
index 8bd1f9c51..91d4663bc 100644
--- a/deluge/ui/gtk3/torrentview_data_funcs.py
+++ b/deluge/ui/gtk3/torrentview_data_funcs.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import warnings
from functools import partial
diff --git a/deluge/ui/gtk3/trackers_tab.py b/deluge/ui/gtk3/trackers_tab.py
index d83b9956c..6accf1d67 100644
--- a/deluge/ui/gtk3/trackers_tab.py
+++ b/deluge/ui/gtk3/trackers_tab.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.component as component
diff --git a/deluge/ui/hostlist.py b/deluge/ui/hostlist.py
index b4bb538fb..5d0e68c7a 100644
--- a/deluge/ui/hostlist.py
+++ b/deluge/ui/hostlist.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
import uuid
diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py
index 5af8e79cd..b89d04dfc 100644
--- a/deluge/ui/sessionproxy.py
+++ b/deluge/ui/sessionproxy.py
@@ -6,8 +6,6 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
from time import time
diff --git a/deluge/ui/tracker_icons.py b/deluge/ui/tracker_icons.py
index c10cd2f8e..3f3ca4dbe 100644
--- a/deluge/ui/tracker_icons.py
+++ b/deluge/ui/tracker_icons.py
@@ -7,11 +7,11 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
+from html.parser import HTMLParser
from tempfile import mkstemp
+from urllib.parse import urljoin, urlparse
from twisted.internet import defer, threads
from twisted.web.error import PageRedirect
@@ -23,14 +23,6 @@ from deluge.decorators import proxy
from deluge.httpdownloader import download_file
try:
- from html.parser import HTMLParser
- from urllib.parse import urljoin, urlparse
-except ImportError:
- # PY2 fallback
- from HTMLParser import HTMLParser
- from urlparse import urljoin, urlparse # pylint: disable=ungrouped-imports
-
-try:
from PIL import Image
except ImportError:
Image = None
diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py
index 0986ec777..3c75f2acd 100644
--- a/deluge/ui/ui.py
+++ b/deluge/ui/ui.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import deluge.common
diff --git a/deluge/ui/ui_entry.py b/deluge/ui/ui_entry.py
index 71ce83783..eae56bf6a 100644
--- a/deluge/ui/ui_entry.py
+++ b/deluge/ui/ui_entry.py
@@ -12,8 +12,6 @@
# user runs the command 'deluge'.
"""Main starting point for Deluge"""
-from __future__ import unicode_literals
-
import argparse
import logging
import os
diff --git a/deluge/ui/web/__init__.py b/deluge/ui/web/__init__.py
index 0be7eedb9..3757e0b1c 100644
--- a/deluge/ui/web/__init__.py
+++ b/deluge/ui/web/__init__.py
@@ -1,5 +1,3 @@
-from __future__ import unicode_literals
-
from deluge.ui.web.web import Web
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py
index d631f9186..9c8158a52 100644
--- a/deluge/ui/web/auth.py
+++ b/deluge/ui/web/auth.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import hashlib
import logging
import os
diff --git a/deluge/ui/web/common.py b/deluge/ui/web/common.py
index 475f33565..a8c223d19 100644
--- a/deluge/ui/web/common.py
+++ b/deluge/ui/web/common.py
@@ -7,19 +7,15 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import gettext
from mako.template import Template as MakoTemplate
-from deluge.common import PY2, get_version
+from deluge.common import get_version
def _(text):
text_local = gettext.gettext(text)
- if PY2:
- return text_local.decode('utf-8')
return text_local
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index ffdee342c..822f65483 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import division, unicode_literals
-
import json
import logging
import os
diff --git a/deluge/ui/web/pluginmanager.py b/deluge/ui/web/pluginmanager.py
index 24f20ce94..153d4977a 100644
--- a/deluge/ui/web/pluginmanager.py
+++ b/deluge/ui/web/pluginmanager.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import logging
import os
diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py
index 2f8921b22..3f079aefb 100644
--- a/deluge/ui/web/server.py
+++ b/deluge/ui/web/server.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import unicode_literals
-
import fnmatch
import json
import logging
diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py
index 4d0624791..0cefa13b4 100644
--- a/deluge/ui/web/web.py
+++ b/deluge/ui/web/web.py
@@ -7,8 +7,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import logging
from twisted.internet.error import CannotListenError
diff --git a/docs/source/conf.py b/docs/source/conf.py
index f7db27efd..c04a20452 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -10,11 +10,11 @@
# All configuration values have a default value; values that are commented out
# serve to show the default value.
+import builtins
import os
import sys
from datetime import date
-from six.moves import builtins
from sphinx.ext import apidoc
from sphinx.ext.autodoc import ClassDocumenter, bool_option
diff --git a/docs/source/devguide/how-to/update-1.3-plugin.md b/docs/source/devguide/how-to/update-1.3-plugin.md
index 6374a0c0d..9c086902b 100644
--- a/docs/source/devguide/how-to/update-1.3-plugin.md
+++ b/docs/source/devguide/how-to/update-1.3-plugin.md
@@ -11,7 +11,7 @@ compatible with 2.0 and this guide aims to helps with that process.
### Python version matching
-Ensure your code is both Python 2.7 and Python >=3.5 compatible.
+Ensure your code is Python >=3.5 compatible.
In `1.3-stable` the plugins that were built with a specific version of Python
would only be loaded if the system Python also matched.
@@ -19,19 +19,6 @@ would only be loaded if the system Python also matched.
This has change in Deluge 2.0 and it will load any Python version of plugin
eggs so compatibility is essential for end-users not to encounter issues.
-### Six
-
-Use [six] to assist with compatibility.
-
-[six]: https://pythonhosted.org/six/
-
-### Unicode literals
-
-Add the following to files to ensure strings and bytes separation so there
-are no surprises when running on Python 3.
-
- from __future__ import unicode_literals
-
## GTK 3 addition
In order to support both Deluge 1.3 and 2.0 all existing plugin GTK UI files
diff --git a/gen_web_gettext.py b/gen_web_gettext.py
index fac509736..c299e429f 100755
--- a/gen_web_gettext.py
+++ b/gen_web_gettext.py
@@ -10,8 +10,6 @@
"""Script to parse javascript files for translation strings and generate gettext.js"""
-from __future__ import print_function, unicode_literals
-
import os
import re
diff --git a/generate_pot.py b/generate_pot.py
index f5cad5b62..47d3b9f99 100755
--- a/generate_pot.py
+++ b/generate_pot.py
@@ -11,8 +11,6 @@
"""Parses Python and Javascript code for translation strings to create the 'deluge.pot' template for translators"""
-from __future__ import print_function, unicode_literals
-
import os
import re
from datetime import datetime
diff --git a/minify_web_js.py b/minify_web_js.py
index a5cd97c59..b91a96329 100755
--- a/minify_web_js.py
+++ b/minify_web_js.py
@@ -15,19 +15,12 @@ Usage: python minify_web_js.py deluge/ui/web/js/deluge-all
"""
-from __future__ import print_function, unicode_literals
-
import fileinput
import fnmatch
import os
import subprocess
import sys
-
-try:
- from shutil import which
-except ImportError:
- # PY2 Fallback
- from distutils.spawn import find_executable as which
+from shutil import which
closure_cmd = None
for cmd in ['closure-compiler', 'closure']:
diff --git a/msgfmt.py b/msgfmt.py
index c0e093ab6..4d0b83911 100755
--- a/msgfmt.py
+++ b/msgfmt.py
@@ -25,8 +25,6 @@ Options:
--version
Display version information and exit.
"""
-from __future__ import print_function, unicode_literals
-
import array
import ast
import getopt
@@ -103,10 +101,7 @@ def generate():
0,
0,
) # size and offset of hash table
- if sys.version_info.major == 2:
- output += array.array(b'i', offsets).tostring()
- else:
- output += array.array('i', offsets).tobytes()
+ output += array.array('i', offsets).tobytes()
output += ids.encode('utf8')
output += strs.encode('utf8')
return output
@@ -181,9 +176,6 @@ def make(filename, outfile):
if not line:
continue
line = ast.literal_eval(line)
- # Python 2 ast.literal_eval returns bytes.
- if isinstance(line, bytes):
- line = line.decode('utf8')
if section == section_id:
msgid += line
elif section == section_str:
diff --git a/packaging/source/make_release.py b/packaging/source/make_release.py
index e1cee0036..38fc3d566 100755
--- a/packaging/source/make_release.py
+++ b/packaging/source/make_release.py
@@ -7,18 +7,11 @@
# the additional special exception to link portions of this program with the OpenSSL library.
# See LICENSE for more details.
#
-from __future__ import print_function, unicode_literals
-
import os.path
-import sys
from hashlib import sha256
from subprocess import call, check_output
-PY2 = sys.version_info.major == 2
-
sdist_formats = 'xztar'
-if PY2:
- sdist_formats = 'tar'
version = check_output(['python', 'version.py']).strip().decode()
diff --git a/pyproject.toml b/pyproject.toml
index 2674219a7..67ebe0a0c 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -9,5 +9,3 @@ skip-string-normalization = true
[tool.isort]
profile = "black"
-# Python 2 stdlib
-extra_standard_library = ["urlparse", "HTMLParser", "urllib2"]
diff --git a/requirements.txt b/requirements.txt
index c414829b9..99e646c18 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -5,7 +5,6 @@ pyxdg
pillow
mako
chardet
-six
setproctitle
pywin32; sys_platform == 'win32'
certifi; sys_platform == 'win32'
diff --git a/setup.py b/setup.py
index ef8d38e21..181d74cd8 100755
--- a/setup.py
+++ b/setup.py
@@ -9,8 +9,6 @@
# See LICENSE for more details.
#
-from __future__ import print_function
-
import glob
import os
import platform
@@ -18,7 +16,7 @@ import sys
from distutils.command.build import build as _build
from distutils.command.clean import clean as _clean
from distutils.command.install_data import install_data as _install_data
-from shutil import rmtree
+from shutil import rmtree, which
from setuptools import Command, find_packages, setup
from setuptools.command.test import test as _test
@@ -27,12 +25,6 @@ import msgfmt
from version import get_version
try:
- from shutil import which
-except ImportError:
- # PY2 Fallback
- from distutils.spawn import find_executable as which
-
-try:
from sphinx.setup_command import BuildDoc
except ImportError:
@@ -548,7 +540,6 @@ install_requires = [
'pyopenssl',
'pyxdg',
'mako',
- 'six',
'setuptools',
"pywin32; sys_platform == 'win32'",
"certifi; sys_platform == 'win32'",
@@ -599,7 +590,7 @@ setup(
'Operating System :: POSIX',
'Topic :: Internet',
],
- python_requires='>=2.7',
+ python_requires='>=3.5',
license='GPLv3+',
cmdclass=cmdclass,
setup_requires=setup_requires,
diff --git a/tox.ini b/tox.ini
index 5b9152978..8f6810cd8 100644
--- a/tox.ini
+++ b/tox.ini
@@ -4,7 +4,7 @@
# Usage: `pip install tox` and then run `tox` from this directory.
[tox]
-envlist = py27, py3, lint, docs
+envlist = py3, lint, docs
minversion=3.0
[pytest]
diff --git a/version.py b/version.py
index ff8f684d5..28d071093 100755
--- a/version.py
+++ b/version.py
@@ -31,8 +31,6 @@
# include RELEASE-VERSION
#
-from __future__ import print_function, unicode_literals
-
import os
import subprocess