[Lint] Add flake8-quotes to tox and fix bad quotes
This commit is contained in:
parent
3a2ff0c188
commit
af6b277d28
|
@ -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:
|
||||
|
|
|
@ -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))
|
||||
|
||||
|
|
|
@ -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')
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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
|
||||
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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.'
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -328,7 +328,7 @@ class StatusBar(component.Component):
|
|||
if space >= 0:
|
||||
self.diskspace_item.set_markup('<small>%s</small>' % fsize(space, shortform=True))
|
||||
else:
|
||||
self.diskspace_item.set_markup("<span foreground=\"red\">" + _('Error') + '</span>')
|
||||
self.diskspace_item.set_markup('<span foreground="red">' + _('Error') + '</span>')
|
||||
|
||||
def _on_max_download_speed(self, max_download_speed):
|
||||
self.max_download_speed = max_download_speed
|
||||
|
|
|
@ -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 = []
|
||||
|
|
Loading…
Reference in New Issue