summaryrefslogtreecommitdiffstats
path: root/deluge/ui
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2014-09-19 19:10:09 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2014-09-19 19:10:14 +0100
commit30a0f3c9ed9310635914225aec6995c5b687614e (patch)
tree7c6d10ca5458a08194260a300d08590d801fe1b4 /deluge/ui
parentd0b8e17873328adbd7ac767a875a2a80fa7c5591 (diff)
downloaddeluge-30a0f3c9ed9310635914225aec6995c5b687614e.tar.gz
deluge-30a0f3c9ed9310635914225aec6995c5b687614e.tar.bz2
deluge-30a0f3c9ed9310635914225aec6995c5b687614e.zip
Flake8 pass of entire codebase
* Use the inline '# NOQA' to supress N802 lower-case warnings
Diffstat (limited to 'deluge/ui')
-rw-r--r--deluge/ui/client.py8
-rw-r--r--deluge/ui/console/commands/debug.py4
-rw-r--r--deluge/ui/console/modes/add_util.py4
-rw-r--r--deluge/ui/console/modes/addtorrents.py2
-rw-r--r--deluge/ui/console/modes/alltorrents.py2
-rw-r--r--deluge/ui/console/modes/basemode.py14
-rw-r--r--deluge/ui/console/modes/connectionmanager.py2
-rw-r--r--deluge/ui/console/modes/eventview.py2
-rw-r--r--deluge/ui/console/modes/legacy.py2
-rw-r--r--deluge/ui/console/modes/popup.py6
-rw-r--r--deluge/ui/console/modes/preferences.py2
-rw-r--r--deluge/ui/console/modes/torrentdetail.py2
-rw-r--r--deluge/ui/gtkui/ipcinterface.py8
-rw-r--r--deluge/ui/ui.py6
-rw-r--r--deluge/ui/web/auth.py8
-rw-r--r--deluge/ui/web/json_api.py6
-rw-r--r--deluge/ui/web/server.py22
17 files changed, 50 insertions, 50 deletions
diff --git a/deluge/ui/client.py b/deluge/ui/client.py
index f0598ac16..961abb841 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -73,7 +73,7 @@ class DelugeRPCRequest(object):
class DelugeRPCProtocol(DelugeTransferProtocol):
- def connectionMade(self):
+ def connectionMade(self): # NOQA
self.__rpc_requests = {}
# Set the protocol in the daemon so it can send data
self.factory.daemon.protocol = self
@@ -192,16 +192,16 @@ class DelugeRPCClientFactory(ClientFactory):
self.daemon = daemon
self.event_handlers = event_handlers
- def startedConnecting(self, connector):
+ def startedConnecting(self, connector): # NOQA
log.info("Connecting to daemon at \"%s:%s\"...",
connector.host, connector.port)
- def clientConnectionFailed(self, connector, reason):
+ def clientConnectionFailed(self, connector, reason): # NOQA
log.warning("Connection to daemon at \"%s:%s\" failed: %s",
connector.host, connector.port, reason.value)
self.daemon.connect_deferred.errback(reason)
- def clientConnectionLost(self, connector, reason):
+ def clientConnectionLost(self, connector, reason): # NOQA
log.info("Connection lost to daemon at \"%s:%s\" reason: %s",
connector.host, connector.port, reason.value)
self.daemon.host = None
diff --git a/deluge/ui/console/commands/debug.py b/deluge/ui/console/commands/debug.py
index 73419e677..1a295e3a8 100644
--- a/deluge/ui/console/commands/debug.py
+++ b/deluge/ui/console/commands/debug.py
@@ -21,9 +21,9 @@ class Command(BaseCommand):
def handle(self, state="", **options):
if state == "on":
- deluge.log.setLoggerLevel("debug")
+ deluge.log.set_logger_level("debug")
elif state == "off":
- deluge.log.setLoggerLevel("error")
+ deluge.log.set_logger_level("error")
else:
component.get("ConsoleUI").write("{!error!}%s" % self.usage)
diff --git a/deluge/ui/console/modes/add_util.py b/deluge/ui/console/modes/add_util.py
index 8cb0a3c35..75dea5bb7 100644
--- a/deluge/ui/console/modes/add_util.py
+++ b/deluge/ui/console/modes/add_util.py
@@ -21,7 +21,7 @@ from deluge.ui.common import TorrentInfo
log = logging.getLogger(__name__)
-def __bracket_fixup(path):
+def _bracket_fixup(path):
if (path.find("[") == -1 and path.find("]") == -1):
return path
sentinal = 256
@@ -48,7 +48,7 @@ def add_torrent(t_file, options, success_cb, fail_cb, ress):
if is_url or is_magnet:
files = [t_file]
else:
- files = glob.glob(__bracket_fixup(t_file))
+ files = glob.glob(_bracket_fixup(t_file))
num_files = len(files)
ress["total"] = num_files
diff --git a/deluge/ui/console/modes/addtorrents.py b/deluge/ui/console/modes/addtorrents.py
index 6a0220e3a..036fd6cc4 100644
--- a/deluge/ui/console/modes/addtorrents.py
+++ b/deluge/ui/console/modes/addtorrents.py
@@ -468,7 +468,7 @@ class AddTorrents(BaseMode, component.Component):
self.__refresh_listing()
- def _doRead(self):
+ def read_input(self):
c = self.stdscr.getch()
if self.popup:
diff --git a/deluge/ui/console/modes/alltorrents.py b/deluge/ui/console/modes/alltorrents.py
index 80b981592..57dc95ebe 100644
--- a/deluge/ui/console/modes/alltorrents.py
+++ b/deluge/ui/console/modes/alltorrents.py
@@ -1137,7 +1137,7 @@ class AllTorrents(BaseMode, component.Component):
self.search_state = SEARCH_EMPTY
self.refresh([])
- def _doRead(self):
+ def read_input(self):
# Read the character
effected_lines = None
diff --git a/deluge/ui/console/modes/basemode.py b/deluge/ui/console/modes/basemode.py
index bf49c5e1c..076bcb6b2 100644
--- a/deluge/ui/console/modes/basemode.py
+++ b/deluge/ui/console/modes/basemode.py
@@ -41,11 +41,11 @@ class CursesStdIO(object):
""" We want to select on FD 0 """
return 0
- def doRead(self):
+ def doRead(self): # NOQA
"""called when input is ready"""
pass
- def logPrefix(self):
+ def logPrefix(self): # NOQA
return "CursesClient"
@@ -57,7 +57,7 @@ class BaseMode(CursesStdIO):
Modes should subclass this and provide overrides for:
- _doRead(self) - Handle user input
+ do_read(self) - Handle user input
refresh(self) - draw the mode to the screen
add_string(self, row, string) - add a string of text to be displayed.
see method for detailed info
@@ -107,7 +107,7 @@ class BaseMode(CursesStdIO):
self.on_resize_norefresh(args)
self.refresh()
- def connectionLost(self, reason):
+ def connectionLost(self, reason): # NOQA
self.close()
def add_string(self, row, string, scr=None, col=0, pad=True, trim=True):
@@ -192,18 +192,18 @@ class BaseMode(CursesStdIO):
self.stdscr.redrawwin()
self.stdscr.refresh()
- def doRead(self):
+ def doRead(self): # NOQA
"""
Called when there is data to be read, ie, input from the keyboard.
"""
# We wrap this function to catch exceptions and shutdown the mainloop
try:
- self._doRead()
+ self.read_input()
except Exception as ex:
log.exception(ex)
reactor.stop()
- def _doRead(self):
+ def read_input(self):
# Read the character
self.stdscr.getch()
self.stdscr.refresh()
diff --git a/deluge/ui/console/modes/connectionmanager.py b/deluge/ui/console/modes/connectionmanager.py
index b91d76efc..2d1352c2a 100644
--- a/deluge/ui/console/modes/connectionmanager.py
+++ b/deluge/ui/console/modes/connectionmanager.py
@@ -167,7 +167,7 @@ class ConnectionManager(BaseMode):
self.stdscr.erase()
self.refresh()
- def _doRead(self):
+ def read_input(self):
# Read the character
c = self.stdscr.getch()
diff --git a/deluge/ui/console/modes/eventview.py b/deluge/ui/console/modes/eventview.py
index 350e5703a..eb2987415 100644
--- a/deluge/ui/console/modes/eventview.py
+++ b/deluge/ui/console/modes/eventview.py
@@ -85,7 +85,7 @@ class EventView(BaseMode):
component.get("ConsoleUI").set_mode(self.parent_mode)
self.parent_mode.resume()
- def _doRead(self):
+ def read_input(self):
c = self.stdscr.getch()
if c > 31 and c < 256:
diff --git a/deluge/ui/console/modes/legacy.py b/deluge/ui/console/modes/legacy.py
index 0fb0aab77..20fdcd5d6 100644
--- a/deluge/ui/console/modes/legacy.py
+++ b/deluge/ui/console/modes/legacy.py
@@ -215,7 +215,7 @@ class Legacy(BaseMode, component.Component):
self.add_string(self.rows - 2, self.statusbars.bottombar)
self.stdscr.refresh()
- def _doRead(self):
+ def read_input(self):
# Read the character
c = self.stdscr.getch()
diff --git a/deluge/ui/console/modes/popup.py b/deluge/ui/console/modes/popup.py
index b648be433..0979220a7 100644
--- a/deluge/ui/console/modes/popup.py
+++ b/deluge/ui/console/modes/popup.py
@@ -41,8 +41,8 @@ class Popup:
NB: The parent mode is responsible for calling refresh on any popups it wants to show.
This should be called as the last thing in the parents refresh method.
- The parent *must* also call _doRead on the popup instead of/in addition to
- running its own _doRead code if it wants to have the popup handle user input.
+ The parent *must* also call read_input on the popup instead of/in addition to
+ running its own read_input code if it wants to have the popup handle user input.
:param parent_mode: must be a basemode (or subclass) which the popup will be drawn over
:parem title: string, the title of the popup window
@@ -54,7 +54,7 @@ class Popup:
add_string(self, row, string) - add string at row. handles triming/ignoring if the string won't fit in the popup
- _doRead(self) - handle user input to the popup.
+ read_input(self) - handle user input to the popup.
"""
self.parent = parent_mode
diff --git a/deluge/ui/console/modes/preferences.py b/deluge/ui/console/modes/preferences.py
index b14244877..b90d5a687 100644
--- a/deluge/ui/console/modes/preferences.py
+++ b/deluge/ui/console/modes/preferences.py
@@ -247,7 +247,7 @@ class Preferences(BaseMode):
component.get("ConsoleUI").set_mode(self.parent_mode)
self.parent_mode.resume()
- def _doRead(self):
+ def read_input(self):
c = self.stdscr.getch()
if self.popup:
diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py
index b17f9a7da..e432a6d9e 100644
--- a/deluge/ui/console/modes/torrentdetail.py
+++ b/deluge/ui/console/modes/torrentdetail.py
@@ -843,7 +843,7 @@ class TorrentDetail(BaseMode, component.Component):
self.popup = popup
- def _doRead(self):
+ def read_input(self):
c = self.stdscr.getch()
if self.popup:
diff --git a/deluge/ui/gtkui/ipcinterface.py b/deluge/ui/gtkui/ipcinterface.py
index b254525da..fe55e1f7a 100644
--- a/deluge/ui/gtkui/ipcinterface.py
+++ b/deluge/ui/gtkui/ipcinterface.py
@@ -34,7 +34,7 @@ log = logging.getLogger(__name__)
class IPCProtocolServer(Protocol):
- def dataReceived(self, data):
+ def dataReceived(self, data): # NOQA
config = ConfigManager("gtkui.conf")
data = rencode.loads(data, decode_utf8=True)
if not data or config["focus_main_window_on_add"]:
@@ -43,11 +43,11 @@ class IPCProtocolServer(Protocol):
class IPCProtocolClient(Protocol):
- def connectionMade(self):
+ def connectionMade(self): # NOQA
self.transport.write(rencode.dumps(self.factory.args))
self.transport.loseConnection()
- def connectionLost(self, reason):
+ def connectionLost(self, reason): # NOQA
reactor.stop()
self.factory.stop = True
@@ -58,7 +58,7 @@ class IPCClientFactory(ClientFactory):
def __init__(self):
self.stop = False
- def clientConnectionFailed(self, connector, reason):
+ def clientConnectionFailed(self, connector, reason): # NOQA
log.warning("Connection to running instance failed.")
reactor.stop()
diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py
index 62fff5e76..9532d14b1 100644
--- a/deluge/ui/ui.py
+++ b/deluge/ui/ui.py
@@ -92,9 +92,9 @@ class _UI(object):
self.__options.loglevel = self.__options.loglevel.lower()
# Setup the logger
- deluge.log.setupLogger(level=self.__options.loglevel,
- filename=self.__options.logfile,
- filemode=logfile_mode)
+ deluge.log.setup_logger(level=self.__options.loglevel,
+ filename=self.__options.logfile,
+ filemode=logfile_mode)
log = logging.getLogger(__name__)
diff --git a/deluge/ui/web/auth.py b/deluge/ui/web/auth.py
index 94ba6decd..ed8c715e7 100644
--- a/deluge/ui/web/auth.py
+++ b/deluge/ui/web/auth.py
@@ -276,7 +276,7 @@ class Auth(JSONComponent):
:returns: True if the session is valid, False if not.
:rtype: booleon
"""
- return __request__.session_id is not None
+ return __request__.session_id is not None # NOQA
@export
def delete_session(self):
@@ -287,7 +287,7 @@ class Auth(JSONComponent):
:type session_id: string
"""
config = component.get("DelugeWeb").config
- del config["sessions"][__request__.session_id]
+ del config["sessions"][__request__.session_id] # NOQA
return True
@export(AUTH_LEVEL_NONE)
@@ -301,7 +301,7 @@ class Auth(JSONComponent):
:rtype: string or False
"""
if self.check_password(password):
- return self._create_session(__request__)
+ return self._create_session(__request__) # NOQA
else:
- log.error('Login failed (ClientIP %s)', __request__.getClientIP())
+ log.error('Login failed (ClientIP %s)', __request__.getClientIP()) # NOQA
return False
diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py
index 10480325c..1e18eb636 100644
--- a/deluge/ui/web/json_api.py
+++ b/deluge/ui/web/json_api.py
@@ -975,7 +975,7 @@ class WebApi(JSONComponent):
:param event: The event name
:type event: string
"""
- self.event_queue.add_listener(__request__.session_id, event)
+ self.event_queue.add_listener(__request__.session_id, event) # NOQA
@export
def deregister_event_listener(self, event):
@@ -985,11 +985,11 @@ class WebApi(JSONComponent):
:param event: The event name
:type event: string
"""
- self.event_queue.remove_listener(__request__.session_id, event)
+ self.event_queue.remove_listener(__request__.session_id, event) # NOQA
@export
def get_events(self):
"""
Retrieve the pending events for the session.
"""
- return self.event_queue.get_events(__request__.session_id)
+ return self.event_queue.get_events(__request__.session_id) # NOQA
diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py
index aa5fc2d08..0b913eb59 100644
--- a/deluge/ui/web/server.py
+++ b/deluge/ui/web/server.py
@@ -127,7 +127,7 @@ class Upload(resource.Resource):
class Render(resource.Resource):
- def getChild(self, path, request):
+ def getChild(self, path, request): # NOQA
request.render_file = path
return self
@@ -152,7 +152,7 @@ class Tracker(resource.Resource):
except KeyError:
self.tracker_icons = TrackerIcons()
- def getChild(self, path, request):
+ def getChild(self, path, request): # NOQA
request.tracker_name = path
return self
@@ -175,7 +175,7 @@ class Tracker(resource.Resource):
class Flag(resource.Resource):
- def getChild(self, path, request):
+ def getChild(self, path, request): # NOQA
request.country = path
return self
@@ -202,18 +202,18 @@ class LookupResource(resource.Resource, component.Component):
self.__paths = {}
for directory in directories:
- self.addDirectory(directory)
+ self.add_directory(directory)
- def addDirectory(self, directory, path=""):
+ def add_directory(self, directory, path=""):
log.debug("Adding directory `%s` with path `%s`", directory, path)
paths = self.__paths.setdefault(path, [])
paths.append(directory)
- def removeDirectory(self, directory, path=""):
+ def remove_directory(self, directory, path=""):
log.debug("Removing directory `%s`", directory)
self.__paths[path].remove(directory)
- def getChild(self, path, request):
+ def getChild(self, path, request): # NOQA
if hasattr(request, 'lookup_path'):
request.lookup_path = os.path.join(request.lookup_path, path)
else:
@@ -365,7 +365,7 @@ class ScriptResource(resource.Resource, component.Component):
scripts.append("js/" + path)
return scripts
- def getChild(self, path, request):
+ def getChild(self, path, request): # NOQA
if hasattr(request, "lookup_path"):
request.lookup_path += '/' + path
else:
@@ -475,13 +475,13 @@ class TopLevel(resource.Resource):
self.__scripts.remove(script)
self.__debug_scripts.remove(script)
- def getChild(self, path, request):
+ def getChild(self, path, request): # NOQA
if path == "":
return self
else:
return resource.Resource.getChild(self, path, request)
- def getChildWithDefault(self, path, request):
+ def getChildWithDefault(self, path, request): # NOQA
# Calculate the request base
header = request.getHeader('x-deluge-base')
base = header if header else component.get("DelugeWeb").base
@@ -540,7 +540,7 @@ class TopLevel(resource.Resource):
class ServerContextFactory:
- def getContext(self):
+ def getContext(self): # NOQA
"""Creates an SSL context."""
ctx = SSL.Context(SSL.SSLv3_METHOD)
deluge_web = component.get("DelugeWeb")