[Py2to3] Fix log.warn deprecation warning
This commit is contained in:
parent
bc2f4a30eb
commit
ae4449642c
|
@ -472,7 +472,7 @@ class Core(component.Component):
|
|||
torrent[0], torrent[1], torrent[2], save_state=idx == last_index,
|
||||
)
|
||||
except AddTorrentError as ex:
|
||||
log.warn('Error when adding torrent: %s', ex)
|
||||
log.warning('Error when adding torrent: %s', ex)
|
||||
errors.append(ex)
|
||||
defer.returnValue(errors)
|
||||
return task.deferLater(reactor, 0, add_torrents)
|
||||
|
@ -578,7 +578,7 @@ class Core(component.Component):
|
|||
# Save the session state
|
||||
self.torrentmanager.save_state()
|
||||
if errors:
|
||||
log.warn('Failed to remove %d of %d torrents.', len(errors), len(torrent_ids))
|
||||
log.warning('Failed to remove %d of %d torrents.', len(errors), len(torrent_ids))
|
||||
return errors
|
||||
return task.deferLater(reactor, 0, do_remove_torrents)
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
|||
try:
|
||||
self.transfer_message(data)
|
||||
except Exception as ex:
|
||||
log.warn('Error occurred when sending message: %s.', ex)
|
||||
log.warning('Error occurred when sending message: %s.', ex)
|
||||
log.exception(ex)
|
||||
raise
|
||||
|
||||
|
|
|
@ -762,7 +762,7 @@ class TorrentManager(component.Component):
|
|||
resume_data=resume_data.get(t_state.torrent_id),
|
||||
)
|
||||
except AddTorrentError as ex:
|
||||
log.warn('Error when adding torrent "%s" to session: %s', t_state.torrent_id, ex)
|
||||
log.warning('Error when adding torrent "%s" to session: %s', t_state.torrent_id, ex)
|
||||
else:
|
||||
deferreds.append(d)
|
||||
|
||||
|
@ -1105,19 +1105,19 @@ class TorrentManager(component.Component):
|
|||
def on_alert_add_torrent(self, alert):
|
||||
"""Alert handler for libtorrent add_torrent_alert"""
|
||||
if not alert.handle.is_valid():
|
||||
log.warn('Torrent handle is invalid!')
|
||||
log.warning('Torrent handle is invalid!')
|
||||
return
|
||||
|
||||
try:
|
||||
torrent_id = str(alert.handle.info_hash())
|
||||
except RuntimeError as ex:
|
||||
log.warn('Failed to get torrent id from handle: %s', ex)
|
||||
log.warning('Failed to get torrent id from handle: %s', ex)
|
||||
return
|
||||
|
||||
try:
|
||||
add_async_params = self.torrents_loading.pop(torrent_id)
|
||||
except KeyError as ex:
|
||||
log.warn('Torrent id not in torrents loading list: %s', ex)
|
||||
log.warning('Torrent id not in torrents loading list: %s', ex)
|
||||
return
|
||||
|
||||
self.add_async_callback(alert.handle, *add_async_params)
|
||||
|
|
|
@ -218,7 +218,7 @@ def tweak_logging_levels():
|
|||
if not os.path.isfile(logging_config_file):
|
||||
return
|
||||
log = logging.getLogger(__name__)
|
||||
log.warn(
|
||||
log.warning(
|
||||
'logging.conf found! tweaking logging levels from %s',
|
||||
logging_config_file,
|
||||
)
|
||||
|
@ -230,7 +230,7 @@ def tweak_logging_levels():
|
|||
if level not in levels:
|
||||
continue
|
||||
|
||||
log.warn('Setting logger "%s" to logging level "%s"', name, level)
|
||||
log.warning('Setting logger "%s" to logging level "%s"', name, level)
|
||||
set_logger_level(level, name)
|
||||
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ class PluginManagerBase(object):
|
|||
cont_lines = []
|
||||
# Missing plugin info
|
||||
if not self.pkg_env[name]:
|
||||
log.warn('Failed to retrive info for plugin: %s', name)
|
||||
log.warning('Failed to retrive info for plugin: %s', name)
|
||||
for k in info:
|
||||
info[k] = 'not available'
|
||||
return info
|
||||
|
|
|
@ -106,11 +106,11 @@ class Core(CorePluginBase):
|
|||
def log_error(result, command):
|
||||
(stdout, stderr, exit_code) = result
|
||||
if exit_code:
|
||||
log.warn('Command "%s" failed with exit code %d', command, exit_code)
|
||||
log.warning('Command "%s" failed with exit code %d', command, exit_code)
|
||||
if stdout:
|
||||
log.warn('stdout: %s', stdout)
|
||||
log.warning('stdout: %s', stdout)
|
||||
if stderr:
|
||||
log.warn('stderr: %s', stderr)
|
||||
log.warning('stderr: %s', stderr)
|
||||
|
||||
# Go through and execute all the commands
|
||||
for command in self.config['commands']:
|
||||
|
|
|
@ -82,7 +82,7 @@ class Core(CorePluginBase):
|
|||
try:
|
||||
self.server.start()
|
||||
except CannotListenError as ex:
|
||||
log.warn('Failed to start WebUI server: %s', ex)
|
||||
log.warning('Failed to start WebUI server: %s', ex)
|
||||
raise
|
||||
return True
|
||||
|
||||
|
|
|
@ -104,8 +104,8 @@ class DelugeTransferProtocol(Protocol, object):
|
|||
# Remove the header from the buffer
|
||||
self._buffer = self._buffer[MESSAGE_HEADER_SIZE:]
|
||||
except Exception as ex:
|
||||
log.warn('Error occurred when parsing message header: %s.', ex)
|
||||
log.warn('This version of Deluge cannot communicate with the sender of this data.')
|
||||
log.warning('Error occurred when parsing message header: %s.', ex)
|
||||
log.warning('This version of Deluge cannot communicate with the sender of this data.')
|
||||
self._message_length = 0
|
||||
self._buffer = b''
|
||||
|
||||
|
@ -119,7 +119,7 @@ class DelugeTransferProtocol(Protocol, object):
|
|||
try:
|
||||
self.message_received(rencode.loads(zlib.decompress(data), decode_utf8=True))
|
||||
except Exception as ex:
|
||||
log.warn('Failed to decompress (%d bytes) and load serialized data with rencode: %s', len(data), ex)
|
||||
log.warning('Failed to decompress (%d bytes) and load serialized data with rencode: %s', len(data), ex)
|
||||
|
||||
def get_bytes_recv(self):
|
||||
"""
|
||||
|
|
|
@ -133,7 +133,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
|||
exception_cls = getattr(error, request[2])
|
||||
exception = exception_cls(*request[3], **request[4])
|
||||
except TypeError:
|
||||
log.warn('Received invalid RPC_ERROR (Old daemon?): %s', request[2])
|
||||
log.warning('Received invalid RPC_ERROR (Old daemon?): %s', request[2])
|
||||
return
|
||||
|
||||
# Ideally we would chain the deferreds instead of instance
|
||||
|
@ -188,7 +188,7 @@ class DelugeRPCProtocol(DelugeTransferProtocol):
|
|||
# Send the request in a tuple because multiple requests can be sent at once
|
||||
self.transfer_message((request.format_message(),))
|
||||
except Exception as ex:
|
||||
log.warn('Error occurred when sending message: %s', ex)
|
||||
log.warning('Error occurred when sending message: %s', ex)
|
||||
|
||||
|
||||
class DelugeRPCClientFactory(ClientFactory):
|
||||
|
|
|
@ -108,7 +108,7 @@ class Commander(object):
|
|||
return
|
||||
except OptionParserError as ex:
|
||||
import traceback
|
||||
log.warn('Error parsing command "%s": %s', args, ex)
|
||||
log.warning('Error parsing command "%s": %s', args, ex)
|
||||
self.write('{!error!} %s' % ex)
|
||||
parser.print_help()
|
||||
return
|
||||
|
|
|
@ -51,7 +51,7 @@ class Command(BaseCommand):
|
|||
self.torrents = status
|
||||
|
||||
def on_torrents_status_fail(reason):
|
||||
log.warn('Failed to retrieve session status: %s', reason)
|
||||
log.warning('Failed to retrieve session status: %s', reason)
|
||||
self.torrents = -2
|
||||
|
||||
deferreds = []
|
||||
|
|
|
@ -330,7 +330,7 @@ def move_cursor(screen, row, col):
|
|||
screen.move(row, col)
|
||||
except curses.error as ex:
|
||||
import traceback
|
||||
log.warn(
|
||||
log.warning(
|
||||
'Error on screen.move(%s, %s): (curses.LINES: %s, curses.COLS: %s) Error: %s\nStack: %s',
|
||||
row, col, curses.LINES, curses.COLS, ex, ''.join(traceback.format_stack()),
|
||||
)
|
||||
|
|
|
@ -90,7 +90,7 @@ def init_colors():
|
|||
color_pairs[(fg_name, bg_name)] = counter
|
||||
counter += 1
|
||||
except curses.error as ex:
|
||||
log.warn('Error: %s', ex)
|
||||
log.warning('Error: %s', ex)
|
||||
return counter
|
||||
|
||||
# Create the color_pairs dict
|
||||
|
|
|
@ -477,7 +477,7 @@ class IntSpinInput(InputField):
|
|||
self.cursor = cursor
|
||||
except TypeError:
|
||||
import traceback
|
||||
log.warn('TypeError: %s', ''.join(traceback.format_exc()))
|
||||
log.warning('TypeError: %s', ''.join(traceback.format_exc()))
|
||||
else:
|
||||
if cursor is True:
|
||||
self.cursor = len(self.valstr)
|
||||
|
@ -925,7 +925,7 @@ class ComboInput(InputField):
|
|||
msg = c[1]
|
||||
break
|
||||
if msg is None:
|
||||
log.warn('Setting value "%s" found nothing in choices: %s', val, self.choices)
|
||||
log.warning('Setting value "%s" found nothing in choices: %s', val, self.choices)
|
||||
self.fmt_keys.update({'msg': msg})
|
||||
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ class BaseInputPane(InputKeyHandler):
|
|||
continue
|
||||
if e.name == input_element.name:
|
||||
import traceback
|
||||
log.warn(
|
||||
log.warning(
|
||||
'Input element with name "%s" already exists in input pane (%s):\n%s',
|
||||
input_element.name, e, ''.join(traceback.format_stack(limit=5)),
|
||||
)
|
||||
|
|
|
@ -154,7 +154,7 @@ class BaseWindow(object):
|
|||
self.screen.noutrefresh(pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol)
|
||||
except curses.error as ex:
|
||||
import traceback
|
||||
log.warn(
|
||||
log.warning(
|
||||
'Error on screen.noutrefresh(%s, %s, %s, %s, %s, %s) Error: %s\nStack: %s',
|
||||
pminrow, pmincol, sminrow, smincol, smaxrow, smaxcol, ex, ''.join(traceback.format_stack()),
|
||||
)
|
||||
|
|
|
@ -162,7 +162,7 @@ class PathChooser(PathChooserComboBox):
|
|||
try:
|
||||
self.config_key_funcs[key][1](config[key])
|
||||
except TypeError as ex:
|
||||
log.warn('TypeError: %s', ex)
|
||||
log.warning('TypeError: %s', ex)
|
||||
|
||||
# Set the saved paths
|
||||
if self.paths_config_key and self.paths_config_key in config:
|
||||
|
|
|
@ -72,7 +72,7 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Compon
|
|||
try:
|
||||
self.enable_plugin(name)
|
||||
except Exception as ex:
|
||||
log.warn('Failed to enable plugin "%s": ex: %s', name, ex)
|
||||
log.warning('Failed to enable plugin "%s": ex: %s', name, ex)
|
||||
|
||||
self.run_on_show_prefs()
|
||||
|
||||
|
|
|
@ -909,7 +909,7 @@ class Preferences(component.Component):
|
|||
|
||||
def on_plugin_action(arg):
|
||||
if not value and arg is False:
|
||||
log.warn('Failed to enable plugin: %s', name)
|
||||
log.warning('Failed to enable plugin: %s', name)
|
||||
self.plugin_liststore.set_value(row, 1, False)
|
||||
|
||||
d.addBoth(on_plugin_action)
|
||||
|
|
|
@ -71,7 +71,7 @@ class RemoveTorrentDialog(object):
|
|||
if errors:
|
||||
log.info('Error(s) occured when trying to delete torrent(s).')
|
||||
for t_id, e_msg in errors:
|
||||
log.warn('Error removing torrent %s : %s', t_id, e_msg)
|
||||
log.warning('Error removing torrent %s : %s', t_id, e_msg)
|
||||
|
||||
d = client.core.remove_torrents(self.__torrent_ids, remove_data)
|
||||
d.addCallback(on_removed_finished)
|
||||
|
|
|
@ -74,7 +74,7 @@ class Tab(object):
|
|||
args = [status[key] for key in widget.status_keys]
|
||||
txt = widget.func(*args)
|
||||
except KeyError as ex:
|
||||
log.warn('Unable to get status value: %s', ex)
|
||||
log.warning('Unable to get status value: %s', ex)
|
||||
txt = ''
|
||||
return txt
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ def set_dummy_trans(warn_msg=None):
|
|||
|
||||
def _func(*txt):
|
||||
if warn_msg:
|
||||
log.warn('"%s" has been marked for translation, but translation is unavailable.', txt[0])
|
||||
log.warning('"%s" has been marked for translation, but translation is unavailable.', txt[0])
|
||||
return txt[0]
|
||||
builtins.__dict__['_'] = _func
|
||||
builtins.__dict__['ngettext'] = builtins.__dict__['_n'] = _func
|
||||
|
@ -80,7 +80,7 @@ def set_language(lang):
|
|||
ro = gettext.translation('deluge', localedir=translations_path, languages=[lang])
|
||||
ro.install()
|
||||
except IOError as ex:
|
||||
log.warn('IOError when loading translations: %s', ex)
|
||||
log.warning('IOError when loading translations: %s', ex)
|
||||
|
||||
|
||||
# Initialize gettext
|
||||
|
|
|
@ -863,7 +863,7 @@ class WebApi(JSONComponent):
|
|||
web_config = component.get('DelugeWeb').config
|
||||
for key in config:
|
||||
if key in ['sessions', 'pwd_salt', 'pwd_sha1']:
|
||||
log.warn('Ignored attempt to overwrite web config key: %s', key)
|
||||
log.warning('Ignored attempt to overwrite web config key: %s', key)
|
||||
continue
|
||||
web_config[key] = config[key]
|
||||
|
||||
|
|
|
@ -661,7 +661,7 @@ class DelugeWeb(component.Component):
|
|||
Start the DelugeWeb server
|
||||
"""
|
||||
if self.socket:
|
||||
log.warn('DelugeWeb is already running and cannot be started')
|
||||
log.warning('DelugeWeb is already running and cannot be started')
|
||||
return
|
||||
|
||||
log.info('Starting webui server at PID %s', os.getpid())
|
||||
|
|
Loading…
Reference in New Issue