From 9d662bf0594e490df4f05537561b77dce01926f3 Mon Sep 17 00:00:00 2001 From: bendikro Date: Thu, 16 Jul 2015 00:09:49 +0200 Subject: [PATCH] [Tests] Fix code for isort 4.0.0 --- deluge/__init__.py | 1 + deluge/plugins/AutoAdd/deluge/__init__.py | 1 + deluge/plugins/AutoAdd/deluge/plugins/__init__.py | 1 + deluge/plugins/Execute/deluge/__init__.py | 1 + deluge/plugins/Execute/deluge/plugins/__init__.py | 1 + deluge/plugins/Extractor/deluge/__init__.py | 1 + deluge/plugins/Extractor/deluge/plugins/__init__.py | 1 + .../plugins/Extractor/deluge/plugins/extractor/gtkui.py | 3 ++- deluge/plugins/Label/deluge/__init__.py | 1 + deluge/plugins/Label/deluge/plugins/__init__.py | 1 + .../plugins/Label/deluge/plugins/label/gtkui/__init__.py | 5 ++--- deluge/plugins/Notifications/deluge/__init__.py | 1 + deluge/plugins/Notifications/deluge/plugins/__init__.py | 1 + deluge/plugins/Scheduler/deluge/__init__.py | 1 + deluge/plugins/Scheduler/deluge/plugins/__init__.py | 1 + deluge/plugins/Stats/deluge/__init__.py | 1 + deluge/plugins/Stats/deluge/plugins/__init__.py | 1 + deluge/plugins/Toggle/deluge/__init__.py | 1 + deluge/plugins/Toggle/deluge/plugins/__init__.py | 1 + deluge/plugins/WebUi/deluge/__init__.py | 1 + deluge/plugins/WebUi/deluge/plugins/__init__.py | 1 + deluge/plugins/__init__.py | 1 + deluge/tests/test_torrentmanager.py | 3 ++- deluge/ui/console/__init__.py | 1 + deluge/ui/gtkui/__init__.py | 1 + deluge/ui/gtkui/gtkui.py | 5 ++++- deluge/ui/web/__init__.py | 1 + setup.cfg | 8 +++++--- setup.py | 3 ++- tox.ini | 2 +- win32/deluge-bbfreeze.py | 6 +++--- 31 files changed, 44 insertions(+), 14 deletions(-) diff --git a/deluge/__init__.py b/deluge/__init__.py index fe92cd136..061e91d9b 100644 --- a/deluge/__init__.py +++ b/deluge/__init__.py @@ -1,4 +1,5 @@ """Deluge""" # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/__init__.py b/deluge/plugins/AutoAdd/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/AutoAdd/deluge/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/__init__.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Execute/deluge/__init__.py b/deluge/plugins/Execute/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Execute/deluge/__init__.py +++ b/deluge/plugins/Execute/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Execute/deluge/plugins/__init__.py b/deluge/plugins/Execute/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Execute/deluge/plugins/__init__.py +++ b/deluge/plugins/Execute/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Extractor/deluge/__init__.py b/deluge/plugins/Extractor/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Extractor/deluge/__init__.py +++ b/deluge/plugins/Extractor/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Extractor/deluge/plugins/__init__.py b/deluge/plugins/Extractor/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Extractor/deluge/plugins/__init__.py +++ b/deluge/plugins/Extractor/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py index 244075dc6..49c989f40 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py @@ -17,10 +17,11 @@ import gtk import gtk.glade import deluge.component as component -from .common import get_resource from deluge.plugins.pluginbase import GtkPluginBase from deluge.ui.client import client +from .common import get_resource + log = logging.getLogger(__name__) diff --git a/deluge/plugins/Label/deluge/__init__.py b/deluge/plugins/Label/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Label/deluge/__init__.py +++ b/deluge/plugins/Label/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Label/deluge/plugins/__init__.py b/deluge/plugins/Label/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Label/deluge/plugins/__init__.py +++ b/deluge/plugins/Label/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py index 95f20cf3d..ce2b4859d 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/__init__.py @@ -8,12 +8,11 @@ # import logging + from deluge import component # for systray from deluge.plugins.pluginbase import GtkPluginBase -from . import sidebar_menu -from . import label_config -from . import submenu +from . import label_config, sidebar_menu, submenu log = logging.getLogger(__name__) diff --git a/deluge/plugins/Notifications/deluge/__init__.py b/deluge/plugins/Notifications/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Notifications/deluge/__init__.py +++ b/deluge/plugins/Notifications/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Notifications/deluge/plugins/__init__.py b/deluge/plugins/Notifications/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Notifications/deluge/plugins/__init__.py +++ b/deluge/plugins/Notifications/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Scheduler/deluge/__init__.py b/deluge/plugins/Scheduler/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Scheduler/deluge/__init__.py +++ b/deluge/plugins/Scheduler/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Scheduler/deluge/plugins/__init__.py b/deluge/plugins/Scheduler/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/__init__.py +++ b/deluge/plugins/Scheduler/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Stats/deluge/__init__.py b/deluge/plugins/Stats/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Stats/deluge/__init__.py +++ b/deluge/plugins/Stats/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Stats/deluge/plugins/__init__.py b/deluge/plugins/Stats/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Stats/deluge/plugins/__init__.py +++ b/deluge/plugins/Stats/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Toggle/deluge/__init__.py b/deluge/plugins/Toggle/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Toggle/deluge/__init__.py +++ b/deluge/plugins/Toggle/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/Toggle/deluge/plugins/__init__.py b/deluge/plugins/Toggle/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/Toggle/deluge/plugins/__init__.py +++ b/deluge/plugins/Toggle/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/WebUi/deluge/__init__.py b/deluge/plugins/WebUi/deluge/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/WebUi/deluge/__init__.py +++ b/deluge/plugins/WebUi/deluge/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/WebUi/deluge/plugins/__init__.py b/deluge/plugins/WebUi/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/WebUi/deluge/plugins/__init__.py +++ b/deluge/plugins/WebUi/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/plugins/__init__.py b/deluge/plugins/__init__.py index 94033e829..30e4998de 100644 --- a/deluge/plugins/__init__.py +++ b/deluge/plugins/__init__.py @@ -1,3 +1,4 @@ # this is a namespace package import pkg_resources + pkg_resources.declare_namespace(__name__) diff --git a/deluge/tests/test_torrentmanager.py b/deluge/tests/test_torrentmanager.py index c2430fcd9..b03c99f89 100644 --- a/deluge/tests/test_torrentmanager.py +++ b/deluge/tests/test_torrentmanager.py @@ -4,12 +4,13 @@ import warnings from twisted.trial import unittest -import common from deluge import component from deluge.core.core import Core from deluge.core.rpcserver import RPCServer from deluge.error import InvalidTorrentError +from . import common + warnings.filterwarnings("ignore", category=RuntimeWarning) warnings.resetwarnings() diff --git a/deluge/ui/console/__init__.py b/deluge/ui/console/__init__.py index f2b4cc5d0..8548bc472 100644 --- a/deluge/ui/console/__init__.py +++ b/deluge/ui/console/__init__.py @@ -9,4 +9,5 @@ UI_PATH = __path__[0] from deluge.ui.console.main import start + assert start # silence pyflakes diff --git a/deluge/ui/gtkui/__init__.py b/deluge/ui/gtkui/__init__.py index 38f3e770c..b7eb0288f 100644 --- a/deluge/ui/gtkui/__init__.py +++ b/deluge/ui/gtkui/__init__.py @@ -1,2 +1,3 @@ from deluge.ui.gtkui.gtkui import start + assert start # silence pyflakes diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index d867b6c4e..41432face 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -6,6 +6,8 @@ # the additional special exception to link portions of this program with the OpenSSL library. # See LICENSE for more details. # +# We skip isorting this file as it want to move the gtk2reactor.install() below the imports +# isort:skip_file import logging import os @@ -18,7 +20,8 @@ from twisted.internet import gtk2reactor from twisted.internet.error import ReactorAlreadyInstalledError try: - reactor = gtk2reactor.install() # Install twisted reactor, before any other modules import reactor. + # Install twisted reactor, before any other modules import reactor. + reactor = gtk2reactor.install() except ReactorAlreadyInstalledError: # Running unit tests so trial already installed a rector pass diff --git a/deluge/ui/web/__init__.py b/deluge/ui/web/__init__.py index a9a714ded..81070096c 100644 --- a/deluge/ui/web/__init__.py +++ b/deluge/ui/web/__init__.py @@ -1,2 +1,3 @@ from deluge.ui.web.web import start + assert start # silence pyflakes diff --git a/setup.cfg b/setup.cfg index 8818ae079..030ef6913 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,8 +15,10 @@ includes = glib, gio, cairo, pango, pangocairo, atk, gobject, gtk.keysyms, frameworks = CoreFoundation, Foundation, AppKit [isort] +default_section=THIRDPARTY known_standard_library=unicodedata -line_length=120 -skip=gtkui.py -known_third_party=pygtk,gtk,gobject,gtk.gdk,pango,cairo,pangocairo,twisted +known_third_party=pygtk,gtk,gobject,gtk.gdk,pango,cairo,pangocairo,twisted,pytest,OpenSSL,pkg_resources,chardet +known_first_party=msgfmt, order_by_type=true +line_length=120 +not_skip=__init__.py diff --git a/setup.py b/setup.py index b216ca385..533becaee 100755 --- a/setup.py +++ b/setup.py @@ -200,9 +200,10 @@ class CleanPlugins(cmd.Command): for path in glob.glob(plugin_path): if os.path.exists(os.path.join(path, "setup.py")): - c = "cd " + path + "&& " + sys.executable + " setup.py clean" + c = "cd " + path + " && " + sys.executable + " setup.py clean" if self.all: c += " -a" + print("Calling '%s'" % c) os.system(c) # Delete the .eggs diff --git a/tox.ini b/tox.ini index 331a6ebd9..eb018d8a4 100644 --- a/tox.ini +++ b/tox.ini @@ -78,7 +78,7 @@ commands = {[testenv:pydef]commands} [testenv:isort] deps = {[testenv]deps} - isort + isort>=4.0.0 whitelist_externals = {[testenv]whitelist_externals} isort diff --git a/win32/deluge-bbfreeze.py b/win32/deluge-bbfreeze.py index a219284ba..4cc01987f 100644 --- a/win32/deluge-bbfreeze.py +++ b/win32/deluge-bbfreeze.py @@ -3,13 +3,13 @@ import os import shutil import sys -import gtk - import bbfreeze.recipes -import deluge.common +import gtk import icon from bbfreeze import Freezer +import deluge.common + # Get build_version from installed deluge build_version = deluge.common.get_version() print "Deluge Version: %s" % build_version