diff --git a/deluge/__rpcapi.py b/deluge/__rpcapi.py index cc6364cc8..c42eb978a 100644 --- a/deluge/__rpcapi.py +++ b/deluge/__rpcapi.py @@ -1,7 +1,9 @@ from new import classobj + from deluge.core.core import Core from deluge.core.daemon import Daemon + class RpcApi: pass @@ -17,4 +19,4 @@ def scan_for_methods(obj): setattr(RpcApi, obj.__name__.lower(), cobj) scan_for_methods(Core) -scan_for_methods(Daemon) \ No newline at end of file +scan_for_methods(Daemon) diff --git a/deluge/bencode.py b/deluge/bencode.py index a17ce918e..77598218c 100644 --- a/deluge/bencode.py +++ b/deluge/bencode.py @@ -75,7 +75,7 @@ def bdecode(x): return r -from types import StringType, IntType, LongType, DictType, ListType, TupleType +from types import DictType, IntType, ListType, LongType, StringType, TupleType class Bencached(object): diff --git a/deluge/common.py b/deluge/common.py index eaf564a31..c7fc06cc7 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -9,20 +9,23 @@ """Common functions for various parts of Deluge to use.""" -import os -import sys -import time -import subprocess -import platform -import chardet -import logging -import pkg_resources +import base64 import gettext import locale -import base64 +import logging +import os +import platform +import subprocess +import sys +import time import urllib import urlparse +import chardet +import pkg_resources + +from deluge.error import InvalidPathError + try: import dbus bus = dbus.SessionBus() @@ -30,7 +33,6 @@ try: except: dbus_fileman = None -from deluge.error import InvalidPathError log = logging.getLogger(__name__) diff --git a/deluge/component.py b/deluge/component.py index 6085db277..f2c1b3c46 100644 --- a/deluge/component.py +++ b/deluge/component.py @@ -35,7 +35,8 @@ import logging from collections import defaultdict -from twisted.internet.defer import maybeDeferred, succeed, DeferredList, fail + +from twisted.internet.defer import DeferredList, fail, maybeDeferred, succeed from twisted.internet.task import LoopingCall log = logging.getLogger(__name__) diff --git a/deluge/config.py b/deluge/config.py index d6a1b6ed3..5ada94f88 100644 --- a/deluge/config.py +++ b/deluge/config.py @@ -68,10 +68,10 @@ version as this will be done internally. """ import cPickle as pickle -import logging -import shutil -import os import json +import logging +import os +import shutil from deluge.common import get_default_config_dir, utf8_encoded diff --git a/deluge/configmanager.py b/deluge/configmanager.py index 0c725661a..519a0f2fb 100644 --- a/deluge/configmanager.py +++ b/deluge/configmanager.py @@ -33,8 +33,8 @@ # # -import os import logging +import os import deluge.common import deluge.log diff --git a/deluge/core/alertmanager.py b/deluge/core/alertmanager.py index 9624429e9..ee745f702 100644 --- a/deluge/core/alertmanager.py +++ b/deluge/core/alertmanager.py @@ -17,6 +17,7 @@ This should typically only be used by the Core. Plugins should utilize the """ import logging + from twisted.internet import reactor import deluge.component as component diff --git a/deluge/core/authmanager.py b/deluge/core/authmanager.py index 6a23c67e0..bed29c970 100644 --- a/deluge/core/authmanager.py +++ b/deluge/core/authmanager.py @@ -8,17 +8,15 @@ # See LICENSE for more details. # +import logging import os import shutil -import logging import deluge.component as component import deluge.configmanager as configmanager -from deluge.common import (AUTH_LEVEL_ADMIN, AUTH_LEVEL_NONE, AUTH_LEVEL_NORMAL, - AUTH_LEVEL_READONLY, AUTH_LEVEL_DEFAULT, - create_localclient_account) - -from deluge.error import AuthManagerError, AuthenticationRequired, BadLoginError +from deluge.common import (AUTH_LEVEL_ADMIN, AUTH_LEVEL_DEFAULT, AUTH_LEVEL_NONE, AUTH_LEVEL_NORMAL, + AUTH_LEVEL_READONLY, create_localclient_account) +from deluge.error import AuthenticationRequired, AuthManagerError, BadLoginError log = logging.getLogger(__name__) diff --git a/deluge/core/core.py b/deluge/core/core.py index 08ddd510b..2512fcff2 100644 --- a/deluge/core/core.py +++ b/deluge/core/core.py @@ -34,38 +34,36 @@ # # -from deluge._libtorrent import lt - -import os -import glob -import shutil import base64 +import glob import logging -import threading +import os +import shutil import tempfile +import threading from urlparse import urljoin import twisted.web.client import twisted.web.error -from deluge.httpdownloader import download_file -from deluge import path_chooser_common - -from deluge.configmanager import ConfigManager, get_config_dir import deluge.common import deluge.component as component -from deluge.event import NewVersionAvailableEvent, SessionPausedEvent, SessionResumedEvent, TorrentQueueChangedEvent -from deluge.error import DelugeError, InvalidTorrentError, InvalidPathError -from deluge.core.authmanager import AUTH_LEVEL_ADMIN, AUTH_LEVEL_NONE -from deluge.core.authmanager import AUTH_LEVELS_MAPPING, AUTH_LEVELS_MAPPING_REVERSE -from deluge.core.torrentmanager import TorrentManager -from deluge.core.pluginmanager import PluginManager +from deluge import path_chooser_common +from deluge._libtorrent import lt +from deluge.configmanager import ConfigManager, get_config_dir from deluge.core.alertmanager import AlertManager -from deluge.core.filtermanager import FilterManager -from deluge.core.preferencesmanager import PreferencesManager -from deluge.core.authmanager import AuthManager +from deluge.core.authmanager import (AUTH_LEVEL_ADMIN, AUTH_LEVEL_NONE, AUTH_LEVELS_MAPPING, + AUTH_LEVELS_MAPPING_REVERSE, AuthManager) from deluge.core.eventmanager import EventManager +from deluge.core.filtermanager import FilterManager +from deluge.core.pluginmanager import PluginManager +from deluge.core.preferencesmanager import PreferencesManager from deluge.core.rpcserver import export +from deluge.core.torrentmanager import TorrentManager +from deluge.error import DelugeError, InvalidPathError, InvalidTorrentError +from deluge.event import (NewVersionAvailableEvent, SessionPausedEvent, SessionResumedEvent, + TorrentQueueChangedEvent) +from deluge.httpdownloader import download_file log = logging.getLogger(__name__) diff --git a/deluge/core/daemon.py b/deluge/core/daemon.py index 3187227ad..7119885cb 100644 --- a/deluge/core/daemon.py +++ b/deluge/core/daemon.py @@ -9,16 +9,17 @@ """The Deluge daemon""" -import os import logging +import os + from twisted.internet import reactor import deluge.component as component +from deluge.common import get_version, is_ip, windows_check from deluge.configmanager import get_config_dir -from deluge.common import get_version, windows_check, is_ip -from deluge.core.rpcserver import RPCServer, export -from deluge.error import DaemonRunningError from deluge.core.core import Core +from deluge.core.rpcserver import export, RPCServer +from deluge.error import DaemonRunningError if windows_check(): from win32api import SetConsoleCtrlHandler diff --git a/deluge/core/eventmanager.py b/deluge/core/eventmanager.py index 0da2c3494..0b5951713 100644 --- a/deluge/core/eventmanager.py +++ b/deluge/core/eventmanager.py @@ -34,6 +34,7 @@ # import logging + import deluge.component as component log = logging.getLogger(__name__) diff --git a/deluge/core/filtermanager.py b/deluge/core/filtermanager.py index ecbd8d1f9..7052155c1 100644 --- a/deluge/core/filtermanager.py +++ b/deluge/core/filtermanager.py @@ -33,8 +33,9 @@ # # -import logging import copy +import logging + import deluge.component as component from deluge.common import TORRENT_STATE diff --git a/deluge/core/pluginmanager.py b/deluge/core/pluginmanager.py index 35ab9857a..b63c0f66d 100644 --- a/deluge/core/pluginmanager.py +++ b/deluge/core/pluginmanager.py @@ -38,9 +38,9 @@ import logging -from deluge.event import PluginEnabledEvent, PluginDisabledEvent -import deluge.pluginmanagerbase import deluge.component as component +import deluge.pluginmanagerbase +from deluge.event import PluginDisabledEvent, PluginEnabledEvent log = logging.getLogger(__name__) diff --git a/deluge/core/preferencesmanager.py b/deluge/core/preferencesmanager.py index efb70b7c4..286e6463e 100644 --- a/deluge/core/preferencesmanager.py +++ b/deluge/core/preferencesmanager.py @@ -34,17 +34,17 @@ # -import os import logging +import os import threading + from twisted.internet.task import LoopingCall -from deluge._libtorrent import lt - -from deluge.event import ConfigValueChangedEvent -import deluge.configmanager import deluge.common import deluge.component as component +import deluge.configmanager +from deluge._libtorrent import lt +from deluge.event import ConfigValueChangedEvent log = logging.getLogger(__name__) diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py index 8f5e25dac..d62ca66d1 100644 --- a/deluge/core/rpcserver.py +++ b/deluge/core/rpcserver.py @@ -35,25 +35,22 @@ """RPCServer Module""" -import sys +import logging import os import stat -import logging +import sys import traceback - -from twisted.internet.protocol import Factory -from twisted.internet import reactor, defer +from types import FunctionType from OpenSSL import crypto, SSL -from types import FunctionType +from twisted.internet import defer, reactor +from twisted.internet.protocol import Factory import deluge.component as component import deluge.configmanager -from deluge.core.authmanager import (AUTH_LEVEL_NONE, AUTH_LEVEL_DEFAULT, - AUTH_LEVEL_ADMIN) -from deluge.error import (DelugeError, NotAuthorizedError, WrappedException, - _ClientSideRecreateError, IncompatibleClient) - +from deluge.core.authmanager import AUTH_LEVEL_ADMIN, AUTH_LEVEL_DEFAULT, AUTH_LEVEL_NONE +from deluge.error import (_ClientSideRecreateError, DelugeError, IncompatibleClient, NotAuthorizedError, + WrappedException) from deluge.transfer import DelugeTransferProtocol RPC_RESPONSE = 1 diff --git a/deluge/core/torrent.py b/deluge/core/torrent.py index 10952b7f7..60efe9cac 100644 --- a/deluge/core/torrent.py +++ b/deluge/core/torrent.py @@ -16,20 +16,20 @@ Attributes: from __future__ import division -import os import logging +import os import socket -from urlparse import urlparse from itertools import izip +from urlparse import urlparse from twisted.internet.defer import Deferred, DeferredList -from deluge._libtorrent import lt import deluge.component as component -from deluge.configmanager import ConfigManager, get_config_dir -from deluge.event import TorrentStateChangedEvent, TorrentFolderRenamedEvent +from deluge._libtorrent import lt from deluge.common import decode_string, utf8_encoded +from deluge.configmanager import ConfigManager, get_config_dir from deluge.core.authmanager import AUTH_LEVEL_ADMIN +from deluge.event import TorrentFolderRenamedEvent, TorrentStateChangedEvent log = logging.getLogger(__name__) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index fb1057172..72164deec 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -10,27 +10,26 @@ """TorrentManager handles Torrent objects""" import cPickle +import logging +import operator import os import shutil -import operator -import logging import time -from twisted.internet.task import LoopingCall -from twisted.internet.defer import Deferred, DeferredList from twisted.internet import reactor +from twisted.internet.defer import Deferred, DeferredList +from twisted.internet.task import LoopingCall -from deluge._libtorrent import lt - -from deluge.event import (TorrentAddedEvent, PreTorrentRemovedEvent, TorrentRemovedEvent, - SessionStartedEvent, TorrentFinishedEvent, TorrentStateChangedEvent, - TorrentResumedEvent, TorrentFileRenamedEvent, TorrentFileCompletedEvent) -from deluge.error import InvalidTorrentError import deluge.component as component +from deluge._libtorrent import lt +from deluge.common import decode_string, get_magnet_info, utf8_encoded from deluge.configmanager import ConfigManager, get_config_dir from deluge.core.authmanager import AUTH_LEVEL_ADMIN -from deluge.core.torrent import Torrent, TorrentOptions, sanitize_filepath -from deluge.common import utf8_encoded, decode_string, get_magnet_info +from deluge.core.torrent import sanitize_filepath, Torrent, TorrentOptions +from deluge.error import InvalidTorrentError +from deluge.event import (PreTorrentRemovedEvent, SessionStartedEvent, TorrentAddedEvent, + TorrentFileCompletedEvent, TorrentFileRenamedEvent, TorrentFinishedEvent, + TorrentRemovedEvent, TorrentResumedEvent, TorrentStateChangedEvent) log = logging.getLogger(__name__) diff --git a/deluge/decorators.py b/deluge/decorators.py index 0ac2c41ca..4352bdbfb 100644 --- a/deluge/decorators.py +++ b/deluge/decorators.py @@ -35,6 +35,7 @@ from functools import wraps + def proxy(proxy_func): """ Factory class which returns a decorator that passes diff --git a/deluge/httpdownloader.py b/deluge/httpdownloader.py index e051b7aa4..10928c2f5 100644 --- a/deluge/httpdownloader.py +++ b/deluge/httpdownloader.py @@ -32,15 +32,17 @@ # statement from all source files in the program, then also delete it here. # -from twisted.web import client, http -from twisted.web.error import PageRedirect -from twisted.python.failure import Failure -from twisted.internet import reactor -from common import get_version import logging import os.path import zlib +from twisted.internet import reactor +from twisted.python.failure import Failure +from twisted.web import client, http +from twisted.web.error import PageRedirect + +from common import get_version + log = logging.getLogger(__name__) class HTTPDownloader(client.HTTPDownloader): diff --git a/deluge/log.py b/deluge/log.py index b66a6fa2e..5bc13d1b8 100644 --- a/deluge/log.py +++ b/deluge/log.py @@ -36,13 +36,15 @@ """Logging functions""" -import os import inspect import logging -from deluge import common +import os + from twisted.internet import defer from twisted.python.log import PythonLoggingObserver +from deluge import common + __all__ = ["setupLogger", "setLoggerLevel", "getPluginLogger", "LOG"] LoggingLoggerClass = logging.getLoggerClass() diff --git a/deluge/main.py b/deluge/main.py index bf98601fe..3444f7a4e 100644 --- a/deluge/main.py +++ b/deluge/main.py @@ -43,14 +43,14 @@ from __future__ import print_function import os import sys -from optparse import OptionParser -from logging import FileHandler, getLogger from errno import EEXIST +from logging import FileHandler, getLogger +from optparse import OptionParser -from deluge.log import setupLogger -import deluge.error import deluge.common import deluge.configmanager +import deluge.error +from deluge.log import setupLogger def version_callback(option, opt_str, value, parser): diff --git a/deluge/maketorrent.py b/deluge/maketorrent.py index 196399df7..f2bc32a3e 100644 --- a/deluge/maketorrent.py +++ b/deluge/maketorrent.py @@ -33,12 +33,13 @@ # # -import sys import os +import sys from hashlib import sha1 as sha -from deluge.common import get_path_size from deluge.bencode import bencode +from deluge.common import get_path_size + class InvalidPath(Exception): """ diff --git a/deluge/metafile.py b/deluge/metafile.py index 9617f0277..3c9e6fd1e 100644 --- a/deluge/metafile.py +++ b/deluge/metafile.py @@ -16,10 +16,10 @@ # Written by Bram Cohen # Modifications for use in Deluge by Andrew Resch 2008 +import logging import os.path import sys import time -import logging from hashlib import sha1 as sha import deluge.component as component diff --git a/deluge/path_chooser_common.py b/deluge/path_chooser_common.py index d92731f0b..bb55e07fb 100644 --- a/deluge/path_chooser_common.py +++ b/deluge/path_chooser_common.py @@ -36,6 +36,7 @@ import os + def get_resource(filename): import deluge return deluge.common.resource_filename("deluge.ui.gtkui", os.path.join("glade", filename)) diff --git a/deluge/pluginmanagerbase.py b/deluge/pluginmanagerbase.py index faea71d0a..d7a424d0b 100644 --- a/deluge/pluginmanagerbase.py +++ b/deluge/pluginmanagerbase.py @@ -36,14 +36,14 @@ """PluginManagerBase""" -import os.path import logging +import os.path + import pkg_resources import deluge.common -import deluge.configmanager - import deluge.component as component +import deluge.configmanager log = logging.getLogger(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py index c87920a27..8053d53bb 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py @@ -13,6 +13,7 @@ # 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 f9568e6f1..c070f0def 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py @@ -13,20 +13,21 @@ # See LICENSE for more details. # -from deluge._libtorrent import lt -import shutil -import os -import logging import base64 +import logging +import os +import shutil + +from twisted.internet import reactor +from twisted.internet.task import deferLater, LoopingCall -from deluge.plugins.pluginbase import CorePluginBase import deluge.component as component import deluge.configmanager +from deluge._libtorrent import lt from deluge.common import AUTH_LEVEL_ADMIN from deluge.core.rpcserver import export -from twisted.internet.task import LoopingCall, deferLater -from twisted.internet import reactor from deluge.event import DelugeEvent +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py index 536d900bd..aa82e669d 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py @@ -12,17 +12,18 @@ # See LICENSE for more details. # -import gtk -import gtk.glade import logging -from deluge.ui.client import client -from deluge.ui.gtkui import dialogs -from deluge.plugins.pluginbase import GtkPluginBase -import deluge.component as component -import deluge.common import os +import gtk +import gtk.glade + +import deluge.common +import deluge.component as component from common import get_resource +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client +from deluge.ui.gtkui import dialogs log = logging.getLogger(__name__) diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py index 2133a05e3..3c45d49b4 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/webui.py @@ -13,9 +13,9 @@ # import logging -from deluge.plugins.pluginbase import WebPluginBase from common import get_resource +from deluge.plugins.pluginbase import WebPluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/AutoAdd/setup.py b/deluge/plugins/AutoAdd/setup.py index 8a5ffb63c..864c46597 100644 --- a/deluge/plugins/AutoAdd/setup.py +++ b/deluge/plugins/AutoAdd/setup.py @@ -13,7 +13,7 @@ # See LICENSE for more details. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "AutoAdd" __author__ = "Chase Sterling, Pedro Algarvio" diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py index 89808c993..437c13819 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py @@ -7,11 +7,12 @@ # See LICENSE for more details. # -import pkg_resources import os.path from functools import wraps from sys import exc_info +import pkg_resources + def get_resource(filename): return pkg_resources.resource_filename("deluge.plugins.blocklist", diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py index 28e7c23bd..aa3c543e7 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/core.py @@ -8,26 +8,26 @@ # See LICENSE for more details. # -import os -import time import logging +import os +import shutil +import time from datetime import datetime, timedelta from email.utils import formatdate from urlparse import urljoin -import shutil +from twisted.internet import defer, threads from twisted.internet.task import LoopingCall -from twisted.internet import threads, defer from twisted.web import error -from deluge.plugins.pluginbase import CorePluginBase import deluge.component as component import deluge.configmanager +from common import BadIP, IP from deluge.common import is_url from deluge.core.rpcserver import export from deluge.httpdownloader import download_file -from common import IP, BadIP -from detect import detect_compression, detect_format, create_reader, UnknownFormatError +from deluge.plugins.pluginbase import CorePluginBase +from detect import create_reader, detect_compression, detect_format, UnknownFormatError from readers import ReaderParseError # TODO: check return values for deferred callbacks diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py index 03e1527f8..b4d4c393a 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/decompressers.py @@ -7,9 +7,9 @@ # See LICENSE for more details. # +import bz2 import gzip import zipfile -import bz2 def Zipped(reader): diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py index cec274e9e..1fc191898 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/detect.py @@ -7,8 +7,8 @@ # See LICENSE for more details. # -from decompressers import Zipped, GZipped, BZipped2 -from readers import EmuleReader, SafePeerReader, PeerGuardianReader +from decompressers import BZipped2, GZipped, Zipped +from readers import EmuleReader, PeerGuardianReader, SafePeerReader COMPRESSION_TYPES = { "PK": "Zip", diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py index 27668cd63..27cf4d8b8 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/gtkui.py @@ -9,14 +9,15 @@ import logging from datetime import datetime + import gtk import gtk.glade -from deluge.ui.client import client -import deluge.component as component -import deluge.common -from deluge.plugins.pluginbase import GtkPluginBase import common +import deluge.common +import deluge.component as component +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py index a807c9d33..dba2dfb2e 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/peerguardian.py @@ -7,11 +7,11 @@ # See LICENSE for more details. # +import gzip import logging +import socket from exceptions import Exception from struct import unpack -import gzip -import socket log = logging.getLogger(__name__) diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py index bea3814a9..22b06618b 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/readers.py @@ -8,9 +8,10 @@ # import logging -from common import raises_errors_as, IP, BadIP import re +from common import BadIP, IP, raises_errors_as + log = logging.getLogger(__name__) diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py index 47407837d..d700164f4 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/webui.py @@ -8,8 +8,9 @@ # import logging -from deluge.plugins.pluginbase import WebPluginBase + from common import get_resource +from deluge.plugins.pluginbase import WebPluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/Blocklist/setup.py b/deluge/plugins/Blocklist/setup.py index 8e2055851..7a8d27d25 100644 --- a/deluge/plugins/Blocklist/setup.py +++ b/deluge/plugins/Blocklist/setup.py @@ -7,7 +7,7 @@ # See LICENSE for more details. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Blocklist" __author__ = "John Garland" diff --git a/deluge/plugins/Execute/deluge/plugins/execute/common.py b/deluge/plugins/Execute/deluge/plugins/execute/common.py index d0d33799c..66bdbb954 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/common.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/common.py @@ -33,9 +33,11 @@ # # -import pkg_resources import os.path +import pkg_resources + + def get_resource(filename): return pkg_resources.resource_filename("deluge.plugins.execute", os.path.join("data", filename)) diff --git a/deluge/plugins/Execute/deluge/plugins/execute/core.py b/deluge/plugins/Execute/deluge/plugins/execute/core.py index 2fdfe5d0c..5010a795a 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/core.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/core.py @@ -33,18 +33,19 @@ # # -import os -import time import hashlib import logging +import os +import time + from twisted.internet.utils import getProcessOutputAndValue -from deluge.plugins.pluginbase import CorePluginBase import deluge.component as component +from deluge.common import utf8_encoded from deluge.configmanager import ConfigManager from deluge.core.rpcserver import export from deluge.event import DelugeEvent -from deluge.common import utf8_encoded +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py b/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py index 1245869ff..7f64735aa 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/gtkui.py @@ -33,16 +33,18 @@ # # -import gtk -import gtk.glade import logging -from deluge.ui.client import client -from deluge.plugins.pluginbase import GtkPluginBase +import gtk +import gtk.glade + import deluge.component as component +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client + +from . import common # Relative import -from . import common log = logging.getLogger(__name__) diff --git a/deluge/plugins/Execute/deluge/plugins/execute/webui.py b/deluge/plugins/Execute/deluge/plugins/execute/webui.py index d0776901d..a58f39a6a 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/webui.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/webui.py @@ -35,11 +35,11 @@ import logging -from deluge.ui.client import client -from deluge import component -from deluge.plugins.pluginbase import WebPluginBase from common import get_resource +from deluge import component +from deluge.plugins.pluginbase import WebPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Execute/setup.py b/deluge/plugins/Execute/setup.py index 660e073dc..ff9b22fe7 100644 --- a/deluge/plugins/Execute/setup.py +++ b/deluge/plugins/Execute/setup.py @@ -31,7 +31,7 @@ # # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Execute" __author__ = "Damien Churchill" diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py index 9a83b84aa..053d8285a 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py @@ -8,6 +8,7 @@ # 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 f10cdbb25..2374b0429 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/core.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/core.py @@ -11,17 +11,17 @@ # See LICENSE for more details. # -import os import logging +import os from twisted.internet.utils import getProcessValue from twisted.python.procutils import which -from deluge.plugins.pluginbase import CorePluginBase import deluge.component as component import deluge.configmanager -from deluge.core.rpcserver import export from deluge.common import windows_check +from deluge.core.rpcserver import export +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py index f70d251cf..c6dfeb113 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/gtkui.py @@ -11,15 +11,15 @@ # See LICENSE for more details. # -import gtk -import gtk.glade import logging -from deluge.ui.client import client -from deluge.plugins.pluginbase import GtkPluginBase -import deluge.component as component +import gtk +import gtk.glade +import deluge.component as component from deluge.plugins.extractor.common import get_resource +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py index 2962abc7c..e36937cef 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/webui.py @@ -12,9 +12,9 @@ # import logging -from deluge.plugins.pluginbase import WebPluginBase from deluge.plugins.extractor.common import get_resource +from deluge.plugins.pluginbase import WebPluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/Extractor/setup.py b/deluge/plugins/Extractor/setup.py index 5398e5146..5bed0a151 100644 --- a/deluge/plugins/Extractor/setup.py +++ b/deluge/plugins/Extractor/setup.py @@ -11,7 +11,7 @@ # See LICENSE for more details. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Extractor" __author__ = "Andrew Resch" diff --git a/deluge/plugins/Label/deluge/plugins/label/core.py b/deluge/plugins/Label/deluge/plugins/label/core.py index 02c8796cc..b95aeadbb 100644 --- a/deluge/plugins/Label/deluge/plugins/label/core.py +++ b/deluge/plugins/Label/deluge/plugins/label/core.py @@ -38,14 +38,14 @@ adds a status field for tracker. """ import logging -from deluge.plugins.pluginbase import CorePluginBase -from deluge.core.rpcserver import export -from deluge.configmanager import ConfigManager -import deluge.component as component +import re +import traceback from urlparse import urlparse -import traceback -import re +import deluge.component as component +from deluge.configmanager import ConfigManager +from deluge.core.rpcserver import export +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) 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 695b2305c..96c5c2d8d 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/label_config.py @@ -33,13 +33,15 @@ # +import logging +import os + import gtk import gtk.glade -import os -import logging -import pkg_resources # access plugin egg -import deluge.component as component +import pkg_resources # access plugin egg + import deluge.common +import deluge.component as component from deluge.ui.client import client log = logging.getLogger(__name__) 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 c7b8375c7..4cee48761 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/sidebar_menu.py @@ -35,12 +35,13 @@ # -import gtk -import gtk.glade import logging -import deluge.component as component +import gtk +import gtk.glade + import deluge.common +import deluge.component as component from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py b/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py index cb08c7f95..61397bb0c 100644 --- a/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py +++ b/deluge/plugins/Label/deluge/plugins/label/gtkui/submenu.py @@ -34,11 +34,14 @@ # -import os import logging -import pkg_resources # access plugin egg -from deluge import component # for systray -import gtk, gobject +import os + +import gobject +import gtk +import pkg_resources # access plugin egg + +from deluge import component # for systray from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Label/deluge/plugins/label/test.py b/deluge/plugins/Label/deluge/plugins/label/test.py index ea6b4582b..c5d039516 100644 --- a/deluge/plugins/Label/deluge/plugins/label/test.py +++ b/deluge/plugins/Label/deluge/plugins/label/test.py @@ -1,4 +1,3 @@ -from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # @@ -32,6 +31,8 @@ from __future__ import print_function # # +from __future__ import print_function + from deluge.ui.client import sclient sclient.set_core_uri() diff --git a/deluge/plugins/Label/deluge/plugins/label/webui.py b/deluge/plugins/Label/deluge/plugins/label/webui.py index 2e16e8d90..2d2e22cf3 100644 --- a/deluge/plugins/Label/deluge/plugins/label/webui.py +++ b/deluge/plugins/Label/deluge/plugins/label/webui.py @@ -37,13 +37,15 @@ # # -import os import logging +import os + import pkg_resources -from deluge.common import fspeed -from deluge.ui.client import client -from deluge.plugins.pluginbase import WebPluginBase + from deluge import component +from deluge.common import fspeed +from deluge.plugins.pluginbase import WebPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Label/setup.py b/deluge/plugins/Label/setup.py index 5ffd3b9ae..45d4d909f 100644 --- a/deluge/plugins/Label/setup.py +++ b/deluge/plugins/Label/setup.py @@ -31,7 +31,7 @@ # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Label" __author__ = "Martijn Voncken" diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py index d23eee875..6a29898ec 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py @@ -38,7 +38,9 @@ # import logging + from twisted.internet import defer + from deluge import component log = logging.getLogger(__name__) @@ -141,4 +143,3 @@ class CustomNotifications(object): def _on_notify_failure(self, failure, kind): log.debug("Notification failure using %s: %s", kind, failure) return failure - diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py index b7f45306f..d87f6ef0d 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py @@ -37,17 +37,18 @@ # statement from all source files in the program, then also delete it here. # -import smtplib import logging +import smtplib from email.utils import formatdate + from twisted.internet import defer, threads + +import deluge.configmanager +from common import CustomNotifications from deluge import component +from deluge.core.rpcserver import export from deluge.event import known_events from deluge.plugins.pluginbase import CorePluginBase -import deluge.configmanager -from deluge.core.rpcserver import export - -from common import CustomNotifications log = logging.getLogger(__name__) diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py index 82ab1dcc2..9c38e9807 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py @@ -39,18 +39,19 @@ import logging from os.path import basename + import gtk import gtk.glade - from twisted.internet import defer -from deluge.ui.client import client -from deluge.plugins.pluginbase import GtkPluginBase -import deluge.component as component + import deluge.common +import deluge.component as component import deluge.configmanager +from common import CustomNotifications, get_resource +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client # Relative imports -from common import get_resource, CustomNotifications log = logging.getLogger(__name__) @@ -710,4 +711,3 @@ class GtkUI(GtkPluginBase, GtkUiNotifications): self.subscriptions_model[path][SUB_NOT_SOUND] = \ not self.subscriptions_model[path][SUB_NOT_SOUND] return - diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/test.py b/deluge/plugins/Notifications/deluge/plugins/notifications/test.py index bb6847c6c..927ea6dfa 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/test.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/test.py @@ -7,7 +7,9 @@ # ============================================================================== import logging + from twisted.internet import task + from deluge import component from deluge.event import DelugeEvent diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py index 217a3233c..724f2a550 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/webui.py @@ -38,10 +38,11 @@ # import logging -from deluge.ui.client import client + +from common import get_resource from deluge import component from deluge.plugins.pluginbase import WebPluginBase -from common import get_resource +from deluge.ui.client import client log = logging.getLogger(__name__) @@ -54,4 +55,4 @@ class WebUI(WebPluginBase): log.debug("Enabling Web UI notifications") def disable(self): - log.debug("Disabling Web UI notifications") \ No newline at end of file + log.debug("Disabling Web UI notifications") diff --git a/deluge/plugins/Notifications/setup.py b/deluge/plugins/Notifications/setup.py index 1cbd9fc3a..6a0c1d1f5 100755 --- a/deluge/plugins/Notifications/setup.py +++ b/deluge/plugins/Notifications/setup.py @@ -37,7 +37,7 @@ # statement from all source files in the program, then also delete it here. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Notifications" __author__ = "Pedro Algarvio" diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py index 356119a1c..a3bf7c5c1 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/core.py @@ -36,15 +36,16 @@ # statement from all source files in the program, then also delete it here. # -import time import logging -from deluge.plugins.pluginbase import CorePluginBase +import time + +from twisted.internet import reactor + import deluge.component as component import deluge.configmanager from deluge.core.rpcserver import export from deluge.event import DelugeEvent - -from twisted.internet import reactor +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py index 24045894b..d0acff142 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/gtkui.py @@ -36,14 +36,15 @@ # statement from all source files in the program, then also delete it here. # -import gtk import logging -from deluge.ui.client import client -from deluge.plugins.pluginbase import GtkPluginBase -import deluge.component as component -import deluge.common +import gtk + +import deluge.common +import deluge.component as component from common import get_resource +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py index eaa22f0f0..bfe9efc34 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/webui.py @@ -37,11 +37,11 @@ # import logging -from deluge.ui.client import client -from deluge import component -from deluge.plugins.pluginbase import WebPluginBase from common import get_resource +from deluge import component +from deluge.plugins.pluginbase import WebPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Scheduler/setup.py b/deluge/plugins/Scheduler/setup.py index f113a1c88..373247a4b 100644 --- a/deluge/plugins/Scheduler/setup.py +++ b/deluge/plugins/Scheduler/setup.py @@ -36,7 +36,7 @@ # statement from all source files in the program, then also delete it here. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Scheduler" __author__ = "Andrew Resch" diff --git a/deluge/plugins/Stats/deluge/plugins/stats/common.py b/deluge/plugins/Stats/deluge/plugins/stats/common.py index c5fd57250..87007f338 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/common.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/common.py @@ -32,8 +32,10 @@ # statement from all source files in the program, then also delete it here. # -import pkg_resources import os.path +import pkg_resources + + def get_resource(filename): return pkg_resources.resource_filename("deluge.plugins.stats", os.path.join("data", filename)) diff --git a/deluge/plugins/Stats/deluge/plugins/stats/core.py b/deluge/plugins/Stats/deluge/plugins/stats/core.py index 33653472e..0c96b2d99 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/core.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/core.py @@ -33,14 +33,14 @@ # but you are not obligated to do so. If you do not wish to do so, delete # this exception statement from your version. If you delete this exception -import time import logging +import time + from twisted.internet.task import LoopingCall -from deluge.plugins.pluginbase import CorePluginBase -from deluge import component -from deluge import configmanager +from deluge import component, configmanager from deluge.core.rpcserver import export +from deluge.plugins.pluginbase import CorePluginBase DEFAULT_PREFS = { "test": "NiNiNi", diff --git a/deluge/plugins/Stats/deluge/plugins/stats/graph.py b/deluge/plugins/Stats/deluge/plugins/stats/graph.py index 76f2e8630..297aa4a39 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/graph.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/graph.py @@ -37,10 +37,12 @@ """ port of old plugin by markybob. """ -import time -import math -import cairo import logging +import math +import time + +import cairo + from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py index 1d5085e1d..5f729e2a1 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/gtkui.py @@ -35,21 +35,21 @@ # but you are not obligated to do so. If you do not wish to do so, delete # this exception statement from your version. If you delete this exception +import logging + +import gobject import gtk import gtk.glade -import gobject -import logging from gtk.glade import XML -import graph +import common import deluge +import graph from deluge import component from deluge.common import fspeed +from deluge.plugins.pluginbase import GtkPluginBase from deluge.ui.client import client from deluge.ui.gtkui.torrentdetails import Tab -from deluge.plugins.pluginbase import GtkPluginBase - -import common log = logging.getLogger(__name__) diff --git a/deluge/plugins/Stats/deluge/plugins/stats/test.py b/deluge/plugins/Stats/deluge/plugins/stats/test.py index 419cc5a2d..8d3531f5a 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/test.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/test.py @@ -1,8 +1,10 @@ from __future__ import print_function -from deluge.ui.client import sclient, aclient -sclient.set_core_uri() -import graph + import deluge +import graph +from deluge.ui.client import aclient, sclient + +sclient.set_core_uri() def test_sync(): if 1: @@ -76,4 +78,4 @@ def test_write(): #test_sync() test_async() test_dht() -#test_write() \ No newline at end of file +#test_write() diff --git a/deluge/plugins/Stats/deluge/plugins/stats/test_total.py b/deluge/plugins/Stats/deluge/plugins/stats/test_total.py index 06cfe189d..37056fe32 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/test_total.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/test_total.py @@ -1,6 +1,8 @@ from __future__ import print_function -from deluge.ui.client import sclient, aclient + from deluge.common import fsize +from deluge.ui.client import aclient, sclient + sclient.set_core_uri() def print_totals(totals): @@ -17,8 +19,3 @@ print_totals(sclient.stats_get_totals()) print("==session totals==") print_totals(sclient.stats_get_session_totals()) - - - - - diff --git a/deluge/plugins/Stats/deluge/plugins/stats/webui.py b/deluge/plugins/Stats/deluge/plugins/stats/webui.py index ebdbeae66..1607f132d 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/webui.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/webui.py @@ -38,11 +38,11 @@ # import logging -from deluge.ui.client import client -from deluge import component -from deluge.plugins.pluginbase import WebPluginBase from common import get_resource +from deluge import component +from deluge.plugins.pluginbase import WebPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Stats/setup.py b/deluge/plugins/Stats/setup.py index c5cf13ce5..f7ccffce0 100644 --- a/deluge/plugins/Stats/setup.py +++ b/deluge/plugins/Stats/setup.py @@ -34,7 +34,7 @@ # but you are not obligated to do so. If you do not wish to do so, delete # this exception statement from your version. If you delete this exception -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Stats" __author__ = "Ian Martin" diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/core.py b/deluge/plugins/Toggle/deluge/plugins/toggle/core.py index c77fad487..206b0cc68 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/core.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/core.py @@ -38,10 +38,11 @@ # import logging -from deluge.plugins.pluginbase import CorePluginBase + import deluge.component as component import deluge.configmanager from deluge.core.rpcserver import export +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py b/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py index 388e547c9..b93d36ce3 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/gtkui.py @@ -37,15 +37,15 @@ # statement from all source files in the program, then also delete it here. # -import gtk import logging -from deluge.ui.client import client -from deluge.plugins.pluginbase import GtkPluginBase -import deluge.component as component -import deluge.common +import gtk +import deluge.common +import deluge.component as component from common import get_resource +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py b/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py index 7605bc868..2e35a2228 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/webui.py @@ -38,11 +38,11 @@ # import logging -from deluge.ui.client import client -from deluge import component -from deluge.plugins.pluginbase import WebPluginBase from common import get_resource +from deluge import component +from deluge.plugins.pluginbase import WebPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/Toggle/setup.py b/deluge/plugins/Toggle/setup.py index 37ef7e12e..22904f483 100644 --- a/deluge/plugins/Toggle/setup.py +++ b/deluge/plugins/Toggle/setup.py @@ -37,7 +37,7 @@ # statement from all source files in the program, then also delete it here. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "Toggle" __author__ = "John Garland" diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/core.py b/deluge/plugins/WebUi/deluge/plugins/webui/core.py index a009f0c5c..12ed5fd7f 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/core.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/core.py @@ -36,12 +36,12 @@ # statement from all source files in the program, then also delete it here. # -import os import logging +import os from deluge import common, component, configmanager -from deluge.plugins.pluginbase import CorePluginBase from deluge.core.rpcserver import export +from deluge.plugins.pluginbase import CorePluginBase log = logging.getLogger(__name__) diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py index c13f0b755..7d947d512 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/gtkui.py @@ -36,16 +36,16 @@ # statement from all source files in the program, then also delete it here. # -import gtk -import gtk.glade import logging -from deluge.ui.client import client -from deluge.plugins.pluginbase import GtkPluginBase -import deluge.component as component -import deluge.common +import gtk +import gtk.glade +import deluge.common +import deluge.component as component from common import get_resource +from deluge.plugins.pluginbase import GtkPluginBase +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/plugins/WebUi/setup.py b/deluge/plugins/WebUi/setup.py index 768263e97..fdf982333 100644 --- a/deluge/plugins/WebUi/setup.py +++ b/deluge/plugins/WebUi/setup.py @@ -36,7 +36,7 @@ # statement from all source files in the program, then also delete it here. # -from setuptools import setup, find_packages +from setuptools import find_packages, setup __plugin_name__ = "WebUi" __author__ = "Damien Churchill" diff --git a/deluge/plugins/pluginbase.py b/deluge/plugins/pluginbase.py index cdabcf6bd..e33d192ba 100644 --- a/deluge/plugins/pluginbase.py +++ b/deluge/plugins/pluginbase.py @@ -34,6 +34,7 @@ # import logging + import deluge.component as component log = logging.getLogger(__name__) diff --git a/deluge/rencode.py b/deluge/rencode.py index 40d93634f..d40983425 100644 --- a/deluge/rencode.py +++ b/deluge/rencode.py @@ -64,6 +64,8 @@ __all__ = ['dumps', 'loads'] import struct from threading import Lock +from types import (DictType, FloatType, IntType, ListType, LongType, NoneType, StringType, TupleType, + UnicodeType) # Default number of bits for serialized floats, either 32 or 64 (also a parameter for dumps()). DEFAULT_FLOAT_BITS = 32 @@ -295,7 +297,6 @@ def loads(x, decode_utf8=False): raise ValueError return r -from types import StringType, IntType, LongType, DictType, ListType, TupleType, FloatType, NoneType, UnicodeType def encode_int(x, r): diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index 5bb7964e2..fd8e1ccf8 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -8,11 +8,13 @@ python create_plugin.py --name MyPlugin2 --basepath . --author-name "Your Name" """ from __future__ import print_function -from datetime import datetime -from optparse import OptionParser import os import sys +from datetime import datetime +from optparse import OptionParser + import deluge.common + parser = OptionParser() parser.add_option("-n", "--name", dest="name", help="plugin name") parser.add_option("-m", "--module-name", dest="module", help="plugin name") diff --git a/deluge/scripts/deluge_remote.py b/deluge/scripts/deluge_remote.py index cc6f864d5..4bb457cea 100644 --- a/deluge/scripts/deluge_remote.py +++ b/deluge/scripts/deluge_remote.py @@ -11,10 +11,10 @@ # # Authour: Garett Harnish -from sys import argv, exit, stderr -from optparse import OptionParser - import logging +from optparse import OptionParser +from sys import argv, exit, stderr + def isFloatDigit (string): if string.isdigit(): diff --git a/deluge/scripts/wiki_docgen.py b/deluge/scripts/wiki_docgen.py index fbfec8f1d..e23bad6f9 100644 --- a/deluge/scripts/wiki_docgen.py +++ b/deluge/scripts/wiki_docgen.py @@ -1,4 +1,3 @@ -from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # @@ -37,11 +36,15 @@ from __future__ import print_function #client doc's For core. # +from __future__ import print_function + +import inspect +import pydoc +import textwrap + from deluge.core.core import Core from deluge.ui.client import aclient, sclient -import pydoc -import inspect -import textwrap + sclient.set_core_uri() print("\n\n") diff --git a/deluge/tests/common.py b/deluge/tests/common.py index be4441de9..9b7d3b2a3 100644 --- a/deluge/tests/common.py +++ b/deluge/tests/common.py @@ -1,13 +1,14 @@ import os import sys -import time import tempfile -from subprocess import Popen, PIPE +import time +from subprocess import PIPE, Popen + +from twisted.internet.error import CannotListenError import deluge.common import deluge.configmanager import deluge.log -from twisted.internet.error import CannotListenError deluge.log.setupLogger("none") diff --git a/deluge/tests/test_authmanager.py b/deluge/tests/test_authmanager.py index d88721a32..807130df5 100644 --- a/deluge/tests/test_authmanager.py +++ b/deluge/tests/test_authmanager.py @@ -1,6 +1,6 @@ from twisted.trial import unittest -from deluge.core.authmanager import AuthManager, AUTH_LEVEL_ADMIN +from deluge.core.authmanager import AUTH_LEVEL_ADMIN, AuthManager class AuthManagerTestCase(unittest.TestCase): diff --git a/deluge/tests/test_client.py b/deluge/tests/test_client.py index 6e94f0259..0f90d1094 100644 --- a/deluge/tests/test_client.py +++ b/deluge/tests/test_client.py @@ -1,11 +1,11 @@ from twisted.internet import defer +from twisted.internet.error import CannotListenError from twisted.trial import unittest import deluge.tests.common as common -from twisted.internet.error import CannotListenError from deluge import error from deluge.core.authmanager import AUTH_LEVEL_ADMIN -from deluge.ui.client import client, Client, DaemonSSLProxy +from deluge.ui.client import Client, client, DaemonSSLProxy class NoVersionSendingDaemonSSLProxy(DaemonSSLProxy): diff --git a/deluge/tests/test_common.py b/deluge/tests/test_common.py index c693c4b98..2efb7cd8f 100644 --- a/deluge/tests/test_common.py +++ b/deluge/tests/test_common.py @@ -1,7 +1,9 @@ import os + from twisted.trial import unittest -from deluge.common import (setup_translations, VersionSplit, fsize, fpcnt, fspeed, fpeer, - ftime, fdate, is_url, is_magnet, get_path_size, is_ip) + +from deluge.common import (fdate, fpcnt, fpeer, fsize, fspeed, ftime, get_path_size, is_ip, is_magnet, is_url, + setup_translations, VersionSplit) class CommonTestCase(unittest.TestCase): diff --git a/deluge/tests/test_component.py b/deluge/tests/test_component.py index b35580ef7..3e79ce6e7 100644 --- a/deluge/tests/test_component.py +++ b/deluge/tests/test_component.py @@ -1,5 +1,6 @@ -from twisted.trial import unittest from twisted.internet import threads +from twisted.trial import unittest + import deluge.component as component diff --git a/deluge/tests/test_config.py b/deluge/tests/test_config.py index 222c88e69..7d79a0d63 100644 --- a/deluge/tests/test_config.py +++ b/deluge/tests/test_config.py @@ -1,11 +1,13 @@ # -*- coding: utf-8 -*- import os -from twisted.trial import unittest + from twisted.internet import task -from deluge.tests.common import set_tmp_config_dir -from deluge.config import Config +from twisted.trial import unittest + import deluge.config +from deluge.config import Config +from deluge.tests.common import set_tmp_config_dir DEFAULTS = {"string": "foobar", "int": 1, "float": 0.435, "bool": True, "unicode": u"foobar"} diff --git a/deluge/tests/test_core.py b/deluge/tests/test_core.py index 0ef85c60b..9edf3a275 100644 --- a/deluge/tests/test_core.py +++ b/deluge/tests/test_core.py @@ -2,23 +2,24 @@ import os import warnings from hashlib import sha1 as sha -from twisted.trial import unittest from twisted.internet import reactor +from twisted.internet.error import CannotListenError from twisted.python.failure import Failure +from twisted.trial import unittest from twisted.web.http import FORBIDDEN from twisted.web.resource import Resource from twisted.web.server import Site from twisted.web.static import File -from twisted.internet.error import CannotListenError -import deluge.tests.common as common -from deluge.core.rpcserver import RPCServer -from deluge.core.core import Core -warnings.filterwarnings("ignore", category=RuntimeWarning) -from deluge.ui.web.common import compress -warnings.resetwarnings() import deluge.component as component import deluge.error +import deluge.tests.common as common +from deluge.core.core import Core +from deluge.core.rpcserver import RPCServer +from deluge.ui.web.common import compress + +warnings.filterwarnings("ignore", category=RuntimeWarning) +warnings.resetwarnings() rpath = common.rpath diff --git a/deluge/tests/test_error.py b/deluge/tests/test_error.py index 1a57d1272..a84b266fb 100644 --- a/deluge/tests/test_error.py +++ b/deluge/tests/test_error.py @@ -1,4 +1,5 @@ from twisted.trial import unittest + import deluge.error diff --git a/deluge/tests/test_httpdownloader.py b/deluge/tests/test_httpdownloader.py index b67e7ab9f..4deb708dd 100644 --- a/deluge/tests/test_httpdownloader.py +++ b/deluge/tests/test_httpdownloader.py @@ -1,27 +1,29 @@ import warnings +from email.utils import formatdate -from twisted.trial import unittest from twisted.internet import reactor -from twisted.python.failure import Failure from twisted.internet.error import CannotListenError +from twisted.python.failure import Failure +from twisted.trial import unittest from twisted.web.http import NOT_MODIFIED +from twisted.web.server import Site + +import deluge.tests.common as common +from deluge.httpdownloader import download_file +from deluge.log import setupLogger +from deluge.ui.web.common import compress + try: from twisted.web.resource import Resource except ImportError: # twisted 8 from twisted.web.error import Resource -from twisted.web.server import Site -from deluge.httpdownloader import download_file -from deluge.log import setupLogger warnings.filterwarnings("ignore", category=RuntimeWarning) -from deluge.ui.web.common import compress warnings.resetwarnings() -from email.utils import formatdate -import deluge.tests.common as common rpath = common.rpath diff --git a/deluge/tests/test_log.py b/deluge/tests/test_log.py index b35563075..7a7718954 100644 --- a/deluge/tests/test_log.py +++ b/deluge/tests/test_log.py @@ -1,6 +1,8 @@ import logging + from twisted.internet import defer from twisted.trial import unittest + from deluge.log import setupLogger diff --git a/deluge/tests/test_maketorrent.py b/deluge/tests/test_maketorrent.py index 0631eb68b..8c13a4984 100644 --- a/deluge/tests/test_maketorrent.py +++ b/deluge/tests/test_maketorrent.py @@ -1,7 +1,8 @@ -from twisted.trial import unittest import os import tempfile +from twisted.trial import unittest + from deluge import maketorrent diff --git a/deluge/tests/test_plugin_metadata.py b/deluge/tests/test_plugin_metadata.py index c24ef72ea..d4c9932d3 100644 --- a/deluge/tests/test_plugin_metadata.py +++ b/deluge/tests/test_plugin_metadata.py @@ -1,5 +1,7 @@ from __future__ import print_function + import deluge.pluginmanagerbase + pm = deluge.pluginmanagerbase.PluginManagerBase("core.conf", "deluge.plugin.core") for p in pm.get_available_plugins(): diff --git a/deluge/tests/test_rpcserver.py b/deluge/tests/test_rpcserver.py index cb26d9603..459e1adf0 100644 --- a/deluge/tests/test_rpcserver.py +++ b/deluge/tests/test_rpcserver.py @@ -35,17 +35,16 @@ import os -from twisted.trial import unittest from twisted.python import log +from twisted.trial import unittest import deluge.component as component import deluge.error from deluge.core import rpcserver -from deluge.ui.common import get_localhost_auth from deluge.core.authmanager import AuthManager -from deluge.core.rpcserver import RPCServer, DelugeRPCProtocol - +from deluge.core.rpcserver import DelugeRPCProtocol, RPCServer from deluge.log import setupLogger +from deluge.ui.common import get_localhost_auth setupLogger("none") diff --git a/deluge/tests/test_sessionproxy.py b/deluge/tests/test_sessionproxy.py index d5afdbf1c..20ef29ab8 100644 --- a/deluge/tests/test_sessionproxy.py +++ b/deluge/tests/test_sessionproxy.py @@ -1,8 +1,10 @@ import time -from twisted.trial import unittest + from twisted.internet.defer import maybeDeferred, succeed -import deluge.ui.sessionproxy +from twisted.trial import unittest + import deluge.component as component +import deluge.ui.sessionproxy class Core(object): diff --git a/deluge/tests/test_torrent.py b/deluge/tests/test_torrent.py index f029eaf08..699a04f92 100644 --- a/deluge/tests/test_torrent.py +++ b/deluge/tests/test_torrent.py @@ -1,16 +1,16 @@ from __future__ import print_function -from twisted.trial import unittest + import os -import deluge.core.torrent -import test_torrent -import deluge.tests.common as common -from deluge.core.rpcserver import RPCServer -from deluge.core.core import Core - -from deluge._libtorrent import lt +from twisted.trial import unittest import deluge.component as component +import deluge.core.torrent +import deluge.tests.common as common +import test_torrent +from deluge._libtorrent import lt +from deluge.core.core import Core +from deluge.core.rpcserver import RPCServer from deluge.core.torrent import Torrent config_setup = False diff --git a/deluge/tests/test_tracker_icons.py b/deluge/tests/test_tracker_icons.py index cc9492fcd..794dfa3fb 100644 --- a/deluge/tests/test_tracker_icons.py +++ b/deluge/tests/test_tracker_icons.py @@ -1,14 +1,16 @@ import os + from twisted.trial import unittest -from deluge.ui.tracker_icons import TrackerIcons, TrackerIcon + +import deluge.ui.tracker_icons from deluge.tests.common import set_tmp_config_dir +from deluge.ui.tracker_icons import TrackerIcon, TrackerIcons set_tmp_config_dir() icons = TrackerIcons() dirname = os.path.dirname(__file__) -import deluge.ui.tracker_icons deluge.ui.tracker_icons.PIL_INSTALLED = False diff --git a/deluge/tests/test_transfer.py b/deluge/tests/test_transfer.py index be9d3904b..9cb1fbd7e 100644 --- a/deluge/tests/test_transfer.py +++ b/deluge/tests/test_transfer.py @@ -1,4 +1,3 @@ -from __future__ import print_function # -*- coding: utf-8 -*- # # test_transfer.py @@ -34,14 +33,19 @@ from __future__ import print_function # statement from all source files in the program, then also delete it here. # +from __future__ import print_function + import base64 + from twisted.trial import unittest + +import deluge.log import deluge.rencode as rencode from deluge.transfer import DelugeTransferProtocol -import deluge.log deluge.log.setupLogger("none") + class TransferTestClass(DelugeTransferProtocol): def __init__(self): diff --git a/deluge/tests/test_ui_common.py b/deluge/tests/test_ui_common.py index 1bd3803b5..a1934a47f 100644 --- a/deluge/tests/test_ui_common.py +++ b/deluge/tests/test_ui_common.py @@ -1,6 +1,8 @@ # -*- coding: utf-8 -*- -from twisted.trial import unittest import os.path + +from twisted.trial import unittest + from deluge.ui.common import TorrentInfo diff --git a/deluge/transfer.py b/deluge/transfer.py index bf5ec0ad4..8d7fe85dc 100644 --- a/deluge/transfer.py +++ b/deluge/transfer.py @@ -39,9 +39,9 @@ try: except ImportError: import deluge.rencode as rencode -import zlib -import struct import logging +import struct +import zlib from twisted.internet.protocol import Protocol diff --git a/deluge/ui/Win32IconImagePlugin.py b/deluge/ui/Win32IconImagePlugin.py index 3f6c77119..ae6c6c3e7 100644 --- a/deluge/ui/Win32IconImagePlugin.py +++ b/deluge/ui/Win32IconImagePlugin.py @@ -46,13 +46,13 @@ Example icon to test with `down.ico`_ import logging import struct + +import PIL.BmpImagePlugin import PIL.Image import PIL.ImageChops import PIL.ImageFile -import PIL.BmpImagePlugin import PIL.PngImagePlugin - _MAGIC = '\0\0\1\0' log = logging.getLogger(__name__) diff --git a/deluge/ui/client.py b/deluge/ui/client.py index f858b4b96..9472e0349 100644 --- a/deluge/ui/client.py +++ b/deluge/ui/client.py @@ -35,10 +35,11 @@ # import logging -from twisted.internet.protocol import ClientFactory -from twisted.internet import reactor, ssl, defer -import sys import subprocess +import sys + +from twisted.internet import defer, reactor, ssl +from twisted.internet.protocol import ClientFactory import deluge.common from deluge import error diff --git a/deluge/ui/common.py b/deluge/ui/common.py index 6722550b7..97755837d 100644 --- a/deluge/ui/common.py +++ b/deluge/ui/common.py @@ -38,13 +38,13 @@ The ui common module contains methods and classes that are deemed useful for all the interfaces. """ -import os import logging +import os from hashlib import sha1 as sha -from deluge import bencode -from deluge.common import utf8_encoded, path_join import deluge.configmanager +from deluge import bencode +from deluge.common import path_join, utf8_encoded log = logging.getLogger(__name__) diff --git a/deluge/ui/console/commander.py b/deluge/ui/console/commander.py index 676615ccd..942932140 100644 --- a/deluge/ui/console/commander.py +++ b/deluge/ui/console/commander.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # commander.py # @@ -35,14 +34,19 @@ from __future__ import print_function # statement from all source files in the program, then also delete it here. # # -import sys -from twisted.internet import defer -import deluge.component as component -from deluge.error import DelugeError -from deluge.ui.client import client -from colors import strip_colors + +from __future__ import print_function import logging +import sys + +from twisted.internet import defer + +import deluge.component as component +from colors import strip_colors +from deluge.error import DelugeError +from deluge.ui.client import client + log = logging.getLogger(__name__) diff --git a/deluge/ui/console/commands/add.py b/deluge/ui/console/commands/add.py index e684a959d..3b3db9214 100644 --- a/deluge/ui/console/commands/add.py +++ b/deluge/ui/console/commands/add.py @@ -8,19 +8,19 @@ # See LICENSE for more details. # -from twisted.internet import defer - -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.component as component -import deluge.common - -from optparse import make_option -import os import base64 +import os +from optparse import make_option from urllib import url2pathname from urlparse import urlparse +from twisted.internet import defer + +import deluge.common +import deluge.component as component +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Add a torrent""" diff --git a/deluge/ui/console/commands/cache.py b/deluge/ui/console/commands/cache.py index 92c016d9f..d101c6ed6 100644 --- a/deluge/ui/console/commands/cache.py +++ b/deluge/ui/console/commands/cache.py @@ -32,10 +32,11 @@ # statement from all source files in the program, then also delete it here. # -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.ui.console.colors as colors import deluge.component as component +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Show information about the disk cache""" diff --git a/deluge/ui/console/commands/config.py b/deluge/ui/console/commands/config.py index b72092c5f..99cafbe2f 100644 --- a/deluge/ui/console/commands/config.py +++ b/deluge/ui/console/commands/config.py @@ -34,18 +34,18 @@ # # -import re -import logging -import tokenize import cStringIO +import logging +import re +import tokenize from optparse import make_option from twisted.internet import defer -from deluge.ui.console.main import BaseCommand +import deluge.component as component import deluge.ui.console.colors as colors from deluge.ui.client import client -import deluge.component as component +from deluge.ui.console.main import BaseCommand log = logging.getLogger(__name__) diff --git a/deluge/ui/console/commands/connect.py b/deluge/ui/console/commands/connect.py index da3922ee7..f969c269b 100644 --- a/deluge/ui/console/commands/connect.py +++ b/deluge/ui/console/commands/connect.py @@ -33,10 +33,11 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.console.main import BaseCommand +import deluge.component as component import deluge.ui.console.colors as colors from deluge.ui.client import client -import deluge.component as component +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Connect to a new deluge server.""" diff --git a/deluge/ui/console/commands/debug.py b/deluge/ui/console/commands/debug.py index 40e87eda2..5fa409058 100644 --- a/deluge/ui/console/commands/debug.py +++ b/deluge/ui/console/commands/debug.py @@ -36,11 +36,12 @@ from twisted.internet import defer -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.ui.console.colors as colors -import deluge.log import deluge.component as component +import deluge.log +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Enable and disable debugging""" diff --git a/deluge/ui/console/commands/gui.py b/deluge/ui/console/commands/gui.py index 320f485be..7021da3a6 100644 --- a/deluge/ui/console/commands/gui.py +++ b/deluge/ui/console/commands/gui.py @@ -32,11 +32,12 @@ # statement from all source files in the program, then also delete it here. # -from deluge.ui.console.main import BaseCommand import deluge.common import deluge.component as component +from deluge.ui.console.main import BaseCommand from deluge.ui.console.modes.alltorrents import AllTorrents + class Command(BaseCommand): """Exit this mode and go into the more 'gui' like mode""" usage = "Usage: gui" diff --git a/deluge/ui/console/commands/halt.py b/deluge/ui/console/commands/halt.py index c79eee58d..0bd9708ad 100644 --- a/deluge/ui/console/commands/halt.py +++ b/deluge/ui/console/commands/halt.py @@ -33,10 +33,11 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.console.main import BaseCommand +import deluge.component as component import deluge.ui.console.colors as colors from deluge.ui.client import client -import deluge.component as component +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): "Shutdown the deluge server" diff --git a/deluge/ui/console/commands/help.py b/deluge/ui/console/commands/help.py index de8cc63b7..9e7eff4b4 100644 --- a/deluge/ui/console/commands/help.py +++ b/deluge/ui/console/commands/help.py @@ -35,9 +35,10 @@ from twisted.internet import defer -from deluge.ui.console.main import BaseCommand -import deluge.ui.console.colors as colors import deluge.component as component +import deluge.ui.console.colors as colors +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """displays help on other commands""" diff --git a/deluge/ui/console/commands/info.py b/deluge/ui/console/commands/info.py index 5282ef68a..7242eff00 100644 --- a/deluge/ui/console/commands/info.py +++ b/deluge/ui/console/commands/info.py @@ -35,17 +35,17 @@ # from optparse import make_option +from os.path import sep as dirsep -from deluge.ui.console.main import BaseCommand -import deluge.ui.console.colors as colors -from deluge.ui.client import client import deluge.common as common import deluge.component as component - +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand from deluge.ui.console.modes import format_utils + strwidth = format_utils.strwidth -from os.path import sep as dirsep STATUS_KEYS = ["state", "download_location", diff --git a/deluge/ui/console/commands/manage.py b/deluge/ui/console/commands/manage.py index ef66829d4..a026c762a 100644 --- a/deluge/ui/console/commands/manage.py +++ b/deluge/ui/console/commands/manage.py @@ -35,17 +35,16 @@ # # -from twisted.internet import defer - -from deluge.ui.console.main import BaseCommand -import deluge.ui.console.colors as colors -from deluge.ui.client import client -import deluge.component as component -from deluge.log import LOG as log - +import re from optparse import make_option -import re +from twisted.internet import defer + +import deluge.component as component +import deluge.ui.console.colors as colors +from deluge.log import LOG as log +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand torrent_options = { "max_download_speed": float, @@ -153,4 +152,4 @@ class Command(BaseCommand): def complete(self, line): # We use the ConsoleUI torrent tab complete method - return component.get("ConsoleUI").tab_complete_torrent(line) \ No newline at end of file + return component.get("ConsoleUI").tab_complete_torrent(line) diff --git a/deluge/ui/console/commands/move.py b/deluge/ui/console/commands/move.py index 90cca8584..6a6f75522 100644 --- a/deluge/ui/console/commands/move.py +++ b/deluge/ui/console/commands/move.py @@ -33,12 +33,12 @@ # # -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.component as component - import os.path +import deluge.component as component +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Move torrents' storage location""" diff --git a/deluge/ui/console/commands/pause.py b/deluge/ui/console/commands/pause.py index 47f39a5a0..04c0f2347 100644 --- a/deluge/ui/console/commands/pause.py +++ b/deluge/ui/console/commands/pause.py @@ -33,10 +33,11 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.ui.console.colors as colors import deluge.component as component +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Pause a torrent""" diff --git a/deluge/ui/console/commands/plugin.py b/deluge/ui/console/commands/plugin.py index 930355dc5..c5af8b55e 100644 --- a/deluge/ui/console/commands/plugin.py +++ b/deluge/ui/console/commands/plugin.py @@ -32,15 +32,15 @@ # statement from all source files in the program, then also delete it here. # # +import re from optparse import make_option -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.ui.console.colors as colors import deluge.component as component import deluge.configmanager +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand -import re class Command(BaseCommand): """Manage plugins with this command""" diff --git a/deluge/ui/console/commands/quit.py b/deluge/ui/console/commands/quit.py index 210b9a64d..09da2fe2b 100644 --- a/deluge/ui/console/commands/quit.py +++ b/deluge/ui/console/commands/quit.py @@ -33,9 +33,11 @@ # statement from all source files in the program, then also delete it here. # # +from twisted.internet import error, reactor + from deluge.ui.client import client from deluge.ui.console.main import BaseCommand -from twisted.internet import reactor, error + class Command(BaseCommand): """Exit from the client.""" diff --git a/deluge/ui/console/commands/recheck.py b/deluge/ui/console/commands/recheck.py index 2e9cc75f1..f5c9d7564 100644 --- a/deluge/ui/console/commands/recheck.py +++ b/deluge/ui/console/commands/recheck.py @@ -32,10 +32,11 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.ui.console.colors as colors import deluge.component as component +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Forces a recheck of the torrent data""" diff --git a/deluge/ui/console/commands/resume.py b/deluge/ui/console/commands/resume.py index da9036240..6b9faf8a9 100644 --- a/deluge/ui/console/commands/resume.py +++ b/deluge/ui/console/commands/resume.py @@ -34,10 +34,11 @@ # # -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -import deluge.ui.console.colors as colors import deluge.component as component +import deluge.ui.console.colors as colors +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand + class Command(BaseCommand): """Resume a torrent""" diff --git a/deluge/ui/console/commands/rm.py b/deluge/ui/console/commands/rm.py index 378a78d5c..f438a219b 100644 --- a/deluge/ui/console/commands/rm.py +++ b/deluge/ui/console/commands/rm.py @@ -33,12 +33,12 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.console.main import BaseCommand +from optparse import make_option + +import deluge.component as component import deluge.ui.console.colors as colors from deluge.ui.client import client -import deluge.component as component - -from optparse import make_option +from deluge.ui.console.main import BaseCommand class Command(BaseCommand): diff --git a/deluge/ui/console/commands/status.py b/deluge/ui/console/commands/status.py index b5767ed1f..122a3cdb9 100644 --- a/deluge/ui/console/commands/status.py +++ b/deluge/ui/console/commands/status.py @@ -33,11 +33,13 @@ # from optparse import make_option + from twisted.internet import defer -from deluge.ui.console.main import BaseCommand -from deluge.ui.client import client -from deluge.common import fspeed, TORRENT_STATE + import deluge.component as component +from deluge.common import fspeed, TORRENT_STATE +from deluge.ui.client import client +from deluge.ui.console.main import BaseCommand class Command(BaseCommand): diff --git a/deluge/ui/console/commands/update_tracker.py b/deluge/ui/console/commands/update_tracker.py index 897ddc31a..487fc1b8e 100644 --- a/deluge/ui/console/commands/update_tracker.py +++ b/deluge/ui/console/commands/update_tracker.py @@ -33,12 +33,12 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.console.main import BaseCommand +from optparse import make_option + +import deluge.component as component import deluge.ui.console.colors as colors from deluge.ui.client import client -import deluge.component as component - -from optparse import make_option +from deluge.ui.console.main import BaseCommand class Command(BaseCommand): diff --git a/deluge/ui/console/eventlog.py b/deluge/ui/console/eventlog.py index 6120cd804..621dfe33f 100644 --- a/deluge/ui/console/eventlog.py +++ b/deluge/ui/console/eventlog.py @@ -35,13 +35,13 @@ import logging +import time + +import colors import deluge.component as component from deluge.common import windows_check -import colors from deluge.ui.client import client -import time - log = logging.getLogger(__name__) diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py index 5ce8eb1ec..7d3d2546c 100644 --- a/deluge/ui/console/main.py +++ b/deluge/ui/console/main.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # main.py # @@ -35,27 +34,28 @@ from __future__ import print_function # # -import os -import sys +from __future__ import print_function + +import locale import logging import optparse +import os import re -import locale import shlex +import sys from twisted.internet import defer, reactor +import colors +import deluge.common import deluge.component as component from deluge.ui.client import client -import deluge.common +from deluge.ui.console import UI_PATH +from deluge.ui.console.eventlog import EventLog +from deluge.ui.console.statusbars import StatusBars from deluge.ui.coreconfig import CoreConfig from deluge.ui.sessionproxy import SessionProxy -from deluge.ui.console.statusbars import StatusBars -from deluge.ui.console.eventlog import EventLog -import colors from deluge.ui.ui import _UI -from deluge.ui.console import UI_PATH - log = logging.getLogger(__name__) diff --git a/deluge/ui/console/modes/add_util.py b/deluge/ui/console/modes/add_util.py index 37ec52b7c..dd43f7e3c 100644 --- a/deluge/ui/console/modes/add_util.py +++ b/deluge/ui/console/modes/add_util.py @@ -36,14 +36,16 @@ # statement from all source files in the program, then also delete it here. # # -from deluge.ui.client import client -import deluge.component as component -from deluge.ui.common import TorrentInfo -import deluge.common - -import os, base64, glob - +import base64 +import glob import logging +import os + +import deluge.common +import deluge.component as component +from deluge.ui.client import client +from deluge.ui.common import TorrentInfo + log = logging.getLogger(__name__) def __bracket_fixup(path): @@ -103,4 +105,3 @@ def add_torrent(t_file, options, success_cb, fail_cb, ress): filedump = base64.encodestring(open(f).read()) client.core.add_torrent_file(filename, filedump, t_options).addCallback(success_cb, f, ress).addErrback(fail_cb, f, ress) - diff --git a/deluge/ui/console/modes/addtorrents.py b/deluge/ui/console/modes/addtorrents.py index d73e0ae51..3ba8fc70a 100644 --- a/deluge/ui/console/modes/addtorrents.py +++ b/deluge/ui/console/modes/addtorrents.py @@ -34,28 +34,25 @@ # # -import deluge.component as component -from basemode import BaseMode +import base64 +import logging +import os import deluge.common as common -from deluge.ui.client import client - -import os -import base64 - -from deluge.ui.sessionproxy import SessionProxy - -from input_popup import InputPopup -from popup import Popup, MessagePopup +import deluge.component as component import deluge.ui.console.colors as colors import format_utils +from basemode import BaseMode +from deluge.ui.client import client +from deluge.ui.sessionproxy import SessionProxy +from input_popup import InputPopup +from popup import MessagePopup, Popup try: import curses except ImportError: pass -import logging log = logging.getLogger(__name__) # Big help string that gets displayed when the user hits 'h' diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py index 6252c044c..e2f038291 100644 --- a/deluge/ui/console/modes/alltorrents.py +++ b/deluge/ui/console/modes/alltorrents.py @@ -34,36 +34,34 @@ # # -import deluge.component as component -from basemode import BaseMode -import deluge.common -from deluge.ui.client import client -from deluge.configmanager import ConfigManager - +import logging from collections import deque -from deluge.ui.sessionproxy import SessionProxy - -from popup import Popup, SelectablePopup, MessagePopup, ALIGN -from add_util import add_torrent -from input_popup import InputPopup, ALIGN -from torrentdetail import TorrentDetail -from addtorrents import AddTorrents -from preferences import Preferences -from torrent_actions import torrent_actions_popup, ACTION -from eventview import EventView -from legacy import Legacy - from twisted.internet import defer -import format_utils, column +import column +import deluge.common +import deluge.component as component +import format_utils +from add_util import add_torrent +from addtorrents import AddTorrents +from basemode import BaseMode +from deluge.configmanager import ConfigManager +from deluge.ui.client import client +from deluge.ui.sessionproxy import SessionProxy +from eventview import EventView +from input_popup import ALIGN, InputPopup +from legacy import Legacy +from popup import ALIGN, MessagePopup, Popup, SelectablePopup +from preferences import Preferences +from torrent_actions import ACTION, torrent_actions_popup +from torrentdetail import TorrentDetail try: import curses except ImportError: pass -import logging log = logging.getLogger(__name__) diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py index 3035be99a..fe0b3663c 100644 --- a/deluge/ui/console/modes/basemode.py +++ b/deluge/ui/console/modes/basemode.py @@ -36,15 +36,19 @@ # # -import sys import logging +import sys + +from twisted.internet import reactor + +import deluge.component as component +import deluge.ui.console.colors as colors + try: import curses except ImportError: pass -import deluge.component as component -import deluge.ui.console.colors as colors try: import signal from fcntl import ioctl @@ -53,7 +57,6 @@ try: except: pass -from twisted.internet import reactor log = logging.getLogger(__name__) diff --git a/deluge/ui/console/modes/column.py b/deluge/ui/console/modes/column.py index da1b19287..0e1f1c3e7 100644 --- a/deluge/ui/console/modes/column.py +++ b/deluge/ui/console/modes/column.py @@ -34,10 +34,11 @@ # # +import logging + import deluge.common import format_utils -import logging log = logging.getLogger(__name__) diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py index 221ae72a2..d2fd238b0 100644 --- a/deluge/ui/console/modes/connectionmanager.py +++ b/deluge/ui/console/modes/connectionmanager.py @@ -35,28 +35,26 @@ # a mode that show's a popup to select which host to connect to -import hashlib, time - +import hashlib +import logging +import time from collections import deque -import deluge.ui.client -from deluge.ui.client import client -from deluge.configmanager import ConfigManager -from deluge.ui.coreconfig import CoreConfig import deluge.component as component - +import deluge.ui.client from alltorrents import AllTorrents from basemode import BaseMode -from popup import SelectablePopup, MessagePopup +from deluge.configmanager import ConfigManager +from deluge.ui.client import client +from deluge.ui.coreconfig import CoreConfig from input_popup import InputPopup - +from popup import MessagePopup, SelectablePopup try: import curses except ImportError: pass -import logging log = logging.getLogger(__name__) DEFAULT_HOST = "127.0.0.1" diff --git a/deluge/ui/console/modes/eventview.py b/deluge/ui/console/modes/eventview.py index df54421cd..b11f35800 100644 --- a/deluge/ui/console/modes/eventview.py +++ b/deluge/ui/console/modes/eventview.py @@ -34,9 +34,11 @@ # # -import deluge.component as component -from basemode import BaseMode +import logging +import deluge.component as component +import format_utils +from basemode import BaseMode from deluge.ui.client import client try: @@ -44,10 +46,8 @@ try: except ImportError: pass -import logging log = logging.getLogger(__name__) -import format_utils class EventView(BaseMode): def __init__(self, parent_mode, stdscr, encoding=None): diff --git a/deluge/ui/console/modes/format_utils.py b/deluge/ui/console/modes/format_utils.py index 16fea01e0..20bc2f76e 100644 --- a/deluge/ui/console/modes/format_utils.py +++ b/deluge/ui/console/modes/format_utils.py @@ -34,7 +34,12 @@ # # +import re +from collections import deque + import deluge.common +from unicodedata import east_asian_width + try: import unicodedata haveud = True @@ -137,13 +142,11 @@ def format_column(col, lim): def format_row(row, column_widths): return "".join([format_column(row[i], column_widths[i]) for i in range(0, len(row))]) -import re _strip_re = re.compile("\{!.*?!\}") def remove_formatting(string): return re.sub(_strip_re, "", string) -from collections import deque def wrap_string(string,width,min_lines=0,strip_colors=True): """ Wrap a string to fit in a particular width. Returns a list of output lines. @@ -227,7 +230,6 @@ def wrap_string(string,width,min_lines=0,strip_colors=True): return ret -from unicodedata import east_asian_width def strwidth(string): """ diff --git a/deluge/ui/console/modes/input_popup.py b/deluge/ui/console/modes/input_popup.py index 44cd8286b..86f382d8e 100644 --- a/deluge/ui/console/modes/input_popup.py +++ b/deluge/ui/console/modes/input_popup.py @@ -42,11 +42,12 @@ try: except ImportError: pass -import logging, os, os.path - -from popup import Popup, ALIGN +import logging +import os +import os.path from deluge.ui.console import colors +from popup import ALIGN, Popup log = logging.getLogger(__name__) @@ -909,4 +910,3 @@ class InputPopup(Popup): self.refresh() return False - diff --git a/deluge/ui/console/modes/legacy.py b/deluge/ui/console/modes/legacy.py index 46bd5871e..80d0b1895 100644 --- a/deluge/ui/console/modes/legacy.py +++ b/deluge/ui/console/modes/legacy.py @@ -41,20 +41,23 @@ except ImportError: pass -from basemode import BaseMode -import deluge.ui.console.colors as colors +import logging +import os +import re + from twisted.internet import defer, reactor -from deluge.ui.client import client + import deluge.component as component import deluge.configmanager - +import deluge.ui.console.colors as colors +from basemode import BaseMode +from deluge.ui.client import client from deluge.ui.console.modes import format_utils + strwidth = format_utils.strwidth -import logging, os log = logging.getLogger(__name__) -import re LINES_BUFFER_SIZE = 5000 INPUT_HISTORY_SIZE = 500 diff --git a/deluge/ui/console/modes/popup.py b/deluge/ui/console/modes/popup.py index 25fa9013b..153e47d43 100644 --- a/deluge/ui/console/modes/popup.py +++ b/deluge/ui/console/modes/popup.py @@ -40,8 +40,10 @@ try: except ImportError: pass -import format_utils import logging + +import format_utils + log = logging.getLogger(__name__) class ALIGN: diff --git a/deluge/ui/console/modes/preference_panes.py b/deluge/ui/console/modes/preference_panes.py index 847b6fbd7..513aac218 100644 --- a/deluge/ui/console/modes/preference_panes.py +++ b/deluge/ui/console/modes/preference_panes.py @@ -33,16 +33,18 @@ # # -from deluge.ui.console.modes.input_popup import TextInput, SelectInput, CheckedInput, IntSpinInput, FloatSpinInput, CheckedPlusInput +import logging + import deluge.ui.console.modes.alltorrents from deluge.common import is_ip +from deluge.ui.console.modes.input_popup import (CheckedInput, CheckedPlusInput, FloatSpinInput, IntSpinInput, + SelectInput, TextInput) try: import curses except ImportError: pass -import logging log = logging.getLogger(__name__) diff --git a/deluge/ui/console/modes/preferences.py b/deluge/ui/console/modes/preferences.py index cbbcb1db5..84ba79f64 100644 --- a/deluge/ui/console/modes/preferences.py +++ b/deluge/ui/console/modes/preferences.py @@ -34,24 +34,22 @@ # # -import deluge.component as component -from deluge.ui.client import client -from basemode import BaseMode -from input_popup import Popup, SelectInput - -from preference_panes import (DownloadsPane, NetworkPane, BandwidthPane, InterfacePane, - ColumnsPane, OtherPane, DaemonPane, QueuePane, ProxyPane, - CachePane) - +import logging from collections import deque +import deluge.component as component +from basemode import BaseMode +from deluge.ui.client import client +from input_popup import Popup, SelectInput +from preference_panes import (BandwidthPane, CachePane, ColumnsPane, DaemonPane, DownloadsPane, InterfacePane, + NetworkPane, OtherPane, ProxyPane, QueuePane) + try: import curses except ImportError: pass -import logging log = logging.getLogger(__name__) @@ -325,5 +323,3 @@ class Preferences(BaseMode): self.__actions_read(c) self.refresh() - - diff --git a/deluge/ui/console/modes/torrent_actions.py b/deluge/ui/console/modes/torrent_actions.py index cbf567471..96416b9b4 100644 --- a/deluge/ui/console/modes/torrent_actions.py +++ b/deluge/ui/console/modes/torrent_actions.py @@ -32,15 +32,16 @@ # # -from deluge.ui.client import client -from popup import SelectablePopup, Popup -from input_popup import InputPopup -import deluge.component as component +import logging -from deluge.ui.console import colors, modes from twisted.internet import defer -import logging +import deluge.component as component +from deluge.ui.client import client +from deluge.ui.console import colors, modes +from input_popup import InputPopup +from popup import Popup, SelectablePopup + log = logging.getLogger(__name__) torrent_options = [ diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py index 2a7cca3cb..c00c8919d 100644 --- a/deluge/ui/console/modes/torrentdetail.py +++ b/deluge/ui/console/modes/torrentdetail.py @@ -34,31 +34,27 @@ # # -import deluge.component as component -from basemode import BaseMode -import deluge.common -import deluge.common as common -from deluge.ui.client import client - -from sys import maxint +import logging from collections import deque +from sys import maxint -from deluge.ui.sessionproxy import SessionProxy - -from popup import Popup, SelectablePopup, MessagePopup -from add_util import add_torrent -from input_popup import InputPopup +import deluge.common as common +import deluge.component as component import deluge.ui.console.colors as colors import format_utils - -from torrent_actions import torrent_actions_popup, ACTION +from add_util import add_torrent +from basemode import BaseMode +from deluge.ui.client import client +from deluge.ui.sessionproxy import SessionProxy +from input_popup import InputPopup +from popup import MessagePopup, Popup, SelectablePopup +from torrent_actions import ACTION, torrent_actions_popup try: import curses except ImportError: pass -import logging log = logging.getLogger(__name__) # Big help string that gets displayed when the user hits 'h' diff --git a/deluge/ui/console/statusbars.py b/deluge/ui/console/statusbars.py index 90585cbc9..778cb8020 100644 --- a/deluge/ui/console/statusbars.py +++ b/deluge/ui/console/statusbars.py @@ -33,10 +33,9 @@ # # -from deluge.core.preferencesmanager import DEFAULT_PREFS - -import deluge.component as component import deluge.common +import deluge.component as component +from deluge.core.preferencesmanager import DEFAULT_PREFS from deluge.ui.client import client diff --git a/deluge/ui/coreconfig.py b/deluge/ui/coreconfig.py index 6120dcfa8..6f90739ec 100644 --- a/deluge/ui/coreconfig.py +++ b/deluge/ui/coreconfig.py @@ -35,6 +35,7 @@ import logging + import deluge.component as component from deluge.ui.client import client diff --git a/deluge/ui/gtkui/aboutdialog.py b/deluge/ui/gtkui/aboutdialog.py index 252a571fd..08937ceb5 100644 --- a/deluge/ui/gtkui/aboutdialog.py +++ b/deluge/ui/gtkui/aboutdialog.py @@ -7,13 +7,14 @@ # See LICENSE for more details. # -import pygtk -pygtk.require('2.0') import gtk +import pygtk + +import common +import deluge.common from deluge.ui.client import client -import deluge.common -import common +pygtk.require('2.0') class AboutDialog: diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py index d9fb09a6d..e1568d1f7 100644 --- a/deluge/ui/gtkui/addtorrentdialog.py +++ b/deluge/ui/gtkui/addtorrentdialog.py @@ -33,29 +33,30 @@ # # - -import pygtk -pygtk.require('2.0') -import gtk -import gobject import base64 import logging import os from urlparse import urljoin +import gobject +import gtk +import pygtk import twisted.web.client import twisted.web.error -from deluge.ui.client import client -from deluge.httpdownloader import download_file -import deluge.component as component -from torrentview_data_funcs import cell_data_size -from deluge.configmanager import ConfigManager + +import common import deluge.common +import deluge.component as component import deluge.ui.common import dialogs -import common - +from deluge.configmanager import ConfigManager +from deluge.httpdownloader import download_file +from deluge.ui.client import client from deluge.ui.gtkui.path_chooser import PathChooser +from torrentview_data_funcs import cell_data_size + +pygtk.require('2.0') + log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/common.py b/deluge/ui/gtkui/common.py index f51747a77..e893d98a1 100644 --- a/deluge/ui/gtkui/common.py +++ b/deluge/ui/gtkui/common.py @@ -8,18 +8,20 @@ # """Common functions for various parts of gtkui to use.""" -import os -import logging import cPickle +import logging +import os import shutil -import pygtk -pygtk.require('2.0') import gtk +import pygtk from gobject import GError import deluge.common +pygtk.require('2.0') + + log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py index bf38d8cbe..97548aa72 100644 --- a/deluge/ui/gtkui/connectionmanager.py +++ b/deluge/ui/gtkui/connectionmanager.py @@ -33,23 +33,24 @@ # # -import os -import gtk -import time import hashlib import logging +import os +import time + +import gtk from twisted.internet import reactor +import common import deluge.common import deluge.component as component -import common import deluge.configmanager -from deluge.ui.common import get_localhost_auth -from deluge.ui.client import client import deluge.ui.client +import dialogs from deluge.configmanager import ConfigManager from deluge.error import AuthenticationRequired, BadLoginError, IncompatibleClient -import dialogs +from deluge.ui.client import client +from deluge.ui.common import get_localhost_auth log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/createtorrentdialog.py b/deluge/ui/gtkui/createtorrentdialog.py index 8a544529e..6f6bfb945 100644 --- a/deluge/ui/gtkui/createtorrentdialog.py +++ b/deluge/ui/gtkui/createtorrentdialog.py @@ -34,20 +34,20 @@ # -import gtk -import sys -import os.path -import gobject import base64 import logging +import os.path +import sys +import gobject +import gtk from twisted.internet.threads import deferToThread +import deluge.common +import deluge.component as component +from deluge.configmanager import ConfigManager from deluge.ui.client import client from deluge.ui.gtkui.torrentview_data_funcs import cell_data_size -import deluge.component as component -import deluge.common -from deluge.configmanager import ConfigManager log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/details_tab.py b/deluge/ui/gtkui/details_tab.py index 74009c107..83a6ce486 100644 --- a/deluge/ui/gtkui/details_tab.py +++ b/deluge/ui/gtkui/details_tab.py @@ -10,7 +10,7 @@ import logging import deluge.component as component -from deluge.common import fsize, is_url, fdate +from deluge.common import fdate, fsize, is_url from deluge.ui.gtkui.torrentdetails import Tab log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/dialogs.py b/deluge/ui/gtkui/dialogs.py index f1602ed57..5fee9bd49 100644 --- a/deluge/ui/gtkui/dialogs.py +++ b/deluge/ui/gtkui/dialogs.py @@ -32,12 +32,11 @@ # statement from all source files in the program, then also delete it here. # import gtk - from twisted.internet import defer -from deluge.ui.gtkui import common -import deluge.component as component import deluge.common +import deluge.component as component +from deluge.ui.gtkui import common class BaseDialog(gtk.Dialog): diff --git a/deluge/ui/gtkui/edittrackersdialog.py b/deluge/ui/gtkui/edittrackersdialog.py index 89de26792..4b1a78f19 100644 --- a/deluge/ui/gtkui/edittrackersdialog.py +++ b/deluge/ui/gtkui/edittrackersdialog.py @@ -33,15 +33,16 @@ # # -import os.path -import gtk import logging +import os.path +import gtk from twisted.internet import defer -import deluge.common + import common -from deluge.ui.client import client +import deluge.common import deluge.component as component +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/files_tab.py b/deluge/ui/gtkui/files_tab.py index 880b46837..0b10d0a49 100644 --- a/deluge/ui/gtkui/files_tab.py +++ b/deluge/ui/gtkui/files_tab.py @@ -7,18 +7,19 @@ # See LICENSE for more details. # +import cPickle +import logging +import os.path + +import gobject import gtk import gtk.gdk -import gobject -import os.path -import logging -import cPickle -from deluge.ui.gtkui.torrentdetails import Tab -from deluge.ui.client import client -import deluge.component as component import deluge.common -from deluge.ui.gtkui.common import reparent_iter, save_pickled_state_file, load_pickled_state_file +import deluge.component as component +from deluge.ui.client import client +from deluge.ui.gtkui.common import load_pickled_state_file, reparent_iter, save_pickled_state_file +from deluge.ui.gtkui.torrentdetails import Tab log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/filtertreeview.py b/deluge/ui/gtkui/filtertreeview.py index 22b51bbdf..c12546e8b 100644 --- a/deluge/ui/gtkui/filtertreeview.py +++ b/deluge/ui/gtkui/filtertreeview.py @@ -9,17 +9,18 @@ # See LICENSE for more details. # +import logging import os +import warnings + import gtk import pango -import logging -import warnings from gobject import GError import deluge.component as component -from deluge.common import resource_filename, get_pixmap, TORRENT_STATE -from deluge.ui.client import client +from deluge.common import get_pixmap, resource_filename, TORRENT_STATE from deluge.configmanager import ConfigManager +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/gtkui.py b/deluge/ui/gtkui/gtkui.py index 66dc6d4ce..876e51e94 100644 --- a/deluge/ui/gtkui/gtkui.py +++ b/deluge/ui/gtkui/gtkui.py @@ -33,18 +33,45 @@ # # +import logging +import os +import sys +import warnings + import gobject +import gtk +from twisted.internet import gtk2reactor + +import deluge.common +import deluge.component as component +import deluge.error +import dialogs +from addtorrentdialog import AddTorrentDialog +from deluge.configmanager import ConfigManager, get_config_dir +from deluge.ui.client import client +from deluge.ui.gtkui.common import associate_magnet_links +from deluge.ui.sessionproxy import SessionProxy +from deluge.ui.tracker_icons import TrackerIcons +from deluge.ui.ui import _UI +from filtertreeview import FilterTreeView +from ipcinterface import IPCInterface +from mainwindow import MainWindow +from menubar import MenuBar +from pluginmanager import PluginManager +from preferences import Preferences +from queuedtorrents import QueuedTorrents +from sidebar import SideBar +from statusbar import StatusBar +from systemtray import SystemTray +from toolbar import ToolBar +from torrentdetails import TorrentDetails +from torrentview import TorrentView + gobject.set_prgname("deluge") # Install the twisted reactor -from twisted.internet import gtk2reactor reactor = gtk2reactor.install() -import os -import gtk -import sys -import logging -import warnings log = logging.getLogger(__name__) @@ -54,31 +81,6 @@ except ImportError: setproctitle = lambda t: None getproctitle = lambda: None -import deluge.component as component -from deluge.ui.client import client -from mainwindow import MainWindow -from menubar import MenuBar -from toolbar import ToolBar -from torrentview import TorrentView -from torrentdetails import TorrentDetails -from sidebar import SideBar -from filtertreeview import FilterTreeView -from preferences import Preferences -from systemtray import SystemTray -from statusbar import StatusBar -from pluginmanager import PluginManager -from ipcinterface import IPCInterface -from deluge.ui.tracker_icons import TrackerIcons -from queuedtorrents import QueuedTorrents -from addtorrentdialog import AddTorrentDialog -from deluge.ui.sessionproxy import SessionProxy -import dialogs -from deluge.ui.gtkui.common import associate_magnet_links -from deluge.configmanager import ConfigManager, get_config_dir -import deluge.common -import deluge.error -from deluge.ui.ui import _UI - class Gtk(_UI): diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py index 6d7605b0d..e93b6d60d 100644 --- a/deluge/ui/gtkui/ipcinterface.py +++ b/deluge/ui/gtkui/ipcinterface.py @@ -33,30 +33,29 @@ # # - -import sys -import os import base64 import logging -from urllib import url2pathname -from urlparse import urlparse +import os +import sys from glob import glob from tempfile import mkstemp +from urllib import url2pathname +from urlparse import urlparse + +import twisted.internet.error +from twisted.internet import reactor +from twisted.internet.protocol import ClientFactory, Factory, Protocol + +import deluge.common +import deluge.component as component +from deluge.configmanager import ConfigManager +from deluge.ui.client import client try: import rencode except ImportError: import deluge.rencode as rencode -import deluge.component as component -from deluge.ui.client import client -import deluge.common -from deluge.configmanager import ConfigManager - -from twisted.internet.protocol import Factory, Protocol, ClientFactory -from twisted.internet import reactor -import twisted.internet.error - log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py index ee432a761..84b1452e5 100644 --- a/deluge/ui/gtkui/listview.py +++ b/deluge/ui/gtkui/listview.py @@ -35,12 +35,15 @@ # import logging -import pygtk -pygtk.require('2.0') + import gtk +import pygtk from gobject import signal_new, SIGNAL_RUN_LAST, TYPE_NONE -from deluge.ui.gtkui.common import save_pickled_state_file, load_pickled_state_file +from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file + +pygtk.require('2.0') + signal_new('button-press-event', gtk.TreeViewColumn, SIGNAL_RUN_LAST, TYPE_NONE, (gtk.gdk.Event,)) diff --git a/deluge/ui/gtkui/mainwindow.py b/deluge/ui/gtkui/mainwindow.py index 27878fd2b..201d33efe 100644 --- a/deluge/ui/gtkui/mainwindow.py +++ b/deluge/ui/gtkui/mainwindow.py @@ -8,28 +8,31 @@ # import copy -import os.path -import pygtk -pygtk.require('2.0') -import gtk import logging +import os.path from hashlib import sha1 as sha +import gtk +import pygtk from twisted.internet import reactor from twisted.internet.error import ReactorNotRunning +import deluge.common +import deluge.component as component +import deluge.ui.gtkui.common +from deluge.configmanager import ConfigManager +from deluge.ui.client import client +from deluge.ui.gtkui.dialogs import PasswordDialog +from deluge.ui.gtkui.ipcinterface import process_args + +pygtk.require('2.0') + + try: import wnck except ImportError: wnck = None -import deluge.common -import deluge.ui.gtkui.common -import deluge.component as component -from deluge.ui.client import client -from deluge.configmanager import ConfigManager -from deluge.ui.gtkui.ipcinterface import process_args -from deluge.ui.gtkui.dialogs import PasswordDialog log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py index 2e93be709..0c40ee6c1 100644 --- a/deluge/ui/gtkui/menubar.py +++ b/deluge/ui/gtkui/menubar.py @@ -9,20 +9,23 @@ # -import os.path -import pygtk -pygtk.require('2.0') -import gtk import logging +import os.path + +import gtk +import pygtk -import deluge.error -import deluge.component as component -from deluge.ui.client import client import deluge.common +import deluge.component as component +import deluge.error import dialogs from deluge.configmanager import ConfigManager +from deluge.ui.client import client from deluge.ui.gtkui.path_chooser import PathChooser +pygtk.require('2.0') + + log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/new_release_dialog.py b/deluge/ui/gtkui/new_release_dialog.py index 767b2f50b..9218dcb43 100644 --- a/deluge/ui/gtkui/new_release_dialog.py +++ b/deluge/ui/gtkui/new_release_dialog.py @@ -34,11 +34,12 @@ # -import deluge.component as component import deluge.common +import deluge.component as component from deluge.configmanager import ConfigManager from deluge.ui.client import client + class NewReleaseDialog: def __init__(self): pass @@ -82,4 +83,3 @@ class NewReleaseDialog: def _on_button_close_new_release(self, widget): self.config["show_new_releases"] = not self.chk_not_show_dialog.get_active() self.dialog.destroy() - diff --git a/deluge/ui/gtkui/notification.py b/deluge/ui/gtkui/notification.py index b7ab70d10..643691535 100644 --- a/deluge/ui/gtkui/notification.py +++ b/deluge/ui/gtkui/notification.py @@ -35,9 +35,10 @@ import logging -import deluge.component as component -import deluge.common + import common +import deluge.common +import deluge.component as component from deluge.configmanager import ConfigManager from deluge.ui.client import client diff --git a/deluge/ui/gtkui/path_chooser.py b/deluge/ui/gtkui/path_chooser.py index 6c4902e0c..67dad9ed6 100644 --- a/deluge/ui/gtkui/path_chooser.py +++ b/deluge/ui/gtkui/path_chooser.py @@ -34,9 +34,9 @@ import logging +import deluge.component as component from deluge.ui.client import client from deluge.ui.gtkui.path_combo_chooser import PathChooserComboBox -import deluge.component as component log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/path_combo_chooser.py b/deluge/ui/gtkui/path_combo_chooser.py index 18ec2b5ea..7d008af64 100755 --- a/deluge/ui/gtkui/path_combo_chooser.py +++ b/deluge/ui/gtkui/path_combo_chooser.py @@ -1,4 +1,3 @@ -from __future__ import print_function #!/usr/bin/env python # -*- coding: utf-8 -*- # @@ -35,13 +34,15 @@ from __future__ import print_function # statement from all source files in the program, then also delete it here. # +from __future__ import print_function + import os import gobject import gtk from gtk import gdk, keysyms -from deluge.path_chooser_common import get_resource, get_completion_paths +from deluge.path_chooser_common import get_completion_paths, get_resource def is_ascii_value(keyval, ascii_key): diff --git a/deluge/ui/gtkui/peers_tab.py b/deluge/ui/gtkui/peers_tab.py index 1a2803115..8b724519d 100644 --- a/deluge/ui/gtkui/peers_tab.py +++ b/deluge/ui/gtkui/peers_tab.py @@ -33,18 +33,19 @@ # # -import gtk import logging import os.path from itertools import izip -from deluge.ui.client import client -import deluge.component as component +import gtk + import deluge.common -from deluge.ui.gtkui.torrentview_data_funcs import cell_data_speed_down, cell_data_speed_up -from deluge.ui.gtkui.torrentdetails import Tab +import deluge.component as component +from deluge.ui.client import client from deluge.ui.countries import COUNTRIES -from deluge.ui.gtkui.common import save_pickled_state_file, load_pickled_state_file +from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file +from deluge.ui.gtkui.torrentdetails import Tab +from deluge.ui.gtkui.torrentview_data_funcs import cell_data_speed_down, cell_data_speed_up log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/piecesbar.py b/deluge/ui/gtkui/piecesbar.py index ce5a186b1..0487f9e8d 100644 --- a/deluge/ui/gtkui/piecesbar.py +++ b/deluge/ui/gtkui/piecesbar.py @@ -34,12 +34,14 @@ # # -import gtk -import cairo -import pango -import pangocairo import logging from math import pi + +import cairo +import gtk +import pango +import pangocairo + from deluge.configmanager import ConfigManager log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/pluginmanager.py b/deluge/ui/gtkui/pluginmanager.py index a5bfcc819..b7356e307 100644 --- a/deluge/ui/gtkui/pluginmanager.py +++ b/deluge/ui/gtkui/pluginmanager.py @@ -35,10 +35,11 @@ import logging + import deluge.component as component import deluge.pluginmanagerbase -from deluge.ui.client import client from deluge.configmanager import ConfigManager +from deluge.ui.client import client log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py index 6ace51acd..b468c9828 100644 --- a/deluge/ui/gtkui/preferences.py +++ b/deluge/ui/gtkui/preferences.py @@ -34,22 +34,25 @@ # # -import os -import pygtk -pygtk.require('2.0') -import gtk import logging +import os from hashlib import sha1 as sha -import deluge.component as component -from deluge.ui.client import client -from deluge.ui.gtkui.path_chooser import PathChooser -import deluge.common +import gtk +import pygtk + import common +import deluge.common +import deluge.component as component +import deluge.configmanager import dialogs from deluge.configmanager import ConfigManager -import deluge.configmanager from deluge.error import AuthManagerError, NotAuthorizedError +from deluge.ui.client import client +from deluge.ui.gtkui.path_chooser import PathChooser + +pygtk.require('2.0') + log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/queuedtorrents.py b/deluge/ui/gtkui/queuedtorrents.py index 8d26cce2c..e2a547414 100644 --- a/deluge/ui/gtkui/queuedtorrents.py +++ b/deluge/ui/gtkui/queuedtorrents.py @@ -33,17 +33,17 @@ # # +import logging import os.path -import gtk -import logging import gobject +import gtk -import deluge.component as component -from deluge.ui.gtkui.ipcinterface import process_args -import deluge.common -from deluge.configmanager import ConfigManager import common +import deluge.common +import deluge.component as component +from deluge.configmanager import ConfigManager +from deluge.ui.gtkui.ipcinterface import process_args log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/removetorrentdialog.py b/deluge/ui/gtkui/removetorrentdialog.py index 6742220db..12601efd4 100644 --- a/deluge/ui/gtkui/removetorrentdialog.py +++ b/deluge/ui/gtkui/removetorrentdialog.py @@ -33,16 +33,18 @@ # # -import os -import gtk import logging +import os + +import gtk -from deluge.ui.client import client import deluge.common import deluge.component as component +from deluge.ui.client import client log = logging.getLogger(__name__) + class RemoveTorrentDialog(object): """ This class is used to create and show a Remove Torrent Dialog. diff --git a/deluge/ui/gtkui/sidebar.py b/deluge/ui/gtkui/sidebar.py index d31fefa44..37dea5c41 100644 --- a/deluge/ui/gtkui/sidebar.py +++ b/deluge/ui/gtkui/sidebar.py @@ -35,11 +35,12 @@ # -import gtk import logging -import deluge.component as component +import gtk + import deluge.common +import deluge.component as component from deluge.configmanager import ConfigManager log = logging.getLogger(__name__) @@ -110,5 +111,3 @@ class SideBar(component.Component): self.notebook.set_show_tabs(False) else: self.notebook.set_show_tabs(True) - - diff --git a/deluge/ui/gtkui/status_tab.py b/deluge/ui/gtkui/status_tab.py index bc69393ae..2ad6b0467 100644 --- a/deluge/ui/gtkui/status_tab.py +++ b/deluge/ui/gtkui/status_tab.py @@ -37,10 +37,10 @@ import logging import deluge.component as component -from deluge.common import fsize, fspeed, fdate, fpeer, ftime +from deluge.common import fdate, fpeer, fsize, fspeed, ftime from deluge.configmanager import ConfigManager -from deluge.ui.gtkui.torrentdetails import Tab from deluge.ui.gtkui.piecesbar import PiecesBar +from deluge.ui.gtkui.torrentdetails import Tab log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/statusbar.py b/deluge/ui/gtkui/statusbar.py index 59a1020f8..e3d23f811 100644 --- a/deluge/ui/gtkui/statusbar.py +++ b/deluge/ui/gtkui/statusbar.py @@ -34,16 +34,16 @@ # -import gtk -import gobject import logging -from deluge.ui.client import client -import deluge.component as component +import gobject +import gtk + import deluge.common -from deluge.ui.gtkui import common -from deluge.ui.gtkui import dialogs +import deluge.component as component from deluge.configmanager import ConfigManager +from deluge.ui.client import client +from deluge.ui.gtkui import common, dialogs log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/systemtray.py b/deluge/ui/gtkui/systemtray.py index cad5507a5..b15b51779 100644 --- a/deluge/ui/gtkui/systemtray.py +++ b/deluge/ui/gtkui/systemtray.py @@ -38,16 +38,17 @@ try: except ImportError: appindicator = None -import os -import gtk import logging +import os + +import gtk -import deluge.component as component -from deluge.ui.client import client -import deluge.common -from deluge.configmanager import ConfigManager -from deluge.ui.gtkui import dialogs import common +import deluge.common +import deluge.component as component +from deluge.configmanager import ConfigManager +from deluge.ui.client import client +from deluge.ui.gtkui import dialogs log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/toolbar.py b/deluge/ui/gtkui/toolbar.py index a9ddef872..f0ab7e27f 100644 --- a/deluge/ui/gtkui/toolbar.py +++ b/deluge/ui/gtkui/toolbar.py @@ -7,14 +7,17 @@ # See LICENSE for more details. # -import pygtk -pygtk.require('2.0') -import gtk import logging +import gtk +import pygtk + import deluge.component as component from deluge.configmanager import ConfigManager +pygtk.require('2.0') + + log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/torrentdetails.py b/deluge/ui/gtkui/torrentdetails.py index 44e9e3ed0..3f7aa050a 100644 --- a/deluge/ui/gtkui/torrentdetails.py +++ b/deluge/ui/gtkui/torrentdetails.py @@ -10,12 +10,13 @@ """The torrent details component shows info about the selected torrent.""" -import gtk import logging +import gtk + import deluge.component as component from deluge.ui.client import client -from deluge.ui.gtkui.common import save_pickled_state_file, load_pickled_state_file +from deluge.ui.gtkui.common import load_pickled_state_file, save_pickled_state_file log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/torrentview.py b/deluge/ui/gtkui/torrentview.py index 8e9707bad..117df6c58 100644 --- a/deluge/ui/gtkui/torrentview.py +++ b/deluge/ui/gtkui/torrentview.py @@ -7,22 +7,22 @@ # See LICENSE for more details. # - """The torrent view component that lists all torrents in the session.""" -import pygtk -pygtk.require('2.0') -import gtk -import gobject import logging +import gobject +import gtk +import pygtk from twisted.internet import reactor -import listview import deluge.component as component +import listview +import torrentview_data_funcs as funcs from deluge.ui.client import client from removetorrentdialog import RemoveTorrentDialog -import torrentview_data_funcs as funcs + +pygtk.require('2.0') log = logging.getLogger(__name__) diff --git a/deluge/ui/gtkui/torrentview_data_funcs.py b/deluge/ui/gtkui/torrentview_data_funcs.py index 06540a253..217812e0a 100644 --- a/deluge/ui/gtkui/torrentview_data_funcs.py +++ b/deluge/ui/gtkui/torrentview_data_funcs.py @@ -1,4 +1,3 @@ -from __future__ import print_function # -*- coding: utf-8 -*- # torrentview_data_funcs.py # @@ -34,10 +33,14 @@ from __future__ import print_function # # -import deluge.common as common -import gtk +from __future__ import print_function + import warnings + import gobject +import gtk + +import deluge.common as common import deluge.component as component # Status icons.. Create them from file only once to avoid constantly diff --git a/deluge/ui/sessionproxy.py b/deluge/ui/sessionproxy.py index 2ba8f1cea..926193e77 100644 --- a/deluge/ui/sessionproxy.py +++ b/deluge/ui/sessionproxy.py @@ -34,11 +34,12 @@ # import logging +import time + from twisted.internet.defer import maybeDeferred, succeed import deluge.component as component from deluge.ui.client import client -import time log = logging.getLogger(__name__) diff --git a/deluge/ui/tracker_icons.py b/deluge/ui/tracker_icons.py index 0143aab02..204954483 100644 --- a/deluge/ui/tracker_icons.py +++ b/deluge/ui/tracker_icons.py @@ -33,24 +33,26 @@ # # -import os import logging -from HTMLParser import HTMLParser, HTMLParseError -from urlparse import urljoin, urlparse +import os +from HTMLParser import HTMLParseError, HTMLParser from tempfile import mkstemp +from urlparse import urljoin, urlparse from twisted.internet import defer, threads from twisted.web.error import PageRedirect + +from deluge.component import Component +from deluge.configmanager import get_config_dir +from deluge.decorators import proxy +from deluge.httpdownloader import download_file + try: from twisted.web.resource import NoResource, ForbiddenResource except ImportError: # twisted 8 from twisted.web.error import NoResource, ForbiddenResource -from deluge.component import Component -from deluge.configmanager import get_config_dir -from deluge.httpdownloader import download_file -from deluge.decorators import proxy try: diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py index 492aea0e2..83cb01b3e 100644 --- a/deluge/ui/ui.py +++ b/deluge/ui/ui.py @@ -1,4 +1,3 @@ -from __future__ import print_function # # ui.py # @@ -34,10 +33,12 @@ from __future__ import print_function # # +from __future__ import print_function + +import logging import os import sys -import logging -from optparse import OptionParser, OptionGroup +from optparse import OptionGroup, OptionParser import deluge.common import deluge.configmanager diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py index 93912411c..3bf4e2b92 100644 --- a/deluge/ui/web/auth.py +++ b/deluge/ui/web/auth.py @@ -7,10 +7,10 @@ # See LICENSE for more details. # -import time -import random import hashlib import logging +import random +import time from datetime import datetime, timedelta from email.utils import formatdate @@ -18,6 +18,7 @@ from twisted.internet.task import LoopingCall from deluge import component from deluge.common import utf8_encoded +from deluge.ui.web.json_api import export, JSONComponent log = logging.getLogger(__name__) @@ -38,7 +39,6 @@ class AuthError(Exception): pass # Import after as json_api imports the above AuthError and AUTH_LEVEL_DEFAULT -from deluge.ui.web.json_api import JSONComponent, export def make_checksum(session_id): diff --git a/deluge/ui/web/common.py b/deluge/ui/web/common.py index 8f39141c8..0acd16d5b 100644 --- a/deluge/ui/web/common.py +++ b/deluge/ui/web/common.py @@ -7,8 +7,9 @@ # See LICENSE for more details. # -import zlib import gettext +import zlib + from deluge import common _ = lambda x: gettext.gettext(x).decode("utf-8") diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 4d8472435..9b435819b 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -7,32 +7,31 @@ # See LICENSE for more details. # -import os -import time import base64 -import shutil -import logging import hashlib -import tempfile import json -from urlparse import urljoin -from urllib import unquote_plus - +import logging +import os +import shutil +import tempfile +import time from types import FunctionType +from urllib import unquote_plus +from urlparse import urljoin + +import twisted.web.client +import twisted.web.error from twisted.internet import reactor from twisted.internet.defer import Deferred, DeferredList from twisted.web import http, resource, server -import twisted.web.client -import twisted.web.error -from deluge.common import is_magnet from deluge import component, httpdownloader +from deluge.common import is_magnet from deluge.configmanager import ConfigManager, get_config_dir from deluge.ui import common as uicommon -from deluge.ui.client import client, Client +from deluge.ui.client import Client, client from deluge.ui.coreconfig import CoreConfig from deluge.ui.sessionproxy import SessionProxy - from deluge.ui.web.common import _, compress log = logging.getLogger(__name__) diff --git a/deluge/ui/web/pluginmanager.py b/deluge/ui/web/pluginmanager.py index b30fba8ae..29204c79b 100644 --- a/deluge/ui/web/pluginmanager.py +++ b/deluge/ui/web/pluginmanager.py @@ -7,13 +7,13 @@ # See LICENSE for more details. # -import os import logging +import os from deluge import component +from deluge.configmanager import ConfigManager from deluge.pluginmanagerbase import PluginManagerBase from deluge.ui.client import client -from deluge.configmanager import ConfigManager log = logging.getLogger(__name__) diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index 85aabc215..6fd61630d 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -7,15 +7,15 @@ # See LICENSE for more details. # -import os import fnmatch -import logging -import tempfile -import mimetypes import json +import logging +import mimetypes +import os +import tempfile -from twisted.application import service, internet -from twisted.internet import reactor, defer, error +from twisted.application import internet, service +from twisted.internet import defer, error, reactor from twisted.internet.ssl import SSL from twisted.web import http, resource, server, static @@ -23,7 +23,7 @@ from deluge import common, component, configmanager from deluge.core.rpcserver import check_ssl_keys from deluge.ui.tracker_icons import TrackerIcons from deluge.ui.web.auth import Auth -from deluge.ui.web.common import Template, compress +from deluge.ui.web.common import compress, Template from deluge.ui.web.json_api import JSON, WebApi from deluge.ui.web.pluginmanager import PluginManager diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py index fecb722ea..c46620ff4 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -1,4 +1,3 @@ -from __future__ import print_function # -*- coding: utf-8 -*- # # Copyright (C) 2009 Damien Churchill @@ -8,11 +7,13 @@ from __future__ import print_function # See LICENSE for more details. # +from __future__ import print_function + import os +from optparse import OptionGroup import deluge.common from deluge.ui.ui import _UI, UI -from optparse import OptionGroup class WebUI(UI):