[Lint] Refactor flake8 noqa's and add msg numbers
From pep8-naming: * N802: function name should be lowercase * N803: argument name should be lowercase
This commit is contained in:
parent
af6b277d28
commit
e37c817151
|
@ -99,7 +99,7 @@ class _ConfigManager(object):
|
||||||
_configmanager = _ConfigManager()
|
_configmanager = _ConfigManager()
|
||||||
|
|
||||||
|
|
||||||
def ConfigManager(config, defaults=None, file_version=1): # NOQA
|
def ConfigManager(config, defaults=None, file_version=1): # NOQA: N802
|
||||||
return _configmanager.get_config(config, defaults=defaults, file_version=file_version)
|
return _configmanager.get_config(config, defaults=defaults, file_version=file_version)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -90,7 +90,7 @@ def format_request(call):
|
||||||
|
|
||||||
|
|
||||||
class ServerContextFactory(object):
|
class ServerContextFactory(object):
|
||||||
def getContext(self): # NOQA
|
def getContext(self): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
Create an SSL context.
|
Create an SSL context.
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
# log.debug("RPCRequest: %s", format_request(call))
|
# log.debug("RPCRequest: %s", format_request(call))
|
||||||
reactor.callLater(0, self.dispatch, *call)
|
reactor.callLater(0, self.dispatch, *call)
|
||||||
|
|
||||||
def sendData(self, data): # NOQA
|
def sendData(self, data): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
Sends the data to the client.
|
Sends the data to the client.
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
log.exception(ex)
|
log.exception(ex)
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def connectionMade(self): # NOQA
|
def connectionMade(self): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
This method is called when a new client connects.
|
This method is called when a new client connects.
|
||||||
"""
|
"""
|
||||||
|
@ -159,7 +159,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
# Set the initial auth level of this session to AUTH_LEVEL_NONE
|
# Set the initial auth level of this session to AUTH_LEVEL_NONE
|
||||||
self.factory.authorized_sessions[self.transport.sessionno] = AUTH_LEVEL_NONE
|
self.factory.authorized_sessions[self.transport.sessionno] = AUTH_LEVEL_NONE
|
||||||
|
|
||||||
def connectionLost(self, reason=connectionDone): # NOQA
|
def connectionLost(self, reason=connectionDone): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
This method is called when the client is disconnected.
|
This method is called when the client is disconnected.
|
||||||
|
|
||||||
|
|
|
@ -52,11 +52,11 @@ class HTTPDownloader(client.HTTPDownloader):
|
||||||
agent = 'Deluge/%s (http://deluge-torrent.org)' % get_version()
|
agent = 'Deluge/%s (http://deluge-torrent.org)' % get_version()
|
||||||
client.HTTPDownloader.__init__(self, url, filename, headers=headers, agent=agent)
|
client.HTTPDownloader.__init__(self, url, filename, headers=headers, agent=agent)
|
||||||
|
|
||||||
def gotStatus(self, version, status, message): # NOQA
|
def gotStatus(self, version, status, message): # NOQA: N802
|
||||||
self.code = int(status)
|
self.code = int(status)
|
||||||
client.HTTPDownloader.gotStatus(self, version, status, message)
|
client.HTTPDownloader.gotStatus(self, version, status, message)
|
||||||
|
|
||||||
def gotHeaders(self, headers): # NOQA
|
def gotHeaders(self, headers): # NOQA: N802
|
||||||
if self.code == http.OK:
|
if self.code == http.OK:
|
||||||
if 'content-length' in headers:
|
if 'content-length' in headers:
|
||||||
self.total_length = int(headers['content-length'][0])
|
self.total_length = int(headers['content-length'][0])
|
||||||
|
@ -92,7 +92,7 @@ class HTTPDownloader(client.HTTPDownloader):
|
||||||
|
|
||||||
return client.HTTPDownloader.gotHeaders(self, headers)
|
return client.HTTPDownloader.gotHeaders(self, headers)
|
||||||
|
|
||||||
def pagePart(self, data): # NOQA
|
def pagePart(self, data): # NOQA: N802
|
||||||
if self.code == http.OK:
|
if self.code == http.OK:
|
||||||
self.current_length += len(data)
|
self.current_length += len(data)
|
||||||
if self.decoder:
|
if self.decoder:
|
||||||
|
@ -102,7 +102,7 @@ class HTTPDownloader(client.HTTPDownloader):
|
||||||
|
|
||||||
return client.HTTPDownloader.pagePart(self, data)
|
return client.HTTPDownloader.pagePart(self, data)
|
||||||
|
|
||||||
def pageEnd(self): # NOQA
|
def pageEnd(self): # NOQA: N802
|
||||||
if self.decoder:
|
if self.decoder:
|
||||||
data = self.decoder.flush()
|
data = self.decoder.flush()
|
||||||
self.current_length -= len(data)
|
self.current_length -= len(data)
|
||||||
|
@ -202,7 +202,7 @@ def _download_file(url, filename, callback=None, headers=None, force_filename=Fa
|
||||||
"""
|
"""
|
||||||
A custom context factory to add a server name for TLS connections.
|
A custom context factory to add a server name for TLS connections.
|
||||||
"""
|
"""
|
||||||
def getContext(self): # NOQA
|
def getContext(self): # NOQA: N802
|
||||||
ctx = ssl.ClientContextFactory.getContext(self)
|
ctx = ssl.ClientContextFactory.getContext(self)
|
||||||
ClientTLSOptions(host, ctx)
|
ClientTLSOptions(host, ctx)
|
||||||
return ctx
|
return ctx
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Logging(LoggingLoggerClass):
|
||||||
def exception(self, msg, *args, **kwargs):
|
def exception(self, msg, *args, **kwargs):
|
||||||
yield LoggingLoggerClass.exception(self, msg, *args, **kwargs)
|
yield LoggingLoggerClass.exception(self, msg, *args, **kwargs)
|
||||||
|
|
||||||
def findCaller(self): # NOQA
|
def findCaller(self): # NOQA: N802
|
||||||
f = logging.currentframe().f_back
|
f = logging.currentframe().f_back
|
||||||
rv = '(unknown file)', 0, '(unknown function)'
|
rv = '(unknown file)', 0, '(unknown function)'
|
||||||
while hasattr(f, 'f_code'):
|
while hasattr(f, 'f_code'):
|
||||||
|
|
|
@ -13,7 +13,7 @@ import gzip
|
||||||
import zipfile
|
import zipfile
|
||||||
|
|
||||||
|
|
||||||
def Zipped(reader): # NOQA
|
def Zipped(reader): # NOQA: N802
|
||||||
"""Blocklist reader for zipped blocklists"""
|
"""Blocklist reader for zipped blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
z = zipfile.ZipFile(self.file)
|
z = zipfile.ZipFile(self.file)
|
||||||
|
@ -28,7 +28,7 @@ def Zipped(reader): # NOQA
|
||||||
return reader
|
return reader
|
||||||
|
|
||||||
|
|
||||||
def GZipped(reader): # NOQA
|
def GZipped(reader): # NOQA: N802
|
||||||
"""Blocklist reader for gzipped blocklists"""
|
"""Blocklist reader for gzipped blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
return gzip.open(self.file)
|
return gzip.open(self.file)
|
||||||
|
@ -36,7 +36,7 @@ def GZipped(reader): # NOQA
|
||||||
return reader
|
return reader
|
||||||
|
|
||||||
|
|
||||||
def BZipped2(reader): # NOQA
|
def BZipped2(reader): # NOQA: N802
|
||||||
"""Blocklist reader for bzipped2 blocklists"""
|
"""Blocklist reader for bzipped2 blocklists"""
|
||||||
def open(self):
|
def open(self):
|
||||||
return bz2.BZ2File(self.file)
|
return bz2.BZ2File(self.file)
|
||||||
|
|
|
@ -21,6 +21,11 @@ from deluge import configmanager
|
||||||
from deluge.core.rpcserver import export
|
from deluge.core.rpcserver import export
|
||||||
from deluge.plugins.pluginbase import CorePluginBase
|
from deluge.plugins.pluginbase import CorePluginBase
|
||||||
|
|
||||||
|
try:
|
||||||
|
from deluge.ui.web import server
|
||||||
|
except ImportError:
|
||||||
|
server = False
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
DEFAULT_PREFS = {
|
DEFAULT_PREFS = {
|
||||||
|
@ -49,17 +54,20 @@ class Core(CorePluginBase):
|
||||||
|
|
||||||
@export
|
@export
|
||||||
def got_deluge_web(self):
|
def got_deluge_web(self):
|
||||||
try:
|
"""Status of deluge-web module installation.
|
||||||
from deluge.ui.web import server # noqa pylint: disable=unused-import
|
|
||||||
return True
|
Check if deluge.ui.web.server modulge is installed and has been successfully imported.
|
||||||
except ImportError:
|
|
||||||
return False
|
Returns:
|
||||||
|
bool: True is deluge-web is installed and available, otherwise False.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
return bool(server)
|
||||||
|
|
||||||
def start_server(self):
|
def start_server(self):
|
||||||
if not self.server:
|
if not self.server:
|
||||||
try:
|
if not self.got_deluge_web():
|
||||||
from deluge.ui.web import server
|
|
||||||
except ImportError:
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -13,7 +13,7 @@ class BaseTestCase(unittest.TestCase):
|
||||||
have finished.
|
have finished.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA: N803
|
||||||
|
|
||||||
if len(component._ComponentRegistry.components) != 0:
|
if len(component._ComponentRegistry.components) != 0:
|
||||||
warnings.warn('The component._ComponentRegistry.components is not empty on test setup.\n'
|
warnings.warn('The component._ComponentRegistry.components is not empty on test setup.\n'
|
||||||
|
@ -27,7 +27,7 @@ class BaseTestCase(unittest.TestCase):
|
||||||
|
|
||||||
return d.addErrback(on_setup_error)
|
return d.addErrback(on_setup_error)
|
||||||
|
|
||||||
def tearDown(self): # NOQA
|
def tearDown(self): # NOQA: N803
|
||||||
d = maybeDeferred(self.tear_down)
|
d = maybeDeferred(self.tear_down)
|
||||||
|
|
||||||
def on_teardown_failed(error):
|
def on_teardown_failed(error):
|
||||||
|
|
|
@ -97,7 +97,7 @@ class ReactorOverride(object):
|
||||||
def _stop(self):
|
def _stop(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def addReader(self, arg): # NOQA
|
def addReader(self, arg): # NOQA: N802
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,11 +123,11 @@ class ProcessOutputHandler(protocol.ProcessProtocol):
|
||||||
self.killed = False
|
self.killed = False
|
||||||
self.watchdogs = []
|
self.watchdogs = []
|
||||||
|
|
||||||
def connectionMade(self): # NOQA
|
def connectionMade(self): # NOQA: N802
|
||||||
self.transport.write(self.script)
|
self.transport.write(self.script)
|
||||||
self.transport.closeStdin()
|
self.transport.closeStdin()
|
||||||
|
|
||||||
def outConnectionLost(self): # NOQA
|
def outConnectionLost(self): # NOQA: N802
|
||||||
if not self.logfile:
|
if not self.logfile:
|
||||||
return
|
return
|
||||||
with open(self.logfile, 'w') as f:
|
with open(self.logfile, 'w') as f:
|
||||||
|
@ -154,7 +154,7 @@ class ProcessOutputHandler(protocol.ProcessProtocol):
|
||||||
if not w.called and not w.cancelled:
|
if not w.called and not w.cancelled:
|
||||||
w.cancel()
|
w.cancel()
|
||||||
|
|
||||||
def processEnded(self, status): # NOQA
|
def processEnded(self, status): # NOQA: N802
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
if self.quit_d is None:
|
if self.quit_d is None:
|
||||||
return
|
return
|
||||||
|
@ -183,7 +183,7 @@ class ProcessOutputHandler(protocol.ProcessProtocol):
|
||||||
c['deferred'].callback(val)
|
c['deferred'].callback(val)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def outReceived(self, data): # NOQA
|
def outReceived(self, data): # NOQA: N802
|
||||||
"""Process output from stdout"""
|
"""Process output from stdout"""
|
||||||
self.log_output += data
|
self.log_output += data
|
||||||
if self.check_callbacks(data):
|
if self.check_callbacks(data):
|
||||||
|
@ -191,7 +191,7 @@ class ProcessOutputHandler(protocol.ProcessProtocol):
|
||||||
elif '[ERROR' in data:
|
elif '[ERROR' in data:
|
||||||
print(data, end=' ')
|
print(data, end=' ')
|
||||||
|
|
||||||
def errReceived(self, data): # NOQA
|
def errReceived(self, data): # NOQA: N802
|
||||||
"""Process output from stderr"""
|
"""Process output from stderr"""
|
||||||
self.log_output += data
|
self.log_output += data
|
||||||
self.stderr_out += data
|
self.stderr_out += data
|
||||||
|
|
|
@ -14,7 +14,7 @@ DEFAULTS = {'string': 'foobar', 'int': 1, 'float': 0.435, 'bool': True, 'unicode
|
||||||
|
|
||||||
|
|
||||||
class ConfigTestCase(unittest.TestCase):
|
class ConfigTestCase(unittest.TestCase):
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA: N803
|
||||||
self.config_dir = set_tmp_config_dir()
|
self.config_dir = set_tmp_config_dir()
|
||||||
|
|
||||||
def test_init(self):
|
def test_init(self):
|
||||||
|
|
|
@ -4,10 +4,10 @@ import deluge.error
|
||||||
|
|
||||||
|
|
||||||
class ErrorTestCase(unittest.TestCase):
|
class ErrorTestCase(unittest.TestCase):
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA: N803
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def tearDown(self): # NOQA
|
def tearDown(self): # NOQA: N803
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_deluge_error(self):
|
def test_deluge_error(self):
|
||||||
|
|
|
@ -92,7 +92,7 @@ class TopLevelResource(Resource):
|
||||||
self.putChild('rename', RenameResource())
|
self.putChild('rename', RenameResource())
|
||||||
self.putChild('partial', PartialDownloadResource())
|
self.putChild('partial', PartialDownloadResource())
|
||||||
|
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N803
|
||||||
if path == '':
|
if path == '':
|
||||||
return self
|
return self
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -106,7 +106,7 @@ class TransferTestClass(DelugeTransferProtocol):
|
||||||
|
|
||||||
class DelugeTransferProtocolTestCase(unittest.TestCase):
|
class DelugeTransferProtocolTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA: N803
|
||||||
"""
|
"""
|
||||||
The expected messages corresponds to the test messages (msg1, msg2) after they've been processed
|
The expected messages corresponds to the test messages (msg1, msg2) after they've been processed
|
||||||
by DelugeTransferProtocol.send, which means that they've first been encoded with pickle,
|
by DelugeTransferProtocol.send, which means that they've first been encoded with pickle,
|
||||||
|
|
|
@ -15,10 +15,10 @@ from . import common
|
||||||
|
|
||||||
class UICommonTestCase(unittest.TestCase):
|
class UICommonTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA: N803
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def tearDown(self): # NOQA
|
def tearDown(self): # NOQA: N803
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_utf8_encoded_paths(self):
|
def test_utf8_encoded_paths(self):
|
||||||
|
|
|
@ -14,10 +14,10 @@ class Parent(object):
|
||||||
|
|
||||||
class UICommonTestCase(unittest.TestCase):
|
class UICommonTestCase(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self): # NOQA
|
def setUp(self): # NOQA: N803
|
||||||
self.parent = Parent()
|
self.parent = Parent()
|
||||||
|
|
||||||
def tearDown(self): # NOQA
|
def tearDown(self): # NOQA: N803
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def test_text_input(self):
|
def test_text_input(self):
|
||||||
|
|
|
@ -10,7 +10,7 @@ from zope.interface import implements
|
||||||
class _Reporter(object):
|
class _Reporter(object):
|
||||||
implements(IPlugin, IReporter)
|
implements(IPlugin, IReporter)
|
||||||
|
|
||||||
def __init__(self, name, module, description, longOpt, shortOpt, klass): # NOQA
|
def __init__(self, name, module, description, longOpt, shortOpt, klass): # NOQA: N803
|
||||||
self.name = name
|
self.name = name
|
||||||
self.module = module
|
self.module = module
|
||||||
self.description = description
|
self.description = description
|
||||||
|
@ -32,6 +32,6 @@ class DelugeReporter(TreeReporter):
|
||||||
os.environ['DELUGE_REPORTER'] = 'true'
|
os.environ['DELUGE_REPORTER'] = 'true'
|
||||||
TreeReporter.__init__(self, *args, **kwargs)
|
TreeReporter.__init__(self, *args, **kwargs)
|
||||||
|
|
||||||
def addExpectedFailure(self, *args): # NOQA
|
def addExpectedFailure(self, *args): # NOQA: N802
|
||||||
# super(TreeReporter, self).addExpectedFailure(*args)
|
# super(TreeReporter, self).addExpectedFailure(*args)
|
||||||
self.endLine('[TODO]', self.TODO)
|
self.endLine('[TODO]', self.TODO)
|
||||||
|
|
|
@ -56,7 +56,7 @@ class DelugeTransferProtocol(Protocol, object):
|
||||||
self.transport.write(header)
|
self.transport.write(header)
|
||||||
self.transport.write(compressed)
|
self.transport.write(compressed)
|
||||||
|
|
||||||
def dataReceived(self, data): # NOQA
|
def dataReceived(self, data): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
This method is called whenever data is received.
|
This method is called whenever data is received.
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ class DelugeRPCRequest(object):
|
||||||
|
|
||||||
class DelugeRPCProtocol(DelugeTransferProtocol):
|
class DelugeRPCProtocol(DelugeTransferProtocol):
|
||||||
|
|
||||||
def connectionMade(self): # NOQA
|
def connectionMade(self): # NOQA: N802
|
||||||
self.__rpc_requests = {}
|
self.__rpc_requests = {}
|
||||||
# Set the protocol in the daemon so it can send data
|
# Set the protocol in the daemon so it can send data
|
||||||
self.factory.daemon.protocol = self
|
self.factory.daemon.protocol = self
|
||||||
|
@ -192,16 +192,16 @@ class DelugeRPCClientFactory(ClientFactory):
|
||||||
self.daemon = daemon
|
self.daemon = daemon
|
||||||
self.event_handlers = event_handlers
|
self.event_handlers = event_handlers
|
||||||
|
|
||||||
def startedConnecting(self, connector): # NOQA
|
def startedConnecting(self, connector): # NOQA: N802
|
||||||
log.debug('Connecting to daemon at "%s:%s"...',
|
log.debug('Connecting to daemon at "%s:%s"...',
|
||||||
connector.host, connector.port)
|
connector.host, connector.port)
|
||||||
|
|
||||||
def clientConnectionFailed(self, connector, reason): # NOQA
|
def clientConnectionFailed(self, connector, reason): # NOQA: N802
|
||||||
log.debug('Connection to daemon at "%s:%s" failed: %s',
|
log.debug('Connection to daemon at "%s:%s" failed: %s',
|
||||||
connector.host, connector.port, reason.value)
|
connector.host, connector.port, reason.value)
|
||||||
self.daemon.connect_deferred.errback(reason)
|
self.daemon.connect_deferred.errback(reason)
|
||||||
|
|
||||||
def clientConnectionLost(self, connector, reason): # NOQA
|
def clientConnectionLost(self, connector, reason): # NOQA: N802
|
||||||
log.debug('Connection lost to daemon at "%s:%s" reason: %s',
|
log.debug('Connection lost to daemon at "%s:%s" reason: %s',
|
||||||
connector.host, connector.port, reason.value)
|
connector.host, connector.port, reason.value)
|
||||||
self.daemon.host = None
|
self.daemon.host = None
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
from deluge.ui.console.cmdline.command import BaseCommand # NOQA
|
from deluge.ui.console.cmdline.command import BaseCommand
|
||||||
|
|
||||||
|
__all__ = ['BaseCommand']
|
||||||
|
|
|
@ -86,11 +86,11 @@ class CursesStdIO(object):
|
||||||
""" We want to select on FD 0 """
|
""" We want to select on FD 0 """
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def doRead(self): # NOQA
|
def doRead(self): # NOQA: N802
|
||||||
"""called when input is ready"""
|
"""called when input is ready"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def logPrefix(self): # NOQA
|
def logPrefix(self): # NOQA: N802
|
||||||
return 'CursesClient'
|
return 'CursesClient'
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ class BaseMode(CursesStdIO, component.Component):
|
||||||
def on_resize(self, rows, cols):
|
def on_resize(self, rows, cols):
|
||||||
self.rows, self.cols = rows, cols
|
self.rows, self.cols = rows, cols
|
||||||
|
|
||||||
def connectionLost(self, reason): # NOQA
|
def connectionLost(self, reason): # NOQA: N802
|
||||||
self.close()
|
self.close()
|
||||||
|
|
||||||
def add_string(self, row, string, scr=None, **kwargs):
|
def add_string(self, row, string, scr=None, **kwargs):
|
||||||
|
@ -194,7 +194,7 @@ class BaseMode(CursesStdIO, component.Component):
|
||||||
self.stdscr.redrawwin()
|
self.stdscr.redrawwin()
|
||||||
self.stdscr.refresh()
|
self.stdscr.refresh()
|
||||||
|
|
||||||
def doRead(self): # NOQA
|
def doRead(self): # NOQA: N802
|
||||||
"""
|
"""
|
||||||
Called when there is data to be read, ie, input from the keyboard.
|
Called when there is data to be read, ie, input from the keyboard.
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
from deluge.ui.console.modes.preferences.preferences import Preferences # NOQA
|
from deluge.ui.console.modes.preferences.preferences import Preferences
|
||||||
|
|
||||||
|
__all__ = ['Preferences']
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
from deluge.ui.console.widgets.inputpane import BaseInputPane # NOQA
|
from deluge.ui.console.widgets.inputpane import BaseInputPane
|
||||||
from deluge.ui.console.widgets.statusbars import StatusBars # NOQA
|
from deluge.ui.console.widgets.statusbars import StatusBars
|
||||||
from deluge.ui.console.widgets.window import BaseWindow # NOQA
|
from deluge.ui.console.widgets.window import BaseWindow
|
||||||
|
|
||||||
|
__all__ = ['BaseInputPane', 'StatusBars', 'BaseWindow']
|
||||||
|
|
|
@ -38,7 +38,7 @@ class IPCProtocolServer(Protocol):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def dataReceived(self, data): # NOQA
|
def dataReceived(self, data): # NOQA: N802
|
||||||
config = ConfigManager('gtkui.conf')
|
config = ConfigManager('gtkui.conf')
|
||||||
data = rencode.loads(data, decode_utf8=True)
|
data = rencode.loads(data, decode_utf8=True)
|
||||||
if not data or config['focus_main_window_on_add']:
|
if not data or config['focus_main_window_on_add']:
|
||||||
|
@ -51,11 +51,11 @@ class IPCProtocolClient(Protocol):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def connectionMade(self): # NOQA
|
def connectionMade(self): # NOQA: N802
|
||||||
self.transport.write(rencode.dumps(self.factory.args))
|
self.transport.write(rencode.dumps(self.factory.args))
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
|
|
||||||
def connectionLost(self, reason=connectionDone): # NOQA
|
def connectionLost(self, reason=connectionDone): # NOQA: N802
|
||||||
reactor.stop()
|
reactor.stop()
|
||||||
self.factory.stop = True
|
self.factory.stop = True
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ class IPCClientFactory(ClientFactory):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.stop = False
|
self.stop = False
|
||||||
|
|
||||||
def clientConnectionFailed(self, connector, reason): # NOQA
|
def clientConnectionFailed(self, connector, reason): # NOQA: N802
|
||||||
log.warning('Connection to running instance failed.')
|
log.warning('Connection to running instance failed.')
|
||||||
reactor.stop()
|
reactor.stop()
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,11 @@ from deluge.ui.gtkui.dialogs import AccountDialog, ErrorDialog, InformationDialo
|
||||||
from deluge.ui.gtkui.path_chooser import PathChooser
|
from deluge.ui.gtkui.path_chooser import PathChooser
|
||||||
from deluge.ui.util import lang
|
from deluge.ui.util import lang
|
||||||
|
|
||||||
|
try:
|
||||||
|
import appindicator
|
||||||
|
except ImportError:
|
||||||
|
appindicator = False
|
||||||
|
|
||||||
pygtk.require('2.0')
|
pygtk.require('2.0')
|
||||||
|
|
||||||
|
|
||||||
|
@ -148,13 +153,8 @@ class Preferences(component.Component):
|
||||||
'on_checkbutton_language_toggled': self._on_checkbutton_language_toggled,
|
'on_checkbutton_language_toggled': self._on_checkbutton_language_toggled,
|
||||||
})
|
})
|
||||||
|
|
||||||
if not deluge.common.osx_check() and not deluge.common.windows_check():
|
# Radio buttons to choose between systray and appindicator
|
||||||
try:
|
self.builder.get_object('alignment_tray_type').set_visible(appindicator)
|
||||||
import appindicator # noqa pylint: disable=unused-import
|
|
||||||
except ImportError:
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
self.builder.get_object('alignment_tray_type').set_visible(True)
|
|
||||||
|
|
||||||
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
|
from deluge.ui.gtkui.gtkui import DEFAULT_PREFS
|
||||||
self.COLOR_DEFAULTS = {}
|
self.COLOR_DEFAULTS = {}
|
||||||
|
|
|
@ -27,7 +27,7 @@ try:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
PIL_INSTALLED = False
|
PIL_INSTALLED = False
|
||||||
else:
|
else:
|
||||||
import deluge.ui.Win32IconImagePlugin # noqa pylint: disable=unused-import, ungrouped-imports
|
import deluge.ui.Win32IconImagePlugin # NOQA pylint: disable=unused-import, ungrouped-imports
|
||||||
PIL_INSTALLED = True
|
PIL_INSTALLED = True
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
|
@ -124,7 +124,7 @@ class Upload(resource.Resource):
|
||||||
|
|
||||||
class Render(resource.Resource):
|
class Render(resource.Resource):
|
||||||
|
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N802
|
||||||
request.render_file = path
|
request.render_file = path
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ class Tracker(resource.Resource):
|
||||||
except KeyError:
|
except KeyError:
|
||||||
self.tracker_icons = TrackerIcons()
|
self.tracker_icons = TrackerIcons()
|
||||||
|
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N802
|
||||||
request.tracker_name = path
|
request.tracker_name = path
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ class Tracker(resource.Resource):
|
||||||
|
|
||||||
|
|
||||||
class Flag(resource.Resource):
|
class Flag(resource.Resource):
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N802
|
||||||
request.country = path
|
request.country = path
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ class LookupResource(resource.Resource, component.Component):
|
||||||
log.debug('Removing directory `%s`', directory)
|
log.debug('Removing directory `%s`', directory)
|
||||||
self.__paths[path].remove(directory)
|
self.__paths[path].remove(directory)
|
||||||
|
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N802
|
||||||
if hasattr(request, 'lookup_path'):
|
if hasattr(request, 'lookup_path'):
|
||||||
request.lookup_path = os.path.join(request.lookup_path, path)
|
request.lookup_path = os.path.join(request.lookup_path, path)
|
||||||
else:
|
else:
|
||||||
|
@ -365,7 +365,7 @@ class ScriptResource(resource.Resource, component.Component):
|
||||||
scripts.append('js/' + path)
|
scripts.append('js/' + path)
|
||||||
return scripts
|
return scripts
|
||||||
|
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N802
|
||||||
if hasattr(request, 'lookup_path'):
|
if hasattr(request, 'lookup_path'):
|
||||||
request.lookup_path += '/' + path
|
request.lookup_path += '/' + path
|
||||||
else:
|
else:
|
||||||
|
@ -477,13 +477,13 @@ class TopLevel(resource.Resource):
|
||||||
self.__scripts.remove(script)
|
self.__scripts.remove(script)
|
||||||
self.__debug_scripts.remove(script)
|
self.__debug_scripts.remove(script)
|
||||||
|
|
||||||
def getChild(self, path, request): # NOQA
|
def getChild(self, path, request): # NOQA: N802
|
||||||
if path == '':
|
if path == '':
|
||||||
return self
|
return self
|
||||||
else:
|
else:
|
||||||
return resource.Resource.getChild(self, path, request)
|
return resource.Resource.getChild(self, path, request)
|
||||||
|
|
||||||
def getChildWithDefault(self, path, request): # NOQA
|
def getChildWithDefault(self, path, request): # NOQA: N802
|
||||||
# Calculate the request base
|
# Calculate the request base
|
||||||
header = request.getHeader('x-deluge-base')
|
header = request.getHeader('x-deluge-base')
|
||||||
base = header if header else component.get('DelugeWeb').base
|
base = header if header else component.get('DelugeWeb').base
|
||||||
|
|
Loading…
Reference in New Issue