diff --git a/deluge/core/core.py b/deluge/core/core.py
index b781501fa..3147a8a2b 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -716,7 +716,7 @@ class Core(component.Component):
:raises DelugeError: if the username is not known
"""
if not self.authmanager.has_account(username):
- raise DelugeError("Username \"%s\" is not known." % username)
+ raise DelugeError('Username "%s" is not known.' % username)
if isinstance(torrent_ids, basestring):
torrent_ids = [torrent_ids]
for torrent_id in torrent_ids:
diff --git a/deluge/core/rpcserver.py b/deluge/core/rpcserver.py
index dacfdfeb3..81b12054b 100644
--- a/deluge/core/rpcserver.py
+++ b/deluge/core/rpcserver.py
@@ -518,16 +518,16 @@ class RPCServer(component.Component):
:type event: :class:`deluge.event.DelugeEvent`
"""
if not self.is_session_valid(session_id):
- log.debug("Session ID %s is not valid. Not sending event \"%s\".", session_id, event.name)
+ log.debug('Session ID %s is not valid. Not sending event "%s".', session_id, event.name)
return
if session_id not in self.factory.interested_events:
- log.debug("Session ID %s is not interested in any events. Not sending event \"%s\".",
+ log.debug('Session ID %s is not interested in any events. Not sending event "%s".',
session_id, event.name)
return
if event.name not in self.factory.interested_events[session_id]:
- log.debug("Session ID %s is not interested in event \"%s\". Not sending it.", session_id, event.name)
+ log.debug('Session ID %s is not interested in event "%s". Not sending it.', session_id, event.name)
return
- log.debug("Sending event \"%s\" with args \"%s\" to session id \"%s\".",
+ log.debug('Sending event "%s" with args "%s" to session id "%s".',
event.name, event.args, session_id)
self.factory.session_protocols[session_id].sendData((RPC_EVENT, event.name, event.args))
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index 2ec5ffa55..190c93cd3 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -446,7 +446,7 @@ class TorrentManager(component.Component):
log.debug('Torrent added: %s', str(alert.handle.info_hash()))
if log.isEnabledFor(logging.INFO):
name_and_owner = torrent.get_status(['name', 'owner'])
- log.info("Torrent %s from user \"%s\" %s",
+ log.info('Torrent %s from user "%s" %s',
name_and_owner['name'],
name_and_owner['owner'],
from_state and 'loaded' or 'added')
diff --git a/deluge/log.py b/deluge/log.py
index d80c82a91..5f088f88a 100644
--- a/deluge/log.py
+++ b/deluge/log.py
@@ -222,7 +222,7 @@ def tweak_logging_levels():
if level not in levels:
continue
- log.warn("Setting logger \"%s\" to logging level \"%s\"", name, level)
+ log.warn('Setting logger "%s" to logging level "%s"', name, level)
set_logger_level(level, name)
diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py
index 5427e7afe..5dce5a7a4 100644
--- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py
+++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/core.py
@@ -314,7 +314,7 @@ class Core(CorePluginBase):
elif watchdir.get('copy_torrent_toggle'):
copy_torrent_path = watchdir['copy_torrent']
copy_torrent_file = os.path.join(copy_torrent_path, filename)
- log.debug("Moving added torrent file \"%s\" to \"%s\"",
+ log.debug('Moving added torrent file "%s" to "%s"',
os.path.basename(filepath), copy_torrent_path)
shutil.move(filepath, copy_torrent_file)
@@ -324,7 +324,7 @@ class Core(CorePluginBase):
def on_update_watchdir_error(self, failure, watchdir_id):
"""Disables any watch folders with un-handled exceptions."""
self.disable_watchdir(watchdir_id)
- log.error("Disabling '%s', error during update: %s",
+ log.error('Disabling "%s", error during update: %s',
self.watchdirs[watchdir_id]['path'], failure)
@export
@@ -459,9 +459,9 @@ class Core(CorePluginBase):
if os.path.isfile(torrent_fname_path):
try:
os.remove(torrent_fname_path)
- log.info("Removed torrent file \"%s\" from \"%s\"",
+ log.info('Removed torrent file "%s" from "%s"',
torrent_fname, copy_torrent_path)
break
except OSError as ex:
- log.info("Failed to removed torrent file \"%s\" from "
- "\"%s\": %s", torrent_fname, copy_torrent_path, ex)
+ log.info('Failed to removed torrent file "%s" from "%s": %s',
+ torrent_fname, copy_torrent_path, ex)
diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py
index 96a769eef..de1f103f0 100644
--- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py
+++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/gtkui.py
@@ -341,8 +341,8 @@ class OptionsDialog(object):
options[chk_id + '_toggle'] = self.glade.get_widget(chk_id + '_toggle').get_active()
if options['copy_torrent_toggle'] and options['path'] == options['copy_torrent']:
- raise IncompatibleOption(_("\"Watch Folder\" directory and \"Copy of .torrent"
- " files to\" directory cannot be the same!"))
+ raise IncompatibleOption(_('"Watch Folder" directory and "Copy of .torrent'
+ ' files to" directory cannot be the same!'))
return options
diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py
index e9017060d..65a503cfc 100644
--- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py
+++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py
@@ -100,11 +100,11 @@ class IP(object):
try:
q1, q2, q3, q4 = [int(q) for q in ip.split('.')]
except ValueError:
- raise BadIP(_("The IP address \"%s\" is badly formed" % ip))
+ raise BadIP(_('The IP address "%s" is badly formed' % ip))
if q1 < 0 or q2 < 0 or q3 < 0 or q4 < 0:
- raise BadIP(_("The IP address \"%s\" is badly formed" % ip))
+ raise BadIP(_('The IP address "%s" is badly formed' % ip))
elif q1 > 255 or q2 > 255 or q3 > 255 or q4 > 255:
- raise BadIP(_("The IP address \"%s\" is badly formed" % ip))
+ raise BadIP(_('The IP address "%s" is badly formed' % ip))
return cls(q1, q2, q3, q4)
def quadrants(self):
diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py
index bc3f7578c..3cbdd94f8 100644
--- a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py
+++ b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py
@@ -99,7 +99,7 @@ class CustomNotifications(object):
def _handled_eventtype(self, eventtype, handler):
if eventtype not in known_events:
- log.error("The event \"%s\" is not known", eventtype)
+ log.error('The event "%s" is not known', eventtype)
return False
if known_events[eventtype].__module__.startswith('deluge.event'):
if handler.__self__ is self:
diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py
index d4de6b7ef..736fefd0e 100644
--- a/deluge/plugins/Notifications/deluge/plugins/notifications/core.py
+++ b/deluge/plugins/Notifications/deluge/plugins/notifications/core.py
@@ -171,10 +171,10 @@ Date: %(date)s
torrent = component.get('TorrentManager')[torrent_id]
torrent_status = torrent.get_status({})
# Email
- subject = _("Finished Torrent \"%(name)s\"") % torrent_status
+ subject = _('Finished Torrent "%(name)s"') % torrent_status
message = _(
'This email is to inform you that Deluge has finished '
- "downloading \"%(name)s\", which includes %(num_files)i files."
+ 'downloading \"%(name)s\", which includes %(num_files)i files.'
'\nTo stop receiving these alerts, simply turn off email '
"notification in Deluge's preferences.\n\n"
'Thank you,\nDeluge.'
diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py
index faf3a1080..916960f25 100644
--- a/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py
+++ b/deluge/plugins/Notifications/deluge/plugins/notifications/gtkui.py
@@ -222,7 +222,7 @@ class GtkUiNotifications(CustomNotifications):
'Got Torrent Status')
title = _('Finished Torrent')
torrent_status['num_files'] = torrent_status['file_progress'].count(1.0)
- message = _("The torrent \"%(name)s\" including %(num_files)i file(s) "
+ message = _('The torrent \"%(name)s\" including %(num_files)i file(s) '
'has finished downloading.') % torrent_status
return title, message
@@ -472,7 +472,7 @@ class GtkUI(GtkPluginBase, GtkUiNotifications):
old_sound_file, new_sound_file)
custom_sounds = {}
for event_name, event_doc, filename, filepath in self.sounds_model:
- log.debug("Custom sound for event \"%s\": %s", event_name, filename)
+ log.debug('Custom sound for event "%s": %s', event_name, filename)
if filepath == old_sound_file:
continue
custom_sounds[event_name] = filepath
diff --git a/deluge/ui/client.py b/deluge/ui/client.py
index a07f21d47..1bcfbdd4a 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -193,16 +193,16 @@ class DelugeRPCClientFactory(ClientFactory):
self.event_handlers = event_handlers
def startedConnecting(self, connector): # NOQA
- log.debug("Connecting to daemon at \"%s:%s\"...",
+ log.debug('Connecting to daemon at "%s:%s"...',
connector.host, connector.port)
def clientConnectionFailed(self, connector, reason): # NOQA
- 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)
self.daemon.connect_deferred.errback(reason)
def clientConnectionLost(self, connector, reason): # NOQA
- 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)
self.daemon.host = None
self.daemon.port = None
diff --git a/deluge/ui/console/cmdline/commands/move.py b/deluge/ui/console/cmdline/commands/move.py
index f04523258..b7476bb28 100644
--- a/deluge/ui/console/cmdline/commands/move.py
+++ b/deluge/ui/console/cmdline/commands/move.py
@@ -40,7 +40,7 @@ class Command(BaseCommand):
names.append(self.console.get_torrent_name(tid))
def on_move(res):
- msg = "Moved \"%s\" to %s" % (', '.join(names), options.path)
+ msg = 'Moved "%s" to %s' % (', '.join(names), options.path)
self.console.write(msg)
log.info(msg)
diff --git a/deluge/ui/console/modes/torrentdetail.py b/deluge/ui/console/modes/torrentdetail.py
index 95f934ce8..f3ec59e9a 100644
--- a/deluge/ui/console/modes/torrentdetail.py
+++ b/deluge/ui/console/modes/torrentdetail.py
@@ -454,7 +454,7 @@ class TorrentDetail(BaseMode, PopupsHandler):
# Tracker
tracker_color = '{!green!}' if status['message'] == 'OK' else '{!red!}'
- s = "{!info!}%s: {!magenta!}%s{!input!} says \"%s%s{!input!}\"" % (
+ s = '{!info!}%s: {!magenta!}%s{!input!} says "%s%s{!input!}"' % (
torrent_data_fields['tracker']['name'], status['tracker_host'], tracker_color, status['message'])
row = self.add_string(row, s)
diff --git a/deluge/ui/gtkui/aboutdialog.py b/deluge/ui/gtkui/aboutdialog.py
index 3ddf489ab..288162ba3 100644
--- a/deluge/ui/gtkui/aboutdialog.py
+++ b/deluge/ui/gtkui/aboutdialog.py
@@ -167,7 +167,7 @@ class AboutDialog(object):
'Pål-Eivind Johnsen', 'pano', 'Paolo Naldini', 'Paracelsus',
'Patryk13_03', 'Patryk Skorupa', 'PattogoTehen', 'Paul Lange',
'Pavcio', 'Paweł Wysocki', 'Pedro Brites Moita',
- 'Pedro Clemente Pereira Neto', "Pekka \"PEXI\" Niemistö", 'Penegal',
+ 'Pedro Clemente Pereira Neto', 'Pekka \"PEXI\" Niemistö', 'Penegal',
'Penzo', 'perdido', 'Peter Kotrcka', 'Peter Skov',
'Peter Van den Bosch', 'Petter Eklund', 'Petter Viklund',
'phatsphere', 'Phenomen', 'Philipi', 'Philippides Homer', 'phoenix',
diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py
index 89c08ceca..48ae31061 100644
--- a/deluge/ui/gtkui/connectionmanager.py
+++ b/deluge/ui/gtkui/connectionmanager.py
@@ -530,7 +530,7 @@ class ConnectionManager(component.Component):
msg = str(reason.value)
if not self.builder.get_object('chk_autostart').get_active():
msg += '\n' + _('Auto-starting the daemon locally is not enabled. '
- "See \"Options\" on the \"Connection Manager\".")
+ 'See "Options" on the "Connection Manager".')
ErrorDialog(_('Failed To Connect'), msg).run()
def on_button_connect_clicked(self, widget=None):
diff --git a/deluge/ui/gtkui/listview.py b/deluge/ui/gtkui/listview.py
index 27ea626b8..81dd28e64 100644
--- a/deluge/ui/gtkui/listview.py
+++ b/deluge/ui/gtkui/listview.py
@@ -665,7 +665,7 @@ class ListView(object):
continue
column = find_column(col_state.name)
if not column:
- log.debug("Could not find column matching \"%s\" on state.", col_state.name)
+ log.debug('Could not find column matching "%s" on state.', col_state.name)
# The cases where I've found that the column could not be found
# is when not using the english locale, ie, the default one, or
# when changing locales between runs.
diff --git a/deluge/ui/gtkui/menubar.py b/deluge/ui/gtkui/menubar.py
index e002d5006..2c50eac46 100644
--- a/deluge/ui/gtkui/menubar.py
+++ b/deluge/ui/gtkui/menubar.py
@@ -552,7 +552,7 @@ class MenuBar(component.Component):
update_torrents.append(torrent_id)
if update_torrents:
- log.debug("Setting torrent owner \"%s\" on %s", username, update_torrents)
+ log.debug('Setting torrent owner "%s" on %s', username, update_torrents)
def failed_change_owner(failure):
ErrorDialog(
diff --git a/deluge/ui/gtkui/preferences.py b/deluge/ui/gtkui/preferences.py
index 35db664ad..6b6891637 100644
--- a/deluge/ui/gtkui/preferences.py
+++ b/deluge/ui/gtkui/preferences.py
@@ -1105,8 +1105,8 @@ class Preferences(component.Component):
username = model[itr][0]
header = _('Remove Account')
- text = _("Are you sure you wan't do remove the account with the "
- "username \"%(username)s\"?" % dict(username=username))
+ text = _('Are you sure you want to remove the account with the '
+ 'username "%(username)s"?' % dict(username=username))
dialog = YesNoDialog(header, text, parent=self.pref_dialog)
def dialog_finished(response_id):
diff --git a/deluge/ui/gtkui/statusbar.py b/deluge/ui/gtkui/statusbar.py
index 61b3e7836..4b032f7f5 100644
--- a/deluge/ui/gtkui/statusbar.py
+++ b/deluge/ui/gtkui/statusbar.py
@@ -328,7 +328,7 @@ class StatusBar(component.Component):
if space >= 0:
self.diskspace_item.set_markup('%s' % fsize(space, shortform=True))
else:
- self.diskspace_item.set_markup("" + _('Error') + '')
+ self.diskspace_item.set_markup('' + _('Error') + '')
def _on_max_download_speed(self, max_download_speed):
self.max_download_speed = max_download_speed
diff --git a/packaging/win32/deluge-bbfreeze.py b/packaging/win32/deluge-bbfreeze.py
index e67399f50..dd69f13a2 100644
--- a/packaging/win32/deluge-bbfreeze.py
+++ b/packaging/win32/deluge-bbfreeze.py
@@ -184,7 +184,7 @@ for script in script_list:
# Copy version info to file for nsis script.
with open('VERSION.tmp', 'w') as ver_file:
- ver_file.write("build_version = \"%s\"" % build_version)
+ ver_file.write('build_version = "%s"' % build_version)
# Create the install and uninstall file list for NSIS.
filedir_list = []
diff --git a/tox.ini b/tox.ini
index adb6c5a02..96517a4f1 100644
--- a/tox.ini
+++ b/tox.ini
@@ -108,6 +108,7 @@ sitepackages = False
deps =
{[testenv]deps}
flake8
+ flake8-quotes
pep8-naming
commands =
flake8 --version