From 84802da29b71679547ba245ea3d870512dba3b49 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Sun, 12 Feb 2017 11:26:31 +0000 Subject: [PATCH] [Py2to3] Force unicode_literals and fix related issues * Added `from __future__ import unicode_literals` to every file so now all strings in code are forced to be unicode strings unless marked as byte string `b'str'` or encoded to byte string `'str'.encode('utf-8')`. This is a large change but we have been working towards the goal of unicode strings passed in the code so decoding external input and encoding output as byte strings (where applicable). Note that in Python 2 the `str` type still refers to byte strings. * Replaced the use of `str` for `basestring` in isinstance comparison as this was the original intention but breaks code when encoutering unicode strings. * Marked byte strings in gtkui as the conversion to utf8 is not always handled, mostly related to gobject signal names. --- deluge/__init__.py | 2 ++ deluge/__rpcapi.py | 2 ++ deluge/_libtorrent.py | 1 + deluge/common.py | 7 ++--- deluge/component.py | 10 ++++--- deluge/config.py | 10 +++---- deluge/configmanager.py | 2 ++ deluge/core/alertmanager.py | 1 + deluge/core/authmanager.py | 2 ++ deluge/core/core.py | 2 +- deluge/core/daemon.py | 1 + deluge/core/daemon_entry.py | 2 +- deluge/core/eventmanager.py | 2 ++ deluge/core/filtermanager.py | 2 ++ deluge/core/pluginmanager.py | 1 + deluge/core/preferencesmanager.py | 2 ++ deluge/core/rpcserver.py | 1 + deluge/core/torrent.py | 2 +- deluge/core/torrentmanager.py | 1 + deluge/decorators.py | 2 ++ deluge/error.py | 3 +++ deluge/event.py | 1 + deluge/httpdownloader.py | 2 ++ deluge/log.py | 1 + deluge/maketorrent.py | 2 +- deluge/metafile.py | 2 +- deluge/path_chooser_common.py | 2 ++ deluge/pluginmanagerbase.py | 1 + deluge/plugins/AutoAdd/deluge/__init__.py | 2 ++ .../AutoAdd/deluge/plugins/__init__.py | 2 ++ .../deluge/plugins/autoadd/__init__.py | 2 ++ .../AutoAdd/deluge/plugins/autoadd/common.py | 2 ++ .../AutoAdd/deluge/plugins/autoadd/core.py | 2 ++ .../AutoAdd/deluge/plugins/autoadd/gtkui.py | 2 ++ .../AutoAdd/deluge/plugins/autoadd/webui.py | 2 ++ deluge/plugins/AutoAdd/setup.py | 2 ++ deluge/plugins/Blocklist/deluge/__init__.py | 2 ++ .../Blocklist/deluge/plugins/__init__.py | 2 ++ .../deluge/plugins/blocklist/__init__.py | 2 ++ .../deluge/plugins/blocklist/common.py | 2 ++ .../deluge/plugins/blocklist/core.py | 2 +- .../deluge/plugins/blocklist/decompressers.py | 2 ++ .../deluge/plugins/blocklist/detect.py | 2 ++ .../deluge/plugins/blocklist/gtkui.py | 2 ++ .../deluge/plugins/blocklist/peerguardian.py | 2 ++ .../deluge/plugins/blocklist/readers.py | 2 ++ .../deluge/plugins/blocklist/webui.py | 2 ++ deluge/plugins/Blocklist/setup.py | 2 ++ deluge/plugins/Execute/deluge/__init__.py | 2 ++ .../Execute/deluge/plugins/__init__.py | 2 ++ .../deluge/plugins/execute/__init__.py | 2 ++ .../Execute/deluge/plugins/execute/common.py | 2 ++ .../Execute/deluge/plugins/execute/core.py | 2 ++ .../Execute/deluge/plugins/execute/gtkui.py | 2 ++ .../Execute/deluge/plugins/execute/webui.py | 2 ++ deluge/plugins/Execute/setup.py | 2 ++ deluge/plugins/Extractor/deluge/__init__.py | 2 ++ .../Extractor/deluge/plugins/__init__.py | 2 ++ .../deluge/plugins/extractor/__init__.py | 2 ++ .../deluge/plugins/extractor/common.py | 2 ++ .../deluge/plugins/extractor/core.py | 2 ++ .../deluge/plugins/extractor/gtkui.py | 2 ++ .../deluge/plugins/extractor/webui.py | 2 ++ deluge/plugins/Extractor/setup.py | 2 ++ deluge/plugins/Label/deluge/__init__.py | 2 ++ .../plugins/Label/deluge/plugins/__init__.py | 2 ++ .../Label/deluge/plugins/label/__init__.py | 2 ++ .../Label/deluge/plugins/label/core.py | 1 + .../deluge/plugins/label/gtkui/__init__.py | 2 ++ .../plugins/label/gtkui/label_config.py | 2 ++ .../plugins/label/gtkui/sidebar_menu.py | 2 ++ .../deluge/plugins/label/gtkui/submenu.py | 2 ++ .../Label/deluge/plugins/label/test.py | 2 +- .../Label/deluge/plugins/label/webui.py | 2 ++ deluge/plugins/Label/setup.py | 2 ++ .../plugins/Notifications/deluge/__init__.py | 2 ++ .../Notifications/deluge/plugins/__init__.py | 2 ++ .../deluge/plugins/notifications/__init__.py | 2 ++ .../deluge/plugins/notifications/common.py | 2 ++ .../deluge/plugins/notifications/core.py | 2 ++ .../deluge/plugins/notifications/gtkui.py | 2 ++ .../deluge/plugins/notifications/test.py | 2 ++ .../deluge/plugins/notifications/webui.py | 2 ++ deluge/plugins/Notifications/setup.py | 2 ++ deluge/plugins/Scheduler/deluge/__init__.py | 2 ++ .../Scheduler/deluge/plugins/__init__.py | 2 ++ .../deluge/plugins/scheduler/__init__.py | 2 ++ .../deluge/plugins/scheduler/common.py | 3 +++ .../deluge/plugins/scheduler/core.py | 2 ++ .../deluge/plugins/scheduler/gtkui.py | 2 +- .../deluge/plugins/scheduler/webui.py | 2 +- deluge/plugins/Scheduler/setup.py | 2 ++ deluge/plugins/Stats/deluge/__init__.py | 2 ++ .../plugins/Stats/deluge/plugins/__init__.py | 2 ++ .../Stats/deluge/plugins/stats/__init__.py | 2 ++ .../Stats/deluge/plugins/stats/common.py | 2 ++ .../Stats/deluge/plugins/stats/core.py | 3 +-- .../Stats/deluge/plugins/stats/graph.py | 3 +-- .../Stats/deluge/plugins/stats/gtkui.py | 2 +- .../deluge/plugins/stats/tests/test_stats.py | 2 +- .../Stats/deluge/plugins/stats/webui.py | 2 ++ deluge/plugins/Stats/setup.py | 2 ++ deluge/plugins/Toggle/deluge/__init__.py | 2 ++ .../plugins/Toggle/deluge/plugins/__init__.py | 2 ++ .../Toggle/deluge/plugins/toggle/__init__.py | 2 ++ .../Toggle/deluge/plugins/toggle/common.py | 3 +++ .../Toggle/deluge/plugins/toggle/core.py | 2 ++ .../Toggle/deluge/plugins/toggle/gtkui.py | 2 ++ .../Toggle/deluge/plugins/toggle/webui.py | 2 ++ deluge/plugins/Toggle/setup.py | 2 ++ deluge/plugins/WebUi/deluge/__init__.py | 2 ++ .../plugins/WebUi/deluge/plugins/__init__.py | 2 ++ .../WebUi/deluge/plugins/webui/__init__.py | 2 ++ .../WebUi/deluge/plugins/webui/common.py | 3 +++ .../WebUi/deluge/plugins/webui/core.py | 2 ++ .../WebUi/deluge/plugins/webui/gtkui.py | 2 ++ .../plugins/webui/tests/test_plugin_webui.py | 2 ++ deluge/plugins/WebUi/setup.py | 2 ++ deluge/plugins/__init__.py | 2 ++ deluge/plugins/init.py | 2 ++ deluge/plugins/pluginbase.py | 2 ++ deluge/scripts/create_plugin.py | 2 +- deluge/scripts/deluge_remote.py | 2 ++ deluge/tests/__init__.py | 2 +- deluge/tests/basetest.py | 2 ++ deluge/tests/common.py | 2 +- deluge/tests/common_web.py | 2 ++ deluge/tests/daemon_base.py | 2 +- deluge/tests/test_alertmanager.py | 2 ++ deluge/tests/test_authmanager.py | 2 ++ deluge/tests/test_client.py | 2 ++ deluge/tests/test_common.py | 2 ++ deluge/tests/test_component.py | 2 ++ deluge/tests/test_config.py | 10 ++++--- deluge/tests/test_core.py | 2 ++ deluge/tests/test_decorators.py | 2 ++ deluge/tests/test_error.py | 2 ++ deluge/tests/test_files_tab.py | 22 ++++++++-------- deluge/tests/test_httpdownloader.py | 2 ++ deluge/tests/test_json_api.py | 2 ++ deluge/tests/test_log.py | 2 ++ deluge/tests/test_maketorrent.py | 2 ++ deluge/tests/test_plugin_metadata.py | 2 ++ deluge/tests/test_rpcserver.py | 2 ++ deluge/tests/test_sessionproxy.py | 2 ++ deluge/tests/test_torrent.py | 2 +- deluge/tests/test_torrentmanager.py | 2 ++ deluge/tests/test_torrentview.py | 18 +++++++------ deluge/tests/test_tracker_icons.py | 2 ++ deluge/tests/test_transfer.py | 6 ++--- deluge/tests/test_ui_common.py | 2 ++ deluge/tests/test_ui_console_fields.py | 2 ++ deluge/tests/test_ui_entry.py | 2 +- deluge/tests/test_web_api.py | 10 ++++--- deluge/tests/test_webserver.py | 2 ++ .../tests/twisted/plugins/delugereporter.py | 2 ++ deluge/transfer.py | 10 ++++--- deluge/ui/Win32IconImagePlugin.py | 2 +- deluge/ui/baseargparser.py | 2 ++ deluge/ui/client.py | 2 ++ deluge/ui/common.py | 1 + deluge/ui/console/__init__.py | 2 ++ deluge/ui/console/cmdline/command.py | 2 +- .../ui/console/cmdline/commands/__init__.py | 2 ++ deluge/ui/console/cmdline/commands/add.py | 2 ++ deluge/ui/console/cmdline/commands/cache.py | 2 ++ deluge/ui/console/cmdline/commands/config.py | 2 ++ deluge/ui/console/cmdline/commands/connect.py | 2 ++ deluge/ui/console/cmdline/commands/debug.py | 2 ++ deluge/ui/console/cmdline/commands/gui.py | 2 ++ deluge/ui/console/cmdline/commands/halt.py | 2 ++ deluge/ui/console/cmdline/commands/help.py | 2 ++ deluge/ui/console/cmdline/commands/info.py | 2 +- deluge/ui/console/cmdline/commands/manage.py | 2 ++ deluge/ui/console/cmdline/commands/move.py | 2 ++ deluge/ui/console/cmdline/commands/pause.py | 2 ++ deluge/ui/console/cmdline/commands/plugin.py | 2 ++ deluge/ui/console/cmdline/commands/quit.py | 2 ++ deluge/ui/console/cmdline/commands/recheck.py | 2 ++ deluge/ui/console/cmdline/commands/resume.py | 2 ++ deluge/ui/console/cmdline/commands/rm.py | 2 ++ deluge/ui/console/cmdline/commands/status.py | 2 ++ .../cmdline/commands/update_tracker.py | 2 ++ deluge/ui/console/console.py | 2 +- deluge/ui/console/main.py | 2 +- deluge/ui/console/modes/add_util.py | 2 ++ deluge/ui/console/modes/addtorrents.py | 2 ++ deluge/ui/console/modes/basemode.py | 2 ++ deluge/ui/console/modes/cmdline.py | 21 +++++++-------- deluge/ui/console/modes/connectionmanager.py | 2 ++ deluge/ui/console/modes/eventview.py | 2 ++ .../ui/console/modes/preferences/__init__.py | 2 ++ .../modes/preferences/preference_panes.py | 2 ++ .../console/modes/preferences/preferences.py | 2 ++ deluge/ui/console/modes/torrentdetail.py | 2 +- .../ui/console/modes/torrentlist/__init__.py | 2 ++ .../modes/torrentlist/add_torrents_popup.py | 2 ++ .../modes/torrentlist/filtersidebar.py | 2 ++ .../console/modes/torrentlist/queue_mode.py | 12 ++++----- .../console/modes/torrentlist/search_mode.py | 14 +++++----- .../modes/torrentlist/torrentactions.py | 2 ++ .../console/modes/torrentlist/torrentlist.py | 2 ++ .../console/modes/torrentlist/torrentview.py | 3 ++- .../modes/torrentlist/torrentviewcolumns.py | 2 ++ deluge/ui/console/parser.py | 2 +- deluge/ui/console/utils/colors.py | 2 ++ deluge/ui/console/utils/column.py | 2 ++ deluge/ui/console/utils/curses_util.py | 2 ++ deluge/ui/console/utils/format_utils.py | 8 +++--- deluge/ui/console/widgets/__init__.py | 2 ++ deluge/ui/console/widgets/fields.py | 10 ++++--- deluge/ui/console/widgets/inputpane.py | 10 ++++--- deluge/ui/console/widgets/popup.py | 10 ++++--- deluge/ui/console/widgets/sidebar.py | 2 ++ deluge/ui/console/widgets/statusbars.py | 2 ++ deluge/ui/console/widgets/window.py | 10 ++++--- deluge/ui/coreconfig.py | 2 ++ deluge/ui/countries.py | 2 ++ deluge/ui/gtkui/__init__.py | 2 ++ deluge/ui/gtkui/aboutdialog.py | 2 ++ deluge/ui/gtkui/addtorrentdialog.py | 6 ++--- deluge/ui/gtkui/common.py | 1 + deluge/ui/gtkui/connectionmanager.py | 2 ++ deluge/ui/gtkui/createtorrentdialog.py | 2 +- deluge/ui/gtkui/details_tab.py | 2 ++ deluge/ui/gtkui/dialogs.py | 2 ++ deluge/ui/gtkui/edittrackersdialog.py | 2 ++ deluge/ui/gtkui/files_tab.py | 4 +-- deluge/ui/gtkui/filtertreeview.py | 2 ++ deluge/ui/gtkui/gtkui.py | 4 +-- deluge/ui/gtkui/ipcinterface.py | 2 ++ deluge/ui/gtkui/listview.py | 2 ++ deluge/ui/gtkui/mainwindow.py | 2 ++ deluge/ui/gtkui/menubar.py | 2 ++ deluge/ui/gtkui/menubar_osx.py | 2 ++ deluge/ui/gtkui/new_release_dialog.py | 2 ++ deluge/ui/gtkui/options_tab.py | 2 ++ deluge/ui/gtkui/path_chooser.py | 2 ++ deluge/ui/gtkui/path_combo_chooser.py | 26 +++++++++---------- deluge/ui/gtkui/peers_tab.py | 2 ++ deluge/ui/gtkui/piecesbar.py | 4 +-- deluge/ui/gtkui/pluginmanager.py | 2 ++ deluge/ui/gtkui/preferences.py | 8 +++--- deluge/ui/gtkui/queuedtorrents.py | 2 ++ deluge/ui/gtkui/removetorrentdialog.py | 2 ++ deluge/ui/gtkui/sidebar.py | 2 ++ deluge/ui/gtkui/status_tab.py | 2 +- deluge/ui/gtkui/statusbar.py | 2 +- deluge/ui/gtkui/systemtray.py | 2 ++ deluge/ui/gtkui/tab_data_funcs.py | 2 ++ deluge/ui/gtkui/toolbar.py | 2 ++ deluge/ui/gtkui/torrentdetails.py | 1 + deluge/ui/gtkui/torrentview.py | 1 + deluge/ui/gtkui/torrentview_data_funcs.py | 2 +- deluge/ui/gtkui/trackers_tab.py | 2 ++ deluge/ui/languages.py | 2 ++ deluge/ui/sessionproxy.py | 2 ++ deluge/ui/tracker_icons.py | 2 ++ deluge/ui/translations_util.py | 2 ++ deluge/ui/ui.py | 2 ++ deluge/ui/ui_entry.py | 1 + deluge/ui/web/__init__.py | 2 ++ deluge/ui/web/auth.py | 2 ++ deluge/ui/web/common.py | 2 ++ deluge/ui/web/json_api.py | 2 +- deluge/ui/web/pluginmanager.py | 2 ++ deluge/ui/web/server.py | 2 ++ deluge/ui/web/web.py | 2 +- gen_web_gettext.py | 2 +- generate_pot.py | 2 +- minify_web_js.py | 2 +- version.py | 2 +- 272 files changed, 585 insertions(+), 155 deletions(-) diff --git a/deluge/__init__.py b/deluge/__init__.py index 061e91d9b..6dd6930e2 100644 --- a/deluge/__init__.py +++ b/deluge/__init__.py @@ -1,4 +1,6 @@ """Deluge""" +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/__rpcapi.py b/deluge/__rpcapi.py index 73f348ad6..a2290abb0 100644 --- a/deluge/__rpcapi.py +++ b/deluge/__rpcapi.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from new import classobj from deluge.core.core import Core diff --git a/deluge/_libtorrent.py b/deluge/_libtorrent.py index 81acae552..9e4826adb 100644 --- a/deluge/_libtorrent.py +++ b/deluge/_libtorrent.py @@ -15,6 +15,7 @@ Example: >>> from deluge._libtorrent import lt """ +from __future__ import unicode_literals from deluge.common import VersionSplit, get_version diff --git a/deluge/common.py b/deluge/common.py index 0ec886be2..19879aa64 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -8,7 +8,7 @@ # """Common functions for various parts of Deluge to use.""" -from __future__ import division, print_function +from __future__ import division, print_function, unicode_literals import base64 import functools @@ -800,7 +800,7 @@ def decode_string(s, encoding='utf8'): """ if not s: - return u'' + return '' elif isinstance(s, unicode): return s @@ -817,7 +817,7 @@ def decode_string(s, encoding='utf8'): return s.decode(*l()) except UnicodeDecodeError: pass - return u'' + return '' def utf8_encoded(s, encoding='utf8'): @@ -871,6 +871,7 @@ class VersionSplit(object): vs = ver.replace('_', '-').split('-') self.version = [int(x) for x in vs[0].split('.') if x.isdigit()] + self.version_string = ''.join(str(x) for x in vs[0].split('.') if x.isdigit()) self.suffix = None self.dev = False if len(vs) > 1: diff --git a/deluge/component.py b/deluge/component.py index fe591295a..274c86df9 100644 --- a/deluge/component.py +++ b/deluge/component.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import traceback from collections import defaultdict @@ -305,7 +307,7 @@ class ComponentRegistry(object): # Start all the components if names is empty if not names: names = self.components.keys() - elif isinstance(names, str): + elif isinstance(names, basestring): names = [names] def on_depends_started(result, name): @@ -339,7 +341,7 @@ class ComponentRegistry(object): """ if not names: names = self.components.keys() - elif isinstance(names, str): + elif isinstance(names, basestring): names = [names] def on_dependents_stopped(result, name): @@ -377,7 +379,7 @@ class ComponentRegistry(object): """ if not names: names = self.components.keys() - elif isinstance(names, str): + elif isinstance(names, basestring): names = [names] deferreds = [] @@ -403,7 +405,7 @@ class ComponentRegistry(object): """ if not names: names = self.components.keys() - elif isinstance(names, str): + elif isinstance(names, basestring): names = [names] deferreds = [] diff --git a/deluge/config.py b/deluge/config.py index dd3d46dd0..a9d0dada8 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -39,6 +39,7 @@ 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 cPickle as pickle import json @@ -46,7 +47,7 @@ import logging import os import shutil -from deluge.common import get_default_config_dir, utf8_encoded +from deluge.common import decode_string, get_default_config_dir, utf8_encoded log = logging.getLogger(__name__) callLater = None # Necessary for the config tests @@ -243,11 +244,8 @@ class Config(object): 5 """ - if isinstance(self.__config[key], str): - try: - return self.__config[key].decode('utf8') - except UnicodeDecodeError: - return self.__config[key] + if isinstance(self.__config[key], basestring): + return decode_string(self.__config[key]) else: return self.__config[key] diff --git a/deluge/configmanager.py b/deluge/configmanager.py index be1814b5b..bfd39ca1b 100644 --- a/deluge/configmanager.py +++ b/deluge/configmanager.py @@ -7,6 +7,8 @@ # 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 45ab88974..7ebaecd65 100644 --- a/deluge/core/alertmanager.py +++ b/deluge/core/alertmanager.py @@ -15,6 +15,7 @@ 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 diff --git a/deluge/core/authmanager.py b/deluge/core/authmanager.py index fe9a6d36e..b9d429d57 100644 --- a/deluge/core/authmanager.py +++ b/deluge/core/authmanager.py @@ -8,6 +8,8 @@ # 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 c1805411e..7c860eb42 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -8,7 +8,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import base64 import glob diff --git a/deluge/core/daemon.py b/deluge/core/daemon.py index 35aa8d834..e84218141 100644 --- a/deluge/core/daemon.py +++ b/deluge/core/daemon.py @@ -8,6 +8,7 @@ # """The Deluge daemon""" +from __future__ import unicode_literals import logging import os diff --git a/deluge/core/daemon_entry.py b/deluge/core/daemon_entry.py index 2bec8bb4c..e55208586 100644 --- a/deluge/core/daemon_entry.py +++ b/deluge/core/daemon_entry.py @@ -7,7 +7,7 @@ # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import os import sys diff --git a/deluge/core/eventmanager.py b/deluge/core/eventmanager.py index 44a0c8fa5..03efb5abb 100644 --- a/deluge/core/eventmanager.py +++ b/deluge/core/eventmanager.py @@ -7,6 +7,8 @@ # 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 2944c30d9..e5c7b936d 100644 --- a/deluge/core/filtermanager.py +++ b/deluge/core/filtermanager.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import deluge.component as component diff --git a/deluge/core/pluginmanager.py b/deluge/core/pluginmanager.py index dacb7af70..0d528d109 100644 --- a/deluge/core/pluginmanager.py +++ b/deluge/core/pluginmanager.py @@ -9,6 +9,7 @@ """PluginManager for Core""" +from __future__ import unicode_literals import logging diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index 38a3717bf..414c9904f 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -8,6 +8,8 @@ # +from __future__ import unicode_literals + import logging import os import random diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py index 4985f8e1e..2ab7af86f 100644 --- a/deluge/core/rpcserver.py +++ b/deluge/core/rpcserver.py @@ -8,6 +8,7 @@ # """RPCServer Module""" +from __future__ import unicode_literals import logging import os diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 5ee70d76d..1cb777b98 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -14,7 +14,7 @@ Attributes: """ -from __future__ import division +from __future__ import division, unicode_literals import logging import os diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 0e5a3bf7b..3177dee7f 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -8,6 +8,7 @@ # """TorrentManager handles Torrent objects""" +from __future__ import unicode_literals import cPickle import datetime diff --git a/deluge/decorators.py b/deluge/decorators.py index c00da58a9..856c4e894 100644 --- a/deluge/decorators.py +++ b/deluge/decorators.py @@ -7,6 +7,8 @@ # 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 94b15e466..bbee4dae2 100644 --- a/deluge/error.py +++ b/deluge/error.py @@ -9,6 +9,9 @@ # +from __future__ import unicode_literals + + class DelugeError(Exception): def __new__(cls, *args, **kwargs): diff --git a/deluge/event.py b/deluge/event.py index 2701825b0..63ef41da8 100644 --- a/deluge/event.py +++ b/deluge/event.py @@ -14,6 +14,7 @@ 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 known_events = {} diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py index 89369106e..672b97ac8 100644 --- a/deluge/httpdownloader.py +++ b/deluge/httpdownloader.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os.path import zlib diff --git a/deluge/log.py b/deluge/log.py index 0e4d5dde3..003c1be8a 100644 --- a/deluge/log.py +++ b/deluge/log.py @@ -9,6 +9,7 @@ # """Logging functions""" +from __future__ import unicode_literals import inspect import logging diff --git a/deluge/maketorrent.py b/deluge/maketorrent.py index 18e634b76..215f6784d 100644 --- a/deluge/maketorrent.py +++ b/deluge/maketorrent.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import os import sys diff --git a/deluge/metafile.py b/deluge/metafile.py index a77ff4739..412e62788 100644 --- a/deluge/metafile.py +++ b/deluge/metafile.py @@ -11,7 +11,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging import os.path diff --git a/deluge/path_chooser_common.py b/deluge/path_chooser_common.py index 31a2664ce..d6cd27c40 100644 --- a/deluge/path_chooser_common.py +++ b/deluge/path_chooser_common.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import os diff --git a/deluge/pluginmanagerbase.py b/deluge/pluginmanagerbase.py index 5de5bbc23..1eba1ea76 100644 --- a/deluge/pluginmanagerbase.py +++ b/deluge/pluginmanagerbase.py @@ -9,6 +9,7 @@ """PluginManagerBase""" +from __future__ import unicode_literals import logging import os.path diff --git a/deluge/plugins/AutoAdd/deluge/__init__.py b/deluge/plugins/AutoAdd/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/AutoAdd/deluge/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/__init__.py index ac1347d5b..74d8be491 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/__init__.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py index bae33ab2a..3e01f2f4c 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import os import pkg_resources diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py index 5dce5a7a4..9bfbbb46b 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py @@ -13,6 +13,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import base64 import logging import os diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py index de1f103f0..59843e7b4 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py index 750bf007d..47a37d7a3 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/AutoAdd/setup.py b/deluge/plugins/AutoAdd/setup.py index 7d18adef6..5c767b3f5 100644 --- a/deluge/plugins/AutoAdd/setup.py +++ b/deluge/plugins/AutoAdd/setup.py @@ -13,6 +13,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'AutoAdd' diff --git a/deluge/plugins/Blocklist/deluge/__init__.py b/deluge/plugins/Blocklist/deluge/__init__.py index 0786b820c..c55970686 100644 --- a/deluge/plugins/Blocklist/deluge/__init__.py +++ b/deluge/plugins/Blocklist/deluge/__init__.py @@ -1,2 +1,4 @@ +from __future__ import unicode_literals + # this is a namespace package __import__('pkg_resources').declare_namespace(__name__) diff --git a/deluge/plugins/Blocklist/deluge/plugins/__init__.py b/deluge/plugins/Blocklist/deluge/plugins/__init__.py index 0786b820c..c55970686 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/__init__.py +++ b/deluge/plugins/Blocklist/deluge/plugins/__init__.py @@ -1,2 +1,4 @@ +from __future__ import unicode_literals + # this is a namespace package __import__('pkg_resources').declare_namespace(__name__) diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/__init__.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/__init__.py index 560b10509..bc9a8d82a 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/__init__.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/__init__.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py index 57228d12a..05c45a933 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import os.path from functools import wraps from sys import exc_info diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py index 5f9ee2d06..ff465db22 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py @@ -8,7 +8,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging import os diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py index a9f48ba50..c44b807ca 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py @@ -8,6 +8,8 @@ # # pylint: disable=redefined-builtin +from __future__ import unicode_literals + import bz2 import gzip import zipfile diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py index 09de39dbc..96450278f 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py @@ -7,6 +7,8 @@ # 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/plugins/blocklist/gtkui.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py index c88f05d83..cf3d58324 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from datetime import datetime diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py index 59372e23c..cf5675ca8 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import gzip import logging import socket diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py index 7963709ed..c96f1d0ed 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import re diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py index 474f8d26d..2f743427d 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/Blocklist/setup.py b/deluge/plugins/Blocklist/setup.py index c49fb4f1c..49593b25d 100644 --- a/deluge/plugins/Blocklist/setup.py +++ b/deluge/plugins/Blocklist/setup.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Blocklist' diff --git a/deluge/plugins/Execute/deluge/__init__.py b/deluge/plugins/Execute/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Execute/deluge/__init__.py +++ b/deluge/plugins/Execute/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Execute/deluge/plugins/__init__.py b/deluge/plugins/Execute/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Execute/deluge/plugins/__init__.py +++ b/deluge/plugins/Execute/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Execute/deluge/plugins/execute/__init__.py b/deluge/plugins/Execute/deluge/plugins/execute/__init__.py index 4c4510370..f7854eeb7 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/__init__.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/__init__.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Execute/deluge/plugins/execute/common.py b/deluge/plugins/Execute/deluge/plugins/execute/common.py index 2301bb91e..489f31291 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/common.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/common.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import os.path import pkg_resources diff --git a/deluge/plugins/Execute/deluge/plugins/execute/core.py b/deluge/plugins/Execute/deluge/plugins/execute/core.py index 27e2f0f0d..886920d56 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/core.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/core.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import hashlib import logging import os diff --git a/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py b/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py index 08eb5e590..ca35aa2d6 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import gtk diff --git a/deluge/plugins/Execute/deluge/plugins/execute/webui.py b/deluge/plugins/Execute/deluge/plugins/execute/webui.py index de337e73c..8327001b8 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/webui.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/webui.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/Execute/setup.py b/deluge/plugins/Execute/setup.py index 090131d1f..7cc51491e 100644 --- a/deluge/plugins/Execute/setup.py +++ b/deluge/plugins/Execute/setup.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Execute' diff --git a/deluge/plugins/Extractor/deluge/__init__.py b/deluge/plugins/Extractor/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Extractor/deluge/__init__.py +++ b/deluge/plugins/Extractor/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Extractor/deluge/plugins/__init__.py b/deluge/plugins/Extractor/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Extractor/deluge/plugins/__init__.py +++ b/deluge/plugins/Extractor/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py b/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py index 34d3d235d..7d3492d2c 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/__init__.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py index c748b5ec4..279893305 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import os import pkg_resources diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py index 5aee29508..5bddeccb2 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import errno import logging import os diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py index b545fba34..807c8c127 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import gtk diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py index eaab79a74..feb7b4a83 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/Extractor/setup.py b/deluge/plugins/Extractor/setup.py index a38f4d76e..b246c3d2c 100644 --- a/deluge/plugins/Extractor/setup.py +++ b/deluge/plugins/Extractor/setup.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Extractor' diff --git a/deluge/plugins/Label/deluge/__init__.py b/deluge/plugins/Label/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Label/deluge/__init__.py +++ b/deluge/plugins/Label/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Label/deluge/plugins/__init__.py b/deluge/plugins/Label/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Label/deluge/plugins/__init__.py +++ b/deluge/plugins/Label/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Label/deluge/plugins/label/__init__.py b/deluge/plugins/Label/deluge/plugins/label/__init__.py index c398e4d91..363d49d42 100644 --- a/deluge/plugins/Label/deluge/plugins/label/__init__.py +++ b/deluge/plugins/Label/deluge/plugins/label/__init__.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Label/deluge/plugins/label/core.py b/deluge/plugins/Label/deluge/plugins/label/core.py index b3dc778b8..9f176b9ba 100644 --- a/deluge/plugins/Label/deluge/plugins/label/core.py +++ b/deluge/plugins/Label/deluge/plugins/label/core.py @@ -15,6 +15,7 @@ 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/plugins/label/gtkui/__init__.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py index a603a64bf..7d205b0fe 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py @@ -7,6 +7,8 @@ # 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/plugins/label/gtkui/label_config.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py index e7af15e61..213a78566 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py index 3ee78ea2f..f46da255c 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import gtk diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py index d406965a3..fb0474f4d 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py @@ -8,6 +8,8 @@ # +from __future__ import unicode_literals + import logging import gtk diff --git a/deluge/plugins/Label/deluge/plugins/label/test.py b/deluge/plugins/Label/deluge/plugins/label/test.py index bdb6f6d2a..5c9ffcd00 100644 --- a/deluge/plugins/Label/deluge/plugins/label/test.py +++ b/deluge/plugins/Label/deluge/plugins/label/test.py @@ -10,7 +10,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals from deluge.ui.client import sclient diff --git a/deluge/plugins/Label/deluge/plugins/label/webui.py b/deluge/plugins/Label/deluge/plugins/label/webui.py index 421470ba3..dec9ab428 100644 --- a/deluge/plugins/Label/deluge/plugins/label/webui.py +++ b/deluge/plugins/Label/deluge/plugins/label/webui.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os diff --git a/deluge/plugins/Label/setup.py b/deluge/plugins/Label/setup.py index b69438d0b..30af4de1b 100644 --- a/deluge/plugins/Label/setup.py +++ b/deluge/plugins/Label/setup.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Label' diff --git a/deluge/plugins/Notifications/deluge/__init__.py b/deluge/plugins/Notifications/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Notifications/deluge/__init__.py +++ b/deluge/plugins/Notifications/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Notifications/deluge/plugins/__init__.py b/deluge/plugins/Notifications/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Notifications/deluge/plugins/__init__.py +++ b/deluge/plugins/Notifications/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/__init__.py b/deluge/plugins/Notifications/deluge/plugins/notifications/__init__.py index 1639f0499..0164464c8 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/__init__.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/__init__.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py index a067c73c7..034abd6df 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from twisted.internet import defer diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py index 72cd2872a..15819d141 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import smtplib from email.utils import formatdate diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py index 52910f2d8..829bdbd48 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from os.path import basename diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/test.py b/deluge/plugins/Notifications/deluge/plugins/notifications/test.py index 31ae611e4..9d2ea83c6 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/test.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/test.py @@ -6,6 +6,8 @@ # 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/plugins/notifications/webui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py index 9ce1b0012..d3529c4f9 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/Notifications/setup.py b/deluge/plugins/Notifications/setup.py index 9c94dd34b..310b87a28 100755 --- a/deluge/plugins/Notifications/setup.py +++ b/deluge/plugins/Notifications/setup.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Notifications' diff --git a/deluge/plugins/Scheduler/deluge/__init__.py b/deluge/plugins/Scheduler/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Scheduler/deluge/__init__.py +++ b/deluge/plugins/Scheduler/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Scheduler/deluge/plugins/__init__.py b/deluge/plugins/Scheduler/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/__init__.py +++ b/deluge/plugins/Scheduler/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/__init__.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/__init__.py index 34d3d235d..7d3492d2c 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/__init__.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/__init__.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py index 8c11465d0..decf23a99 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py @@ -12,6 +12,9 @@ # +from __future__ import unicode_literals + + def get_resource(filename): import os import pkg_resources diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py index 448621886..2f2465364 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import time diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py index 2dc058332..3eacca8d5 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py @@ -11,7 +11,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py index 9991f96b6..518eaa6aa 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py @@ -1,4 +1,3 @@ -# # -*- coding: utf-8 -*- # # Copyright (C) 2009 Andrew Resch @@ -11,6 +10,7 @@ # 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 diff --git a/deluge/plugins/Scheduler/setup.py b/deluge/plugins/Scheduler/setup.py index c5ab60a8a..eb2a3f4e1 100644 --- a/deluge/plugins/Scheduler/setup.py +++ b/deluge/plugins/Scheduler/setup.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Scheduler' diff --git a/deluge/plugins/Stats/deluge/__init__.py b/deluge/plugins/Stats/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Stats/deluge/__init__.py +++ b/deluge/plugins/Stats/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Stats/deluge/plugins/__init__.py b/deluge/plugins/Stats/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Stats/deluge/plugins/__init__.py +++ b/deluge/plugins/Stats/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Stats/deluge/plugins/stats/__init__.py b/deluge/plugins/Stats/deluge/plugins/stats/__init__.py index f7e6aa642..77c85128e 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/__init__.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/__init__.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Stats/deluge/plugins/stats/common.py b/deluge/plugins/Stats/deluge/plugins/stats/common.py index 79d9df535..33c1348fb 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/common.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/common.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import os.path import pkg_resources diff --git a/deluge/plugins/Stats/deluge/plugins/stats/core.py b/deluge/plugins/Stats/deluge/plugins/stats/core.py index 245f7582b..c93b03dcd 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/core.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/core.py @@ -1,4 +1,3 @@ -# # -*- coding: utf-8 -*- # # Copyright (C) 2009 Ian Martin @@ -11,7 +10,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging import time diff --git a/deluge/plugins/Stats/deluge/plugins/stats/graph.py b/deluge/plugins/Stats/deluge/plugins/stats/graph.py index d2027c701..782e66c73 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/graph.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/graph.py @@ -1,4 +1,3 @@ -# # -*- coding: utf-8 -*- # # Copyright (C) 2009 Ian Martin @@ -15,7 +14,7 @@ port of old plugin by markybob. """ -from __future__ import division +from __future__ import division, unicode_literals import logging import math diff --git a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py index 6262e6875..bebd46dac 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py @@ -12,7 +12,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging diff --git a/deluge/plugins/Stats/deluge/plugins/stats/tests/test_stats.py b/deluge/plugins/Stats/deluge/plugins/stats/tests/test_stats.py index 2ceb75c6f..d2046108a 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/tests/test_stats.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/tests/test_stats.py @@ -4,7 +4,7 @@ # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import pytest from twisted.internet import defer diff --git a/deluge/plugins/Stats/deluge/plugins/stats/webui.py b/deluge/plugins/Stats/deluge/plugins/stats/webui.py index 9e7e6992d..4c11260e5 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/webui.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/webui.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/Stats/setup.py b/deluge/plugins/Stats/setup.py index 64b12373b..d5931be1e 100644 --- a/deluge/plugins/Stats/setup.py +++ b/deluge/plugins/Stats/setup.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Stats' diff --git a/deluge/plugins/Toggle/deluge/__init__.py b/deluge/plugins/Toggle/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Toggle/deluge/__init__.py +++ b/deluge/plugins/Toggle/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Toggle/deluge/plugins/__init__.py b/deluge/plugins/Toggle/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/Toggle/deluge/plugins/__init__.py +++ b/deluge/plugins/Toggle/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/__init__.py b/deluge/plugins/Toggle/deluge/plugins/toggle/__init__.py index 303154623..b83206a77 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/__init__.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/__init__.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/common.py b/deluge/plugins/Toggle/deluge/plugins/toggle/common.py index bc1d4774e..c3e66edbf 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/common.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/common.py @@ -13,6 +13,9 @@ # +from __future__ import unicode_literals + + def get_resource(filename): import os.path import pkg_resources diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/core.py b/deluge/plugins/Toggle/deluge/plugins/toggle/core.py index 43fb63408..eb734275f 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/core.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/core.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import deluge.component as component diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py b/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py index 87503a008..dc257d8c7 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import deluge.component as component diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py b/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py index c46af6d65..8f0fc8c99 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.plugins.pluginbase import WebPluginBase diff --git a/deluge/plugins/Toggle/setup.py b/deluge/plugins/Toggle/setup.py index 89fe9e35f..4cb0109ef 100644 --- a/deluge/plugins/Toggle/setup.py +++ b/deluge/plugins/Toggle/setup.py @@ -12,6 +12,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'Toggle' diff --git a/deluge/plugins/WebUi/deluge/__init__.py b/deluge/plugins/WebUi/deluge/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/WebUi/deluge/__init__.py +++ b/deluge/plugins/WebUi/deluge/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/WebUi/deluge/plugins/__init__.py b/deluge/plugins/WebUi/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/WebUi/deluge/plugins/__init__.py +++ b/deluge/plugins/WebUi/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/__init__.py b/deluge/plugins/WebUi/deluge/plugins/webui/__init__.py index b8497298d..2e53a6b59 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/__init__.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/__init__.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from deluge.plugins.init import PluginInitBase diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/common.py b/deluge/plugins/WebUi/deluge/plugins/webui/common.py index 6aeca01eb..97cbe651e 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/common.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/common.py @@ -12,6 +12,9 @@ # +from __future__ import unicode_literals + + def get_resource(filename): import os.path import pkg_resources diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/core.py b/deluge/plugins/WebUi/deluge/plugins/webui/core.py index 598058d27..5951c55e1 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/core.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/core.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from twisted.internet import defer diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py index 00f378490..dd8e500d6 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import gtk diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/tests/test_plugin_webui.py b/deluge/plugins/WebUi/deluge/plugins/webui/tests/test_plugin_webui.py index d5b30a867..8f70a19b3 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/tests/test_plugin_webui.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/tests/test_plugin_webui.py @@ -7,6 +7,8 @@ # 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/WebUi/setup.py b/deluge/plugins/WebUi/setup.py index 3a7b130f0..2819ec6f8 100644 --- a/deluge/plugins/WebUi/setup.py +++ b/deluge/plugins/WebUi/setup.py @@ -11,6 +11,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from setuptools import find_packages, setup __plugin_name__ = 'WebUi' diff --git a/deluge/plugins/__init__.py b/deluge/plugins/__init__.py index 30e4998de..46dd0ac34 100644 --- a/deluge/plugins/__init__.py +++ b/deluge/plugins/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # this is a namespace package import pkg_resources diff --git a/deluge/plugins/init.py b/deluge/plugins/init.py index 28b1efbc1..addeae9f3 100644 --- a/deluge/plugins/init.py +++ b/deluge/plugins/init.py @@ -10,6 +10,8 @@ """ 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 0829625a5..5bc3e1c59 100644 --- a/deluge/plugins/pluginbase.py +++ b/deluge/plugins/pluginbase.py @@ -7,6 +7,8 @@ # 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 b8fdd8bb4..e2268b818 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -6,7 +6,7 @@ example: python create_plugin.py --name MyPlugin2 --basepath . --author-name "Your Name" --author-email "yourname@example.com" """ -from __future__ import print_function +from __future__ import print_function, unicode_literals import os import sys diff --git a/deluge/scripts/deluge_remote.py b/deluge/scripts/deluge_remote.py index c576863fe..d4cf46664 100644 --- a/deluge/scripts/deluge_remote.py +++ b/deluge/scripts/deluge_remote.py @@ -11,6 +11,8 @@ # # 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 f9fc16a5a..5a1ef6ea2 100644 --- a/deluge/tests/__init__.py +++ b/deluge/tests/__init__.py @@ -1,6 +1,6 @@ # Increase open file descriptor limit to allow tests to run # without getting error: what(): epoll: Too many open files -from __future__ import print_function +from __future__ import print_function, unicode_literals try: import resource diff --git a/deluge/tests/basetest.py b/deluge/tests/basetest.py index b6524cf99..057d403f9 100644 --- a/deluge/tests/basetest.py +++ b/deluge/tests/basetest.py @@ -1,3 +1,5 @@ +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 a29865f9f..c9de2967f 100644 --- a/deluge/tests/common.py +++ b/deluge/tests/common.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import os import sys diff --git a/deluge/tests/common_web.py b/deluge/tests/common_web.py index 6799598f7..7ba5f9f42 100644 --- a/deluge/tests/common_web.py +++ b/deluge/tests/common_web.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from twisted.internet import reactor import deluge.common diff --git a/deluge/tests/daemon_base.py b/deluge/tests/daemon_base.py index 42bff39ca..2208a5b22 100644 --- a/deluge/tests/daemon_base.py +++ b/deluge/tests/daemon_base.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals import os.path diff --git a/deluge/tests/test_alertmanager.py b/deluge/tests/test_alertmanager.py index 2402c5134..16146b213 100644 --- a/deluge/tests/test_alertmanager.py +++ b/deluge/tests/test_alertmanager.py @@ -5,6 +5,8 @@ # 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 7f34e370b..5a21e5608 100644 --- a/deluge/tests/test_authmanager.py +++ b/deluge/tests/test_authmanager.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import deluge.component as component from deluge.core.authmanager import AUTH_LEVEL_ADMIN, AuthManager diff --git a/deluge/tests/test_client.py b/deluge/tests/test_client.py index 0ca416cf4..d2c36c7e3 100644 --- a/deluge/tests/test_client.py +++ b/deluge/tests/test_client.py @@ -5,6 +5,8 @@ # 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 285785678..b420f8f16 100644 --- a/deluge/tests/test_common.py +++ b/deluge/tests/test_common.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import os from twisted.trial import unittest diff --git a/deluge/tests/test_component.py b/deluge/tests/test_component.py index 012611045..5995e017b 100644 --- a/deluge/tests/test_component.py +++ b/deluge/tests/test_component.py @@ -1,3 +1,5 @@ +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 b3f34de0a..60c7e2f72 100644 --- a/deluge/tests/test_config.py +++ b/deluge/tests/test_config.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals + import os from twisted.internet import task @@ -10,7 +12,7 @@ from deluge.config import Config from .common import set_tmp_config_dir -DEFAULTS = {'string': 'foobar', 'int': 1, 'float': 0.435, 'bool': True, 'unicode': u'foobar'} +DEFAULTS = {'string': b'foobar', 'int': 1, 'float': 0.435, 'bool': True, 'unicode': 'foobar'} class ConfigTestCase(unittest.TestCase): @@ -36,10 +38,10 @@ class ConfigTestCase(unittest.TestCase): config['foo'] = '3' self.assertEquals(config.get_item('foo'), 3) - config['unicode'] = u'ВИДЕОФИЛЬМЫ' - self.assertEquals(config['unicode'], u'ВИДЕОФИЛЬМЫ') + config['unicode'] = 'ВИДЕОФИЛЬМЫ' + self.assertEquals(config['unicode'], 'ВИДЕОФИЛЬМЫ') - config['unicode'] = 'foostring' + config['unicode'] = b'foostring' self.assertTrue(isinstance(config.get_item('unicode'), unicode)) config._save_timer.cancel() diff --git a/deluge/tests/test_core.py b/deluge/tests/test_core.py index 97b5e5ab9..2bc0d8d23 100644 --- a/deluge/tests/test_core.py +++ b/deluge/tests/test_core.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import base64 import sys from hashlib import sha1 as sha diff --git a/deluge/tests/test_decorators.py b/deluge/tests/test_decorators.py index 5201060ac..3a98ab2e0 100644 --- a/deluge/tests/test_decorators.py +++ b/deluge/tests/test_decorators.py @@ -1,3 +1,5 @@ +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 3708061d0..36fa4d633 100644 --- a/deluge/tests/test_error.py +++ b/deluge/tests/test_error.py @@ -1,3 +1,5 @@ +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 9704b124f..9080a1830 100644 --- a/deluge/tests/test_files_tab.py +++ b/deluge/tests/test_files_tab.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals import pytest from twisted.trial import unittest @@ -78,8 +78,8 @@ class FilesTabTestCase(BaseTestCase): return _verify_treestore(treestore.get_iter_root(), tree) def test_files_tab(self): - self.filestab.files_list[self.t_id] = ({u'index': 0, u'path': u'1/test_10.txt', u'offset': 0, u'size': 13}, - {u'index': 1, u'path': u'test_100.txt', u'offset': 13, u'size': 14}) + self.filestab.files_list[self.t_id] = ({'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, + {'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14}) self.filestab.update_files() self.filestab._on_torrentfilerenamed_event(self.t_id, self.index, '2/test_100.txt') @@ -89,8 +89,8 @@ class FilesTabTestCase(BaseTestCase): self.assertTrue(ret) def test_files_tab2(self): - self.filestab.files_list[self.t_id] = ({u'index': 0, u'path': u'1/1/test_10.txt', u'offset': 0, u'size': 13}, - {u'index': 1, u'path': u'test_100.txt', u'offset': 13, u'size': 14}) + self.filestab.files_list[self.t_id] = ({'index': 0, 'path': '1/1/test_10.txt', 'offset': 0, 'size': 13}, + {'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14}) self.filestab.update_files() self.filestab._on_torrentfilerenamed_event(self.t_id, self.index, '1/1/test_100.txt') @@ -100,8 +100,8 @@ class FilesTabTestCase(BaseTestCase): self.assertTrue(ret) def test_files_tab3(self): - self.filestab.files_list[self.t_id] = ({u'index': 0, u'path': u'1/test_10.txt', u'offset': 0, u'size': 13}, - {u'index': 1, u'path': u'test_100.txt', u'offset': 13, u'size': 14}) + self.filestab.files_list[self.t_id] = ({'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, + {'index': 1, 'path': 'test_100.txt', 'offset': 13, 'size': 14}) self.filestab.update_files() self.filestab._on_torrentfilerenamed_event(self.t_id, self.index, '1/test_100.txt') @@ -111,8 +111,8 @@ class FilesTabTestCase(BaseTestCase): self.assertTrue(ret) def test_files_tab4(self): - self.filestab.files_list[self.t_id] = ({u'index': 0, u'path': u'1/test_10.txt', u'offset': 0, u'size': 13}, - {u'index': 1, u'path': u'1/test_100.txt', u'offset': 13, u'size': 14}) + self.filestab.files_list[self.t_id] = ({'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, + {'index': 1, 'path': '1/test_100.txt', 'offset': 13, 'size': 14}) self.filestab.update_files() self.filestab._on_torrentfilerenamed_event(self.t_id, self.index, '1/2/test_100.txt') @@ -123,8 +123,8 @@ class FilesTabTestCase(BaseTestCase): self.assertTrue(ret) def test_files_tab5(self): - self.filestab.files_list[self.t_id] = ({u'index': 0, u'path': u'1/test_10.txt', u'offset': 0, u'size': 13}, - {u'index': 1, u'path': u'2/test_100.txt', u'offset': 13, u'size': 14}) + self.filestab.files_list[self.t_id] = ({'index': 0, 'path': '1/test_10.txt', 'offset': 0, 'size': 13}, + {'index': 1, 'path': '2/test_100.txt', 'offset': 13, 'size': 14}) self.filestab.update_files() self.filestab._on_torrentfilerenamed_event(self.t_id, self.index, '1/test_100.txt') diff --git a/deluge/tests/test_httpdownloader.py b/deluge/tests/test_httpdownloader.py index b446a7ace..00484681b 100644 --- a/deluge/tests/test_httpdownloader.py +++ b/deluge/tests/test_httpdownloader.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import tempfile from email.utils import formatdate diff --git a/deluge/tests/test_json_api.py b/deluge/tests/test_json_api.py index f4ee5eb14..4f2426359 100644 --- a/deluge/tests/test_json_api.py +++ b/deluge/tests/test_json_api.py @@ -7,6 +7,8 @@ # 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 c300f991f..fd65bbf6c 100644 --- a/deluge/tests/test_log.py +++ b/deluge/tests/test_log.py @@ -8,6 +8,8 @@ # 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 6011dd99f..1a61b3502 100644 --- a/deluge/tests/test_maketorrent.py +++ b/deluge/tests/test_maketorrent.py @@ -1,3 +1,5 @@ +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 c60ab6cf9..dafa9d635 100644 --- a/deluge/tests/test_plugin_metadata.py +++ b/deluge/tests/test_plugin_metadata.py @@ -7,6 +7,8 @@ # 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 81acf245e..2afc77318 100644 --- a/deluge/tests/test_rpcserver.py +++ b/deluge/tests/test_rpcserver.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import deluge.component as component import deluge.error from deluge.core import rpcserver diff --git a/deluge/tests/test_sessionproxy.py b/deluge/tests/test_sessionproxy.py index 2698c75e5..566879609 100644 --- a/deluge/tests/test_sessionproxy.py +++ b/deluge/tests/test_sessionproxy.py @@ -7,6 +7,8 @@ # 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 7e8433d81..e777dd506 100644 --- a/deluge/tests/test_torrent.py +++ b/deluge/tests/test_torrent.py @@ -1,4 +1,4 @@ -from __future__ import print_function +from __future__ import print_function, unicode_literals import base64 import os diff --git a/deluge/tests/test_torrentmanager.py b/deluge/tests/test_torrentmanager.py index 3e3be0246..9ec55c405 100644 --- a/deluge/tests/test_torrentmanager.py +++ b/deluge/tests/test_torrentmanager.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import base64 import warnings diff --git a/deluge/tests/test_torrentview.py b/deluge/tests/test_torrentview.py index a60f5b2de..ff3c7bc21 100644 --- a/deluge/tests/test_torrentview.py +++ b/deluge/tests/test_torrentview.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import pytest from twisted.trial import unittest @@ -31,14 +33,14 @@ setup_translations() class TorrentviewTestCase(BaseTestCase): default_column_index = ['filter', 'torrent_id', 'dirty', '#', - u'Name', - u'Size', u'Downloaded', u'Uploaded', u'Remaining', - u'Progress', - u'Seeds', u'Peers', u'Seeds:Peers', - u'Down Speed', u'Up Speed', u'Down Limit', u'Up Limit', - u'ETA', u'Ratio', u'Avail', - u'Added', u'Completed', u'Complete Seen', - u'Tracker', u'Download Folder', u'Owner', u'Shared'] + 'Name', + 'Size', 'Downloaded', 'Uploaded', 'Remaining', + 'Progress', + 'Seeds', 'Peers', 'Seeds:Peers', + 'Down Speed', 'Up Speed', 'Down Limit', 'Up Limit', + 'ETA', 'Ratio', 'Avail', + 'Added', 'Completed', 'Complete Seen', + 'Tracker', 'Download Folder', 'Owner', 'Shared'] default_liststore_columns = [bool, str, bool, int, str, str, # Name TYPE_UINT64, TYPE_UINT64, TYPE_UINT64, TYPE_UINT64, diff --git a/deluge/tests/test_tracker_icons.py b/deluge/tests/test_tracker_icons.py index 90ae875c5..8576cbf10 100644 --- a/deluge/tests/test_tracker_icons.py +++ b/deluge/tests/test_tracker_icons.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + import pytest import deluge.component as component diff --git a/deluge/tests/test_transfer.py b/deluge/tests/test_transfer.py index 79038dd6b..c4d1293ed 100644 --- a/deluge/tests/test_transfer.py +++ b/deluge/tests/test_transfer.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import base64 @@ -117,9 +117,9 @@ class DelugeTransferProtocolTestCase(unittest.TestCase): """ self.transfer = TransferTestClass() - self.msg1 = (0, 1, {'key_int': 1242429423}, {'key_str': 'some string'}, {'key_bool': True}) + self.msg1 = (0, 1, {'key_int': 1242429423}, {'key_str': b'some string'}, {'key_bool': True}) self.msg2 = (2, 3, {'key_float': 12424.29423}, - {'key_unicode': u'some string'}, + {'key_unicode': 'some string'}, {'key_dict_with_tuple': {'key_tuple': (1, 2, 3)}}, {'keylist': [4, '5', 6.7]}) diff --git a/deluge/tests/test_ui_common.py b/deluge/tests/test_ui_common.py index 0af5dfc9c..438d91779 100644 --- a/deluge/tests/test_ui_common.py +++ b/deluge/tests/test_ui_common.py @@ -6,6 +6,8 @@ # 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.ui.common import TorrentInfo diff --git a/deluge/tests/test_ui_console_fields.py b/deluge/tests/test_ui_console_fields.py index 99a3a0605..c6bb4d788 100644 --- a/deluge/tests/test_ui_console_fields.py +++ b/deluge/tests/test_ui_console_fields.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +from __future__ import unicode_literals + from twisted.trial import unittest from deluge.ui.console.widgets.fields import TextInput diff --git a/deluge/tests/test_ui_entry.py b/deluge/tests/test_ui_entry.py index c0ad7098d..58963aa70 100644 --- a/deluge/tests/test_ui_entry.py +++ b/deluge/tests/test_ui_entry.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import argparse import exceptions diff --git a/deluge/tests/test_web_api.py b/deluge/tests/test_web_api.py index 600064a8d..071c138c1 100644 --- a/deluge/tests/test_web_api.py +++ b/deluge/tests/test_web_api.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from StringIO import StringIO from twisted.internet import defer, reactor @@ -83,7 +85,7 @@ class WebAPITestCase(WebServerTestBase): def get_host_status(self): host = list(self.deluge_web.web_api._get_host(self.host_id)) host[3] = 'Online' - host[4] = u'2.0.0.dev562' + host[4] = '2.0.0.dev562' status = yield self.deluge_web.web_api.get_host_status(self.host_id) self.assertEquals(status, tuple(status)) @@ -141,9 +143,9 @@ class WebAPITestCase(WebServerTestBase): yield self.deluge_web.web_api.add_torrents(torrents) ret = yield self.deluge_web.web_api.get_torrent_files('ab570cdd5a17ea1b61e970bb72047de141bce173') self.assertEquals(ret['type'], 'dir') - self.assertEquals(ret['contents'], {u'azcvsupdater_2.6.2.jar': - {'priority': 4, u'index': 0, u'offset': 0, 'progress': 0.0, u'path': - u'azcvsupdater_2.6.2.jar', 'type': 'file', u'size': 307949}}) + self.assertEquals(ret['contents'], {'azcvsupdater_2.6.2.jar': + {'priority': 4, 'index': 0, 'offset': 0, 'progress': 0.0, 'path': + 'azcvsupdater_2.6.2.jar', 'type': 'file', 'size': 307949}}) @defer.inlineCallbacks def test_download_torrent_from_url(self): diff --git a/deluge/tests/test_webserver.py b/deluge/tests/test_webserver.py index e0daf520c..6e42e4c96 100644 --- a/deluge/tests/test_webserver.py +++ b/deluge/tests/test_webserver.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import json as json_lib from StringIO import StringIO diff --git a/deluge/tests/twisted/plugins/delugereporter.py b/deluge/tests/twisted/plugins/delugereporter.py index bcc978c79..f4c259f07 100644 --- a/deluge/tests/twisted/plugins/delugereporter.py +++ b/deluge/tests/twisted/plugins/delugereporter.py @@ -1,4 +1,6 @@ #! /usr/bin/env python +from __future__ import unicode_literals + import os from twisted.plugin import IPlugin diff --git a/deluge/transfer.py b/deluge/transfer.py index 711745489..442d71446 100644 --- a/deluge/transfer.py +++ b/deluge/transfer.py @@ -7,10 +7,7 @@ # See LICENSE for more details. # -try: - import rencode # pylint: disable=useless-suppression,relative-import -except ImportError: - import deluge.rencode as rencode +from __future__ import unicode_literals import logging import struct @@ -18,6 +15,11 @@ import zlib from twisted.internet.protocol import Protocol +try: + import rencode # pylint: disable=useless-suppression,relative-import +except ImportError: + import deluge.rencode as rencode + log = logging.getLogger(__name__) MESSAGE_HEADER_SIZE = 5 diff --git a/deluge/ui/Win32IconImagePlugin.py b/deluge/ui/Win32IconImagePlugin.py index 61573894b..41b44d64a 100644 --- a/deluge/ui/Win32IconImagePlugin.py +++ b/deluge/ui/Win32IconImagePlugin.py @@ -44,7 +44,7 @@ Example icon to test with `down.ico`_ .. _down.ico: http://www.axialis.com/tutorials/iw/down.ico """ -from __future__ import division +from __future__ import division, unicode_literals import logging import struct diff --git a/deluge/ui/baseargparser.py b/deluge/ui/baseargparser.py index 75da06340..c320a8f26 100644 --- a/deluge/ui/baseargparser.py +++ b/deluge/ui/baseargparser.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import argparse import logging import os diff --git a/deluge/ui/client.py b/deluge/ui/client.py index 456f0888b..9483e6b00 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -8,6 +8,8 @@ # 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 56ac5dc23..a8a872671 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -11,6 +11,7 @@ """ 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 diff --git a/deluge/ui/console/__init__.py b/deluge/ui/console/__init__.py index 0ed345853..56e8d629d 100644 --- a/deluge/ui/console/__init__.py +++ b/deluge/ui/console/__init__.py @@ -7,6 +7,8 @@ # 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 edeeb90bb..6ad655a34 100644 --- a/deluge/ui/console/cmdline/command.py +++ b/deluge/ui/console/cmdline/command.py @@ -9,7 +9,7 @@ # See LICENSE for more details. # -from __future__ import print_function +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 39dbefe2a..01bb8385e 100644 --- a/deluge/ui/console/cmdline/commands/__init__.py +++ b/deluge/ui/console/cmdline/commands/__init__.py @@ -1,3 +1,5 @@ +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 443838ef5..f65d996a2 100644 --- a/deluge/ui/console/cmdline/commands/add.py +++ b/deluge/ui/console/cmdline/commands/add.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import base64 import os from urllib import url2pathname diff --git a/deluge/ui/console/cmdline/commands/cache.py b/deluge/ui/console/cmdline/commands/cache.py index 8a8cc15c1..cbe61bace 100644 --- a/deluge/ui/console/cmdline/commands/cache.py +++ b/deluge/ui/console/cmdline/commands/cache.py @@ -7,6 +7,8 @@ # 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 885c742aa..1d7489d7c 100644 --- a/deluge/ui/console/cmdline/commands/config.py +++ b/deluge/ui/console/cmdline/commands/config.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import cStringIO import logging import tokenize diff --git a/deluge/ui/console/cmdline/commands/connect.py b/deluge/ui/console/cmdline/commands/connect.py index d7d26e0c7..a61357bc4 100644 --- a/deluge/ui/console/cmdline/commands/connect.py +++ b/deluge/ui/console/cmdline/commands/connect.py @@ -8,6 +8,8 @@ # 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 b8647abc1..f65d172b5 100644 --- a/deluge/ui/console/cmdline/commands/debug.py +++ b/deluge/ui/console/cmdline/commands/debug.py @@ -8,6 +8,8 @@ # 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 3b91a22a6..88c8ca5a6 100644 --- a/deluge/ui/console/cmdline/commands/gui.py +++ b/deluge/ui/console/cmdline/commands/gui.py @@ -7,6 +7,8 @@ # 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 471af73ad..8bcb89869 100644 --- a/deluge/ui/console/cmdline/commands/halt.py +++ b/deluge/ui/console/cmdline/commands/halt.py @@ -8,6 +8,8 @@ # 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 52c8a27f3..cab151beb 100644 --- a/deluge/ui/console/cmdline/commands/help.py +++ b/deluge/ui/console/cmdline/commands/help.py @@ -8,6 +8,8 @@ # 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 ce4333ac9..84838713f 100644 --- a/deluge/ui/console/cmdline/commands/info.py +++ b/deluge/ui/console/cmdline/commands/info.py @@ -8,7 +8,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals from os.path import sep as dirsep diff --git a/deluge/ui/console/cmdline/commands/manage.py b/deluge/ui/console/cmdline/commands/manage.py index 4e8dadc1b..71e29a9c0 100644 --- a/deluge/ui/console/cmdline/commands/manage.py +++ b/deluge/ui/console/cmdline/commands/manage.py @@ -8,6 +8,8 @@ # 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 b7476bb28..637adbd54 100644 --- a/deluge/ui/console/cmdline/commands/move.py +++ b/deluge/ui/console/cmdline/commands/move.py @@ -7,6 +7,8 @@ # 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 31a7b3d70..cda220404 100644 --- a/deluge/ui/console/cmdline/commands/pause.py +++ b/deluge/ui/console/cmdline/commands/pause.py @@ -8,6 +8,8 @@ # 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 959fdcdaa..72f313b45 100644 --- a/deluge/ui/console/cmdline/commands/plugin.py +++ b/deluge/ui/console/cmdline/commands/plugin.py @@ -7,6 +7,8 @@ # 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 374367b5e..ae190050a 100644 --- a/deluge/ui/console/cmdline/commands/quit.py +++ b/deluge/ui/console/cmdline/commands/quit.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from twisted.internet import error, reactor from deluge.ui.client import client diff --git a/deluge/ui/console/cmdline/commands/recheck.py b/deluge/ui/console/cmdline/commands/recheck.py index a2f9f71e0..49f196626 100644 --- a/deluge/ui/console/cmdline/commands/recheck.py +++ b/deluge/ui/console/cmdline/commands/recheck.py @@ -7,6 +7,8 @@ # 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 cffb0c3fd..cf130edb2 100644 --- a/deluge/ui/console/cmdline/commands/resume.py +++ b/deluge/ui/console/cmdline/commands/resume.py @@ -8,6 +8,8 @@ # 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 02f0ee204..3e97178f4 100644 --- a/deluge/ui/console/cmdline/commands/rm.py +++ b/deluge/ui/console/cmdline/commands/rm.py @@ -8,6 +8,8 @@ # 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 5d4f8affd..46effd3e5 100644 --- a/deluge/ui/console/cmdline/commands/status.py +++ b/deluge/ui/console/cmdline/commands/status.py @@ -7,6 +7,8 @@ # 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 52e70d8d9..22121151b 100644 --- a/deluge/ui/console/cmdline/commands/update_tracker.py +++ b/deluge/ui/console/cmdline/commands/update_tracker.py @@ -8,6 +8,8 @@ # 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 058202149..84be305d1 100644 --- a/deluge/ui/console/console.py +++ b/deluge/ui/console/console.py @@ -7,7 +7,7 @@ # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import logging import os diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py index e5f565ee4..cce63d662 100644 --- a/deluge/ui/console/main.py +++ b/deluge/ui/console/main.py @@ -8,7 +8,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import locale import logging diff --git a/deluge/ui/console/modes/add_util.py b/deluge/ui/console/modes/add_util.py index fec172777..5782c323d 100644 --- a/deluge/ui/console/modes/add_util.py +++ b/deluge/ui/console/modes/add_util.py @@ -9,6 +9,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import base64 import glob import logging diff --git a/deluge/ui/console/modes/addtorrents.py b/deluge/ui/console/modes/addtorrents.py index 70c202ec8..617bff3d3 100644 --- a/deluge/ui/console/modes/addtorrents.py +++ b/deluge/ui/console/modes/addtorrents.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import base64 import logging import os diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py index eed5f29d2..62b7d6a74 100644 --- a/deluge/ui/console/modes/basemode.py +++ b/deluge/ui/console/modes/basemode.py @@ -8,6 +8,8 @@ # 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 a7392d437..1befb87d2 100644 --- a/deluge/ui/console/modes/cmdline.py +++ b/deluge/ui/console/modes/cmdline.py @@ -8,10 +8,7 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals import logging import os @@ -26,12 +23,14 @@ from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils import colors from deluge.ui.console.utils.format_utils import delete_alt_backspace, remove_formatting, strwidth +try: + import curses +except ImportError: + pass + log = logging.getLogger(__name__) - - LINES_BUFFER_SIZE = 5000 INPUT_HISTORY_SIZE = 500 - MAX_HISTFILE_SIZE = 2000 @@ -106,8 +105,8 @@ class CmdLine(BaseMode, Commander): self.display_lines_offset = 0 # Holds the user input and is cleared on 'enter' - self.input = u'' - self.input_incomplete = u'' + self.input = '' + self.input_incomplete = '' # Keep track of where the cursor is self.input_cursor = 0 @@ -233,8 +232,8 @@ class CmdLine(BaseMode, Commander): else: self.input_history.append(self.input) self.input_history_index = len(self.input_history) - self.input = u'' - self.input_incomplete = u'' + self.input = '' + self.input_incomplete = '' self.input_cursor = 0 self.stdscr.refresh() diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py index 32593e4e5..359e8407b 100644 --- a/deluge/ui/console/modes/connectionmanager.py +++ b/deluge/ui/console/modes/connectionmanager.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import hashlib import logging import time diff --git a/deluge/ui/console/modes/eventview.py b/deluge/ui/console/modes/eventview.py index 534f09ed8..a908058ef 100644 --- a/deluge/ui/console/modes/eventview.py +++ b/deluge/ui/console/modes/eventview.py @@ -7,6 +7,8 @@ # 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 e827d91a3..15d77c4a8 100644 --- a/deluge/ui/console/modes/preferences/__init__.py +++ b/deluge/ui/console/modes/preferences/__init__.py @@ -1,3 +1,5 @@ +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 fbf862b4d..e709f1e20 100644 --- a/deluge/ui/console/modes/preferences/preference_panes.py +++ b/deluge/ui/console/modes/preferences/preference_panes.py @@ -7,6 +7,8 @@ # 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 77adc5db0..d7d0e1557 100644 --- a/deluge/ui/console/modes/preferences/preferences.py +++ b/deluge/ui/console/modes/preferences/preferences.py @@ -7,6 +7,8 @@ # 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 e7bc9e4cb..7bd441869 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging diff --git a/deluge/ui/console/modes/torrentlist/__init__.py b/deluge/ui/console/modes/torrentlist/__init__.py index 2d99252c6..9a41a6636 100644 --- a/deluge/ui/console/modes/torrentlist/__init__.py +++ b/deluge/ui/console/modes/torrentlist/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + class ACTION(object): PAUSE = 'pause' diff --git a/deluge/ui/console/modes/torrentlist/add_torrents_popup.py b/deluge/ui/console/modes/torrentlist/add_torrents_popup.py index 40a726495..44d31f91e 100644 --- a/deluge/ui/console/modes/torrentlist/add_torrents_popup.py +++ b/deluge/ui/console/modes/torrentlist/add_torrents_popup.py @@ -7,6 +7,8 @@ # 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 aff1f826c..62272bfdd 100644 --- a/deluge/ui/console/modes/torrentlist/filtersidebar.py +++ b/deluge/ui/console/modes/torrentlist/filtersidebar.py @@ -7,6 +7,8 @@ # 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 6c9cae62a..dac88e77d 100644 --- a/deluge/ui/console/modes/torrentlist/queue_mode.py +++ b/deluge/ui/console/modes/torrentlist/queue_mode.py @@ -7,10 +7,7 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals from deluge.ui.client import client from deluge.ui.console.utils import curses_util as util @@ -18,12 +15,15 @@ from deluge.ui.console.widgets.popup import MessagePopup, SelectablePopup from . import ACTION +try: + import curses +except ImportError: + pass + key_to_action = {curses.KEY_HOME: ACTION.QUEUE_TOP, curses.KEY_UP: ACTION.QUEUE_UP, curses.KEY_DOWN: ACTION.QUEUE_DOWN, curses.KEY_END: ACTION.QUEUE_BOTTOM} - - QUEUE_MODE_HELP_STR = """ Change queue position of selected torrents diff --git a/deluge/ui/console/modes/torrentlist/search_mode.py b/deluge/ui/console/modes/torrentlist/search_mode.py index 554a254f1..dab353bfd 100644 --- a/deluge/ui/console/modes/torrentlist/search_mode.py +++ b/deluge/ui/console/modes/torrentlist/search_mode.py @@ -7,10 +7,7 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals import logging @@ -19,9 +16,12 @@ from deluge.ui.console.modes.basemode import InputKeyHandler, move_cursor from deluge.ui.console.modes.torrentlist.torrentactions import torrent_actions_popup from deluge.ui.console.utils import curses_util as util +try: + import curses +except ImportError: + pass + log = logging.getLogger(__name__) - - QUEUE_MODE_HELP_STR = """ Change queue position of selected torrents @@ -32,13 +32,11 @@ Change queue position of selected torrents {!info!}'End'{!normal!} - {|indent_pos:|}Move to bottom """ - SEARCH_EMPTY = 0 SEARCH_FAILING = 1 SEARCH_SUCCESS = 2 SEARCH_START_REACHED = 3 SEARCH_END_REACHED = 4 - SEARCH_FORMAT = { SEARCH_EMPTY: '{!black,white!}Search torrents: %s{!black,white!}', SEARCH_SUCCESS: '{!black,white!}Search torrents: {!black,green!}%s{!black,white!}', diff --git a/deluge/ui/console/modes/torrentlist/torrentactions.py b/deluge/ui/console/modes/torrentlist/torrentactions.py index 53bc730b8..d855aaa95 100644 --- a/deluge/ui/console/modes/torrentlist/torrentactions.py +++ b/deluge/ui/console/modes/torrentlist/torrentactions.py @@ -7,6 +7,8 @@ # 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 8c8faa1c5..5fc9bc39a 100644 --- a/deluge/ui/console/modes/torrentlist/torrentlist.py +++ b/deluge/ui/console/modes/torrentlist/torrentlist.py @@ -7,6 +7,8 @@ # 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 dd54e6dfd..30c3f279d 100644 --- a/deluge/ui/console/modes/torrentlist/torrentview.py +++ b/deluge/ui/console/modes/torrentlist/torrentview.py @@ -1,3 +1,4 @@ +from __future__ import unicode_literals import logging @@ -341,7 +342,7 @@ class TorrentView(InputKeyHandler): self.config.save() self.cols_to_show = [col for col in sorted(self.config['torrentview']['columns'], - key=lambda (k): self.config['torrentview']['columns'][k]['order']) + key=lambda k: self.config['torrentview']['columns'][k]['order']) if self.config['torrentview']['columns'][col]['visible']] self.status_fields = get_required_fields(self.cols_to_show) diff --git a/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py b/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py index 6b3855abd..c1f17507a 100644 --- a/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py +++ b/deluge/ui/console/modes/torrentlist/torrentviewcolumns.py @@ -7,6 +7,8 @@ # 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 42138c14c..35477c5bc 100644 --- a/deluge/ui/console/parser.py +++ b/deluge/ui/console/parser.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import print_function +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 c3c5e6c87..50ec6d40c 100644 --- a/deluge/ui/console/utils/colors.py +++ b/deluge/ui/console/utils/colors.py @@ -7,6 +7,8 @@ # 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 8163bdcf8..be4cc9aac 100644 --- a/deluge/ui/console/utils/column.py +++ b/deluge/ui/console/utils/column.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import copy import logging diff --git a/deluge/ui/console/utils/curses_util.py b/deluge/ui/console/utils/curses_util.py index 4c8baafee..804a7cf0b 100644 --- a/deluge/ui/console/utils/curses_util.py +++ b/deluge/ui/console/utils/curses_util.py @@ -7,6 +7,8 @@ # 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 4a26420fc..087a19621 100644 --- a/deluge/ui/console/utils/format_utils.py +++ b/deluge/ui/console/utils/format_utils.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import re from collections import deque from unicodedata import normalize as ud_normalize @@ -81,7 +83,7 @@ def trim_string(string, w, have_dbls): if w <= 0: return '' elif w == 1: - return u' ' + return ' ' elif have_dbls: # have to do this the slow way chrs = [] @@ -97,9 +99,9 @@ def trim_string(string, w, have_dbls): if width != w: chrs.pop() chrs.append('.') - return u'%s ' % (''.join(chrs)) + return '%s ' % (''.join(chrs)) else: - return u'%s ' % (string[0:w - 1]) + return '%s ' % (string[0:w - 1]) def format_column(col, lim): diff --git a/deluge/ui/console/widgets/__init__.py b/deluge/ui/console/widgets/__init__.py index bc88a3b6b..a11e3f2b8 100644 --- a/deluge/ui/console/widgets/__init__.py +++ b/deluge/ui/console/widgets/__init__.py @@ -1,3 +1,5 @@ +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 d34a93815..801e0d06c 100644 --- a/deluge/ui/console/widgets/fields.py +++ b/deluge/ui/console/widgets/fields.py @@ -9,10 +9,7 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals import logging import os @@ -23,6 +20,11 @@ from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils import colors from deluge.ui.console.utils.format_utils import delete_alt_backspace, remove_formatting, wrap_string +try: + import curses +except ImportError: + pass + log = logging.getLogger(__name__) diff --git a/deluge/ui/console/widgets/inputpane.py b/deluge/ui/console/widgets/inputpane.py index 35c680616..e76708f21 100644 --- a/deluge/ui/console/widgets/inputpane.py +++ b/deluge/ui/console/widgets/inputpane.py @@ -9,10 +9,7 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals import logging @@ -23,6 +20,11 @@ from deluge.ui.console.widgets.fields import (CheckedInput, CheckedPlusInput, Co Header, InfoField, IntSpinInput, NoInputField, SelectInput, TextArea, TextField, TextInput) +try: + import curses +except ImportError: + pass + log = logging.getLogger(__name__) diff --git a/deluge/ui/console/widgets/popup.py b/deluge/ui/console/widgets/popup.py index 4f3a12f63..a310fc35c 100644 --- a/deluge/ui/console/widgets/popup.py +++ b/deluge/ui/console/widgets/popup.py @@ -7,10 +7,7 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals import logging @@ -20,6 +17,11 @@ from deluge.ui.console.utils import curses_util as util from deluge.ui.console.utils import format_utils from deluge.ui.console.widgets import BaseInputPane, BaseWindow +try: + import curses +except ImportError: + pass + log = logging.getLogger(__name__) diff --git a/deluge/ui/console/widgets/sidebar.py b/deluge/ui/console/widgets/sidebar.py index ff985f417..410d92216 100644 --- a/deluge/ui/console/widgets/sidebar.py +++ b/deluge/ui/console/widgets/sidebar.py @@ -7,6 +7,8 @@ # 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 5c43fb1d6..81944548d 100644 --- a/deluge/ui/console/widgets/statusbars.py +++ b/deluge/ui/console/widgets/statusbars.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import deluge.common import deluge.component as component from deluge.core.preferencesmanager import DEFAULT_PREFS diff --git a/deluge/ui/console/widgets/window.py b/deluge/ui/console/widgets/window.py index 32355ea39..d868c66fe 100644 --- a/deluge/ui/console/widgets/window.py +++ b/deluge/ui/console/widgets/window.py @@ -9,16 +9,18 @@ # See LICENSE for more details. # -try: - import curses -except ImportError: - pass +from __future__ import unicode_literals import logging from deluge.ui.console.modes.basemode import add_string, mkpad, mkpanel from deluge.ui.console.utils.colors import get_color_pair +try: + import curses +except ImportError: + pass + log = logging.getLogger(__name__) diff --git a/deluge/ui/coreconfig.py b/deluge/ui/coreconfig.py index 2014bb869..0462d098a 100644 --- a/deluge/ui/coreconfig.py +++ b/deluge/ui/coreconfig.py @@ -7,6 +7,8 @@ # 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 08c86a285..baf91b752 100644 --- a/deluge/ui/countries.py +++ b/deluge/ui/countries.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # # countries.py # diff --git a/deluge/ui/gtkui/__init__.py b/deluge/ui/gtkui/__init__.py index 4f64705ee..180419c6a 100644 --- a/deluge/ui/gtkui/__init__.py +++ b/deluge/ui/gtkui/__init__.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from deluge.ui.ui import UI diff --git a/deluge/ui/gtkui/aboutdialog.py b/deluge/ui/gtkui/aboutdialog.py index 42b2d7c2b..c8e44694d 100644 --- a/deluge/ui/gtkui/aboutdialog.py +++ b/deluge/ui/gtkui/aboutdialog.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import gtk import deluge.component as component diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index 7997978d4..06e18f113 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import base64 import logging @@ -284,7 +284,7 @@ class AddTorrentDialog(component.Component): _file, _file['path'], i, _file['download'], split_files ) self.add_files(None, split_files) - self.listview_files.expand_row('0', False) + self.listview_files.expand_row(b'0', False) def prepare_file(self, _file, file_name, file_num, download, files_storage): first_slash_index = file_name.find(os.path.sep) @@ -892,7 +892,7 @@ class AddTorrentDialog(component.Component): # We need to re-expand the view because it might contracted # if we change the root iter - self.listview_files.expand_row('0', False) + self.listview_files.expand_row(b'0', False) else: # This was a simple folder rename without any splits, so just # change the path for itr diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index cd785269f..84b786f35 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -7,6 +7,7 @@ # See LICENSE for more details. # """Common functions for various parts of gtkui to use.""" +from __future__ import unicode_literals import contextlib import cPickle diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index bfc669251..c42c8230a 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import hashlib import logging import os diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index 2fe345f17..f0b4807e9 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import base64 import logging diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index fb2516711..19b1133da 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -7,6 +7,8 @@ # 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/gtkui/dialogs.py b/deluge/ui/gtkui/dialogs.py index 353913808..1738ae72d 100644 --- a/deluge/ui/gtkui/dialogs.py +++ b/deluge/ui/gtkui/dialogs.py @@ -9,6 +9,8 @@ # pylint: disable=super-on-old-class +from __future__ import unicode_literals + import gtk from twisted.internet import defer diff --git a/deluge/ui/gtkui/edittrackersdialog.py b/deluge/ui/gtkui/edittrackersdialog.py index 695df07f6..598156d3e 100644 --- a/deluge/ui/gtkui/edittrackersdialog.py +++ b/deluge/ui/gtkui/edittrackersdialog.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os.path diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 8c5b74e7c..a5ff30665 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import cPickle import logging @@ -360,7 +360,7 @@ class FilesTab(Tab): def update_files(self): with listview_replace_treestore(self.listview): self.prepare_file_store(self.files_list[self.torrent_id]) - self.listview.expand_row('0', False) + self.listview.expand_row(b'0', False) def get_selected_files(self): """Returns a list of file indexes that are selected.""" diff --git a/deluge/ui/gtkui/filtertreeview.py b/deluge/ui/gtkui/filtertreeview.py index 1d478d597..687bb6615 100644 --- a/deluge/ui/gtkui/filtertreeview.py +++ b/deluge/ui/gtkui/filtertreeview.py @@ -9,6 +9,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os import warnings diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 76ba39932..708356cca 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -8,7 +8,7 @@ # # pylint: disable=wrong-import-position -from __future__ import division +from __future__ import division, unicode_literals import logging import os @@ -61,7 +61,7 @@ from deluge.ui.sessionproxy import SessionProxy from deluge.ui.tracker_icons import TrackerIcons from deluge.ui.translations_util import set_language, setup_translations -set_prgname('deluge') +set_prgname(b'deluge') log = logging.getLogger(__name__) try: diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py index cae5195b6..18ab6ae95 100644 --- a/deluge/ui/gtkui/ipcinterface.py +++ b/deluge/ui/gtkui/ipcinterface.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import base64 import logging import os diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index 57adcd1e2..e61162a6f 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import gtk diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py index d95e40acf..00cf093a5 100644 --- a/deluge/ui/gtkui/mainwindow.py +++ b/deluge/ui/gtkui/mainwindow.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import copy import logging import os.path diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index c9188987f..8c0ce69ef 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -9,6 +9,8 @@ # +from __future__ import unicode_literals + import logging import os.path diff --git a/deluge/ui/gtkui/menubar_osx.py b/deluge/ui/gtkui/menubar_osx.py index 689218b03..1512c76ff 100644 --- a/deluge/ui/gtkui/menubar_osx.py +++ b/deluge/ui/gtkui/menubar_osx.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from gtk import ACCEL_VISIBLE, SeparatorMenuItem, accel_groups_from_object from gtk.gdk import CONTROL_MASK, META_MASK, SHIFT_MASK diff --git a/deluge/ui/gtkui/new_release_dialog.py b/deluge/ui/gtkui/new_release_dialog.py index 3de667469..5f2871f2c 100644 --- a/deluge/ui/gtkui/new_release_dialog.py +++ b/deluge/ui/gtkui/new_release_dialog.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import deluge.common import deluge.component as component from deluge.configmanager import ConfigManager diff --git a/deluge/ui/gtkui/options_tab.py b/deluge/ui/gtkui/options_tab.py index 4de41dbe9..5d13b7234 100644 --- a/deluge/ui/gtkui/options_tab.py +++ b/deluge/ui/gtkui/options_tab.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + from gtk.gdk import keyval_name import deluge.component as component diff --git a/deluge/ui/gtkui/path_chooser.py b/deluge/ui/gtkui/path_chooser.py index d0a82be62..7a2874590 100644 --- a/deluge/ui/gtkui/path_chooser.py +++ b/deluge/ui/gtkui/path_chooser.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import deluge.component as component diff --git a/deluge/ui/gtkui/path_combo_chooser.py b/deluge/ui/gtkui/path_combo_chooser.py index 00e948391..b7d73da19 100755 --- a/deluge/ui/gtkui/path_combo_chooser.py +++ b/deluge/ui/gtkui/path_combo_chooser.py @@ -8,7 +8,7 @@ # See LICENSE for more details. # -from __future__ import division, print_function +from __future__ import division, print_function, unicode_literals import os @@ -1004,18 +1004,18 @@ class PathAutoCompleter(object): class PathChooserComboBox(gtk.HBox, StoredValuesPopup, GObject): __gsignals__ = { - 'list-value-added': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'list-value-removed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'list-values-reordered': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'list-values-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'auto-complete-enabled-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'show-filechooser-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'show-path-entry-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'show-folder-name-on-button': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'show-hidden-files-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'accelerator-set': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'max-rows-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), - 'text-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'list-value-added': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'list-value-removed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'list-values-reordered': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'list-values-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'auto-complete-enabled-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'show-filechooser-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'show-path-entry-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'show-folder-name-on-button': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'show-hidden-files-toggled': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'accelerator-set': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'max-rows-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), + b'text-changed': (SIGNAL_RUN_FIRST, TYPE_NONE, (object, )), } def __init__(self, max_visible_rows=20, auto_complete=True, use_completer_popup=True): diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index 7b9f8b3fe..c86195967 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os.path from future_builtins import zip diff --git a/deluge/ui/gtkui/piecesbar.py b/deluge/ui/gtkui/piecesbar.py index c26e2105f..d93229c5f 100644 --- a/deluge/ui/gtkui/piecesbar.py +++ b/deluge/ui/gtkui/piecesbar.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals from math import pi @@ -24,7 +24,7 @@ COLOR_STATES = ['missing', 'waiting', 'downloading', 'completed'] class PiecesBar(DrawingArea): # Draw in response to an expose-event - __gsignals__ = {'expose-event': 'override'} + __gsignals__ = {b'expose-event': b'override'} def __init__(self): DrawingArea.__init__(self) diff --git a/deluge/ui/gtkui/pluginmanager.py b/deluge/ui/gtkui/pluginmanager.py index e65763826..5cabee010 100644 --- a/deluge/ui/gtkui/pluginmanager.py +++ b/deluge/ui/gtkui/pluginmanager.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import deluge.component as component diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index a86a19c0a..7e417f912 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os from hashlib import sha1 as sha @@ -399,7 +401,7 @@ class Preferences(component.Component): # Update the widgets accordingly for key in core_widgets: modifier = core_widgets[key][0] - if isinstance(key, str): + if isinstance(key, basestring): widget = self.builder.get_object(key) else: widget = key @@ -411,7 +413,7 @@ class Preferences(component.Component): from types import FunctionType if isinstance(value, FunctionType): value = value() - elif isinstance(value, str): + elif isinstance(value, basestring): value = self.core_config[value] elif modifier: value = {'active': False, 'not_active': False, 'value': 0, 'text': '', 'path_chooser': ''}[modifier] @@ -431,7 +433,7 @@ class Preferences(component.Component): if self.is_connected: for key in core_widgets: - if isinstance(key, str): + if isinstance(key, basestring): widget = self.builder.get_object(key) else: widget = key diff --git a/deluge/ui/gtkui/queuedtorrents.py b/deluge/ui/gtkui/queuedtorrents.py index 532db7e5c..c48e481a9 100644 --- a/deluge/ui/gtkui/queuedtorrents.py +++ b/deluge/ui/gtkui/queuedtorrents.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os.path diff --git a/deluge/ui/gtkui/removetorrentdialog.py b/deluge/ui/gtkui/removetorrentdialog.py index 2a15f8a0b..7b850dbf5 100644 --- a/deluge/ui/gtkui/removetorrentdialog.py +++ b/deluge/ui/gtkui/removetorrentdialog.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os diff --git a/deluge/ui/gtkui/sidebar.py b/deluge/ui/gtkui/sidebar.py index def712554..103f2ca5a 100644 --- a/deluge/ui/gtkui/sidebar.py +++ b/deluge/ui/gtkui/sidebar.py @@ -8,6 +8,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from gtk import POLICY_AUTOMATIC, Label, ScrolledWindow diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py index 7cee6c007..3d2b995d9 100644 --- a/deluge/ui/gtkui/status_tab.py +++ b/deluge/ui/gtkui/status_tab.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging diff --git a/deluge/ui/gtkui/statusbar.py b/deluge/ui/gtkui/statusbar.py index 834eab92b..030cd2685 100644 --- a/deluge/ui/gtkui/statusbar.py +++ b/deluge/ui/gtkui/statusbar.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import logging diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py index 62ad95216..4d5f80be1 100644 --- a/deluge/ui/gtkui/systemtray.py +++ b/deluge/ui/gtkui/systemtray.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os diff --git a/deluge/ui/gtkui/tab_data_funcs.py b/deluge/ui/gtkui/tab_data_funcs.py index 39f755a2e..49c6f3f01 100644 --- a/deluge/ui/gtkui/tab_data_funcs.py +++ b/deluge/ui/gtkui/tab_data_funcs.py @@ -7,6 +7,8 @@ # 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/gtkui/toolbar.py b/deluge/ui/gtkui/toolbar.py index a9b49a9dc..921779bf7 100644 --- a/deluge/ui/gtkui/toolbar.py +++ b/deluge/ui/gtkui/toolbar.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging from gtk import SeparatorToolItem, ToolButton diff --git a/deluge/ui/gtkui/torrentdetails.py b/deluge/ui/gtkui/torrentdetails.py index 5ca37b2eb..25b9f4bf0 100644 --- a/deluge/ui/gtkui/torrentdetails.py +++ b/deluge/ui/gtkui/torrentdetails.py @@ -9,6 +9,7 @@ """The torrent details component shows info about the selected torrent.""" +from __future__ import unicode_literals import logging diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 16e2d5e12..92f8f73a5 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -8,6 +8,7 @@ # """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/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py index f0a0bbdc5..c591513b6 100644 --- a/deluge/ui/gtkui/torrentview_data_funcs.py +++ b/deluge/ui/gtkui/torrentview_data_funcs.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import warnings from functools import partial diff --git a/deluge/ui/gtkui/trackers_tab.py b/deluge/ui/gtkui/trackers_tab.py index 8d514d164..f8cfdadb0 100644 --- a/deluge/ui/gtkui/trackers_tab.py +++ b/deluge/ui/gtkui/trackers_tab.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import deluge.component as component diff --git a/deluge/ui/languages.py b/deluge/ui/languages.py index 4e606fb87..f41876ca9 100644 --- a/deluge/ui/languages.py +++ b/deluge/ui/languages.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + # # languages.py # diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py index 86606caae..72d60edd4 100644 --- a/deluge/ui/sessionproxy.py +++ b/deluge/ui/sessionproxy.py @@ -6,6 +6,8 @@ # 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 1875b4c7e..7e69d810c 100644 --- a/deluge/ui/tracker_icons.py +++ b/deluge/ui/tracker_icons.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import logging import os from HTMLParser import HTMLParseError, HTMLParser diff --git a/deluge/ui/translations_util.py b/deluge/ui/translations_util.py index cf4feb2ec..6803d55a2 100644 --- a/deluge/ui/translations_util.py +++ b/deluge/ui/translations_util.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import gettext import locale import logging diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py index 07e2dbc11..c1bd16483 100644 --- a/deluge/ui/ui.py +++ b/deluge/ui/ui.py @@ -7,6 +7,8 @@ # 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 cd3a130c8..2d444cef7 100644 --- a/deluge/ui/ui_entry.py +++ b/deluge/ui/ui_entry.py @@ -12,6 +12,7 @@ # user runs the command 'deluge'. """Main starting point for Deluge""" +from __future__ import unicode_literals import argparse import logging diff --git a/deluge/ui/web/__init__.py b/deluge/ui/web/__init__.py index 3757e0b1c..0be7eedb9 100644 --- a/deluge/ui/web/__init__.py +++ b/deluge/ui/web/__init__.py @@ -1,3 +1,5 @@ +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 6e98e579b..1386ae897 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -7,6 +7,8 @@ # 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 ff3abd567..0aa14014b 100644 --- a/deluge/ui/web/common.py +++ b/deluge/ui/web/common.py @@ -7,6 +7,8 @@ # See LICENSE for more details. # +from __future__ import unicode_literals + import gettext import zlib diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 99d823666..9bb5279d3 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import division +from __future__ import division, unicode_literals import base64 import hashlib diff --git a/deluge/ui/web/pluginmanager.py b/deluge/ui/web/pluginmanager.py index e60b3ae8a..278b0c04b 100644 --- a/deluge/ui/web/pluginmanager.py +++ b/deluge/ui/web/pluginmanager.py @@ -7,6 +7,8 @@ # 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 15b807847..faac3201d 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -7,6 +7,8 @@ # 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 38c725aed..2e8327b27 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from __future__ import print_function +from __future__ import print_function, unicode_literals import logging diff --git a/gen_web_gettext.py b/gen_web_gettext.py index c143b90da..9d1b066f4 100755 --- a/gen_web_gettext.py +++ b/gen_web_gettext.py @@ -10,7 +10,7 @@ """Script to parse javascript files for translation strings and generate gettext.js""" -from __future__ import print_function +from __future__ import print_function, unicode_literals import os import re diff --git a/generate_pot.py b/generate_pot.py index 0a871e1e1..6f510ac7e 100755 --- a/generate_pot.py +++ b/generate_pot.py @@ -11,7 +11,7 @@ """Parses Python and Javascript code for translation strings to create the 'deluge.pot' template for translators""" -from __future__ import print_function +from __future__ import print_function, unicode_literals import os import re diff --git a/minify_web_js.py b/minify_web_js.py index 31b98ee33..d9a1643a9 100755 --- a/minify_web_js.py +++ b/minify_web_js.py @@ -15,7 +15,7 @@ Usage: python minify_web_js.py deluge/ui/web/js/deluge-all """ -from __future__ import print_function +from __future__ import print_function, unicode_literals import fileinput import fnmatch diff --git a/version.py b/version.py index e6e3f76fa..3d9a550b4 100755 --- a/version.py +++ b/version.py @@ -31,7 +31,7 @@ # include RELEASE-VERSION # -from __future__ import print_function +from __future__ import print_function, unicode_literals import os from subprocess import PIPE, Popen