Replace/remove usage of dict.keys()
This commit is contained in:
parent
4a274466ac
commit
af7e83bc76
|
@ -308,7 +308,7 @@ class ComponentRegistry(object):
|
|||
"""
|
||||
# Start all the components if names is empty
|
||||
if not names:
|
||||
names = self.components.keys()
|
||||
names = list(self.components)
|
||||
elif isinstance(names, str if not PY2 else basestring):
|
||||
names = [names]
|
||||
|
||||
|
@ -342,7 +342,7 @@ class ComponentRegistry(object):
|
|||
|
||||
"""
|
||||
if not names:
|
||||
names = self.components.keys()
|
||||
names = list(self.components)
|
||||
elif isinstance(names, str if not PY2 else basestring):
|
||||
names = [names]
|
||||
|
||||
|
@ -380,7 +380,7 @@ class ComponentRegistry(object):
|
|||
|
||||
"""
|
||||
if not names:
|
||||
names = self.components.keys()
|
||||
names = list(self.components)
|
||||
elif isinstance(names, str if not PY2 else basestring):
|
||||
names = [names]
|
||||
|
||||
|
@ -406,7 +406,7 @@ class ComponentRegistry(object):
|
|||
|
||||
"""
|
||||
if not names:
|
||||
names = self.components.keys()
|
||||
names = list(self.components)
|
||||
elif isinstance(names, str if not PY2 else basestring):
|
||||
names = [names]
|
||||
|
||||
|
@ -431,7 +431,7 @@ class ComponentRegistry(object):
|
|||
def on_stopped(result):
|
||||
return DeferredList([comp._component_shutdown() for comp in self.components.values()])
|
||||
|
||||
return self.stop(list(self.components.keys())).addCallback(on_stopped)
|
||||
return self.stop(list(self.components)).addCallback(on_stopped)
|
||||
|
||||
def update(self):
|
||||
"""Update all Components that are in a Started state."""
|
||||
|
|
|
@ -188,7 +188,7 @@ class FilterManager(component.Component):
|
|||
for use in sidebar.
|
||||
"""
|
||||
torrent_ids = self.torrents.get_torrent_list()
|
||||
tree_keys = list(self.tree_fields.keys())
|
||||
tree_keys = list(self.tree_fields)
|
||||
if hide_cat:
|
||||
for cat in hide_cat:
|
||||
tree_keys.remove(cat)
|
||||
|
|
|
@ -83,7 +83,7 @@ class PluginManager(deluge.pluginmanagerbase.PluginManagerBase, component.Compon
|
|||
"""Return the value of status fields for the selected torrent_id."""
|
||||
status = {}
|
||||
if len(fields) == 0:
|
||||
fields = self.status_fields.keys()
|
||||
fields = list(self.status_fields)
|
||||
for field in fields:
|
||||
try:
|
||||
status[field] = self.status_fields[field](torrent_id)
|
||||
|
|
|
@ -437,7 +437,7 @@ class RPCServer(component.Component):
|
|||
:returns: the exported methods
|
||||
:rtype: list
|
||||
"""
|
||||
return list(self.factory.methods.keys())
|
||||
return list(self.factory.methods)
|
||||
|
||||
def get_session_id(self):
|
||||
"""
|
||||
|
|
|
@ -924,7 +924,7 @@ class Torrent(object):
|
|||
self.update_status(self.handle.status())
|
||||
|
||||
if all_keys:
|
||||
keys = self.status_funcs
|
||||
keys = list(self.status_funcs)
|
||||
|
||||
status_dict = {}
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ class TorrentManager(component.Component):
|
|||
list: A list of torrent_ids.
|
||||
|
||||
"""
|
||||
torrent_ids = list(self.torrents.keys())
|
||||
torrent_ids = list(self.torrents)
|
||||
if component.get('RPCServer').get_session_auth_level() == AUTH_LEVEL_ADMIN:
|
||||
return torrent_ids
|
||||
|
||||
|
@ -1270,7 +1270,7 @@ class TorrentManager(component.Component):
|
|||
if self.torrents:
|
||||
for torrent_id in torrent_ids:
|
||||
if torrent_id in self.torrents:
|
||||
status_keys = list(self.torrents[torrent_id].status_funcs.keys())
|
||||
status_keys = list(self.torrents[torrent_id].status_funcs)
|
||||
leftover_keys = list(set(keys) - set(status_keys))
|
||||
torrent_keys = list(set(keys) - set(leftover_keys))
|
||||
return torrent_keys, leftover_keys
|
||||
|
|
|
@ -88,7 +88,7 @@ class PluginManagerBase(object):
|
|||
|
||||
def get_enabled_plugins(self):
|
||||
"""Returns a list of enabled plugins"""
|
||||
return list(self.plugins.keys())
|
||||
return list(self.plugins)
|
||||
|
||||
def scan_for_plugins(self):
|
||||
"""Scans for available plugins"""
|
||||
|
@ -245,14 +245,14 @@ class PluginManagerBase(object):
|
|||
for line in self.pkg_env[name][0].get_metadata('PKG-INFO').splitlines():
|
||||
if not line:
|
||||
continue
|
||||
if line[0] in ' \t' and (len(line.split(':', 1)) == 1 or line.split(':', 1)[0] not in list(info.keys())):
|
||||
if line[0] in ' \t' and (len(line.split(':', 1)) == 1 or line.split(':', 1)[0] not in info):
|
||||
# This is a continuation
|
||||
cont_lines.append(line.strip())
|
||||
else:
|
||||
if cont_lines:
|
||||
info[last_header] = '\n'.join(cont_lines).strip()
|
||||
cont_lines = []
|
||||
if line.split(':', 1)[0] in list(info.keys()):
|
||||
if line.split(':', 1)[0] in info:
|
||||
last_header = line.split(':', 1)[0]
|
||||
info[last_header] = line.split(':', 1)[1].strip()
|
||||
return info
|
||||
|
|
|
@ -388,7 +388,7 @@ class Core(CorePluginBase):
|
|||
watchdirs[watchdir_id] = watchdir
|
||||
|
||||
log.debug('Current logged in user %s is not an ADMIN, send only '
|
||||
'his watchdirs: %s', session_user, list(watchdirs.keys()))
|
||||
'their watchdirs: %s', session_user, list(watchdirs))
|
||||
return watchdirs
|
||||
|
||||
def _make_unicode(self, options):
|
||||
|
|
|
@ -170,7 +170,7 @@ class Core(CorePluginBase):
|
|||
|
||||
"""
|
||||
needs_blocklist_import = False
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
if key == 'whitelisted':
|
||||
saved = set(self.config[key])
|
||||
update = set(config[key])
|
||||
|
|
|
@ -163,7 +163,7 @@ class Core(CorePluginBase):
|
|||
@export
|
||||
def set_config(self, config):
|
||||
'sets the config dictionary'
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ class Core(CorePluginBase):
|
|||
pass
|
||||
|
||||
def init_filter_dict(self):
|
||||
filter_dict = dict([(label, 0) for label in self.labels.keys()])
|
||||
filter_dict = dict([(label, 0) for label in self.labels])
|
||||
filter_dict['All'] = len(self.torrents)
|
||||
return filter_dict
|
||||
|
||||
|
@ -143,8 +143,8 @@ class Core(CorePluginBase):
|
|||
*add any new keys in OPTIONS_DEFAULTS
|
||||
*set all None values to default <-fix development config
|
||||
"""
|
||||
log.debug(list(self.labels.keys()))
|
||||
for key in self.labels.keys():
|
||||
log.debug(list(self.labels))
|
||||
for key in self.labels:
|
||||
options = dict(OPTIONS_DEFAULTS)
|
||||
options.update(self.labels[key])
|
||||
self.labels[key] = options
|
||||
|
@ -160,7 +160,7 @@ class Core(CorePluginBase):
|
|||
|
||||
@export
|
||||
def get_labels(self):
|
||||
return sorted(self.labels.keys())
|
||||
return sorted(self.labels)
|
||||
|
||||
# Labels:
|
||||
@export
|
||||
|
@ -260,7 +260,7 @@ class Core(CorePluginBase):
|
|||
}
|
||||
"""
|
||||
check_input(label_id in self.labels, _('Unknown Label'))
|
||||
for key in options_dict.keys():
|
||||
for key in options_dict:
|
||||
if key not in OPTIONS_DEFAULTS:
|
||||
raise Exception('label: Invalid options_dict key:%s' % key)
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ class OptionsDialog(object):
|
|||
self.dialog.run()
|
||||
|
||||
def load_options(self, options):
|
||||
log.debug(list(options.keys()))
|
||||
log.debug(list(options))
|
||||
|
||||
for spin_id in self.spin_ids + self.spin_int_ids:
|
||||
self.glade.get_widget(spin_id).set_value(options[spin_id])
|
||||
|
|
|
@ -206,7 +206,7 @@ class Core(CorePluginBase, CoreNotifications):
|
|||
@export
|
||||
def set_config(self, config):
|
||||
'sets the config dictionary'
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ class Core(CorePluginBase):
|
|||
@export()
|
||||
def set_config(self, config):
|
||||
'sets the config dictionary'
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
self.do_schedule(False)
|
||||
|
|
|
@ -208,7 +208,7 @@ class Core(CorePluginBase):
|
|||
@export
|
||||
def set_config(self, config):
|
||||
'sets the config dictionary'
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ class GraphsTab(Tab):
|
|||
return False
|
||||
|
||||
def update(self):
|
||||
d1 = client.stats.get_stats(list(self.graph.stat_info.keys()), self.selected_interval)
|
||||
d1 = client.stats.get_stats(list(self.graph.stat_info), self.selected_interval)
|
||||
d1.addCallback(self.graph.set_stats)
|
||||
|
||||
def _update_complete(result):
|
||||
|
|
|
@ -107,7 +107,7 @@ class Core(CorePluginBase):
|
|||
if not action:
|
||||
action = 'restart'
|
||||
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ class Core(CorePluginBase):
|
|||
@export
|
||||
def set_config(self, config):
|
||||
\"\"\"Sets the config dictionary\"\"\"
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
self.config[key] = config[key]
|
||||
self.config.save()
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ class JSONCustomUserTestCase(JSONBase):
|
|||
def test_handle_request_auth_error(self):
|
||||
yield self.connect_client()
|
||||
json = JSON()
|
||||
auth_conf = {'session_timeout': 10, 'sessions': []}
|
||||
auth_conf = {'session_timeout': 10, 'sessions': {}}
|
||||
Auth(auth_conf) # Must create the component
|
||||
|
||||
# Must be called to update remote methods in json object
|
||||
|
@ -177,7 +177,7 @@ class RPCRaiseDelugeErrorJSONTestCase(JSONBase):
|
|||
def get_session_id(s_id):
|
||||
return s_id
|
||||
self.patch(deluge.ui.web.auth, 'get_session_id', get_session_id)
|
||||
auth_conf = {'session_timeout': 10, 'sessions': []}
|
||||
auth_conf = {'session_timeout': 10, 'sessions': {}}
|
||||
auth = Auth(auth_conf)
|
||||
request = Request(MagicMock(), False)
|
||||
request.base = ''
|
||||
|
@ -187,7 +187,7 @@ class RPCRaiseDelugeErrorJSONTestCase(JSONBase):
|
|||
self.assertTrue('testclass.test' in methods)
|
||||
|
||||
request = MagicMock()
|
||||
request.getCookie = MagicMock(return_value=list(auth.config['sessions'].keys())[0])
|
||||
request.getCookie = MagicMock(return_value=list(auth.config['sessions'])[0])
|
||||
json_data = {'method': 'testclass.test', 'id': 0, 'params': []}
|
||||
request.json = json_lib.dumps(json_data)
|
||||
request_id, result, error = json._handle_request(request)
|
||||
|
|
|
@ -35,7 +35,7 @@ class Core(object):
|
|||
|
||||
def get_torrent_status(self, torrent_id, keys, diff=False):
|
||||
if not keys:
|
||||
keys = list(self.torrents[torrent_id].keys())
|
||||
keys = list(self.torrents[torrent_id])
|
||||
|
||||
if not diff:
|
||||
ret = {}
|
||||
|
@ -57,9 +57,9 @@ class Core(object):
|
|||
|
||||
def get_torrents_status(self, filter_dict, keys, diff=False):
|
||||
if not filter_dict:
|
||||
filter_dict['id'] = list(self.torrents.keys())
|
||||
filter_dict['id'] = list(self.torrents)
|
||||
if not keys:
|
||||
keys = list(self.torrents['a'].keys())
|
||||
keys = list(self.torrents['a'])
|
||||
if not diff:
|
||||
if 'id' in filter_dict:
|
||||
torrents = filter_dict['id']
|
||||
|
|
|
@ -39,7 +39,7 @@ def find_subcommand(self, args=None, sys_argv=True):
|
|||
for x in self._subparsers._actions:
|
||||
if not isinstance(x, argparse._SubParsersAction):
|
||||
continue
|
||||
for sp_name in x._name_parser_map.keys():
|
||||
for sp_name in x._name_parser_map:
|
||||
if sp_name in args:
|
||||
subcommand_found = args.index(sp_name)
|
||||
|
||||
|
|
|
@ -396,12 +396,9 @@ class DaemonSSLProxy(DaemonProxy):
|
|||
self.authentication_level = result
|
||||
# We need to tell the daemon what events we're interested in receiving
|
||||
if self.__factory.event_handlers:
|
||||
self.call('daemon.set_event_interest',
|
||||
list(self.__factory.event_handlers.keys()))
|
||||
|
||||
self.call('daemon.set_event_interest', list(self.__factory.event_handlers))
|
||||
self.call('core.get_auth_levels_mappings').addCallback(
|
||||
self.__on_auth_levels_mappings
|
||||
)
|
||||
self.__on_auth_levels_mappings)
|
||||
|
||||
login_deferred.callback(result)
|
||||
|
||||
|
|
|
@ -207,7 +207,7 @@ class TorrentInfo(object):
|
|||
item.update(paths[path])
|
||||
item['download'] = True
|
||||
|
||||
file_tree = FileTree2(list(paths.keys()))
|
||||
file_tree = FileTree2(list(paths))
|
||||
file_tree.walk(walk)
|
||||
else:
|
||||
def walk(path, item):
|
||||
|
@ -386,7 +386,7 @@ class FileTree2(object):
|
|||
:type callback: function
|
||||
"""
|
||||
def walk(directory, parent_path):
|
||||
for path in directory['contents'].keys():
|
||||
for path in list(directory['contents']):
|
||||
full_path = os.path.join(parent_path, path).replace('\\', '/')
|
||||
if directory['contents'][path]['type'] == 'dir':
|
||||
directory['contents'][path] = callback(
|
||||
|
@ -466,7 +466,7 @@ class FileTree(object):
|
|||
:type callback: function
|
||||
"""
|
||||
def walk(directory, parent_path):
|
||||
for path in directory.keys():
|
||||
for path in list(directory):
|
||||
full_path = os.path.join(parent_path, path)
|
||||
if isinstance(directory[path], dict):
|
||||
directory[path] = callback(full_path, directory[path]) or directory[path]
|
||||
|
|
|
@ -86,11 +86,11 @@ class Command(BaseCommand):
|
|||
|
||||
def _get_config(self, options):
|
||||
def _on_get_config(config):
|
||||
keys = sorted(config.keys())
|
||||
s = ''
|
||||
for key in keys:
|
||||
string = ''
|
||||
for key in sorted(config):
|
||||
if key not in options.values:
|
||||
continue
|
||||
|
||||
color = '{!white,black,bold!}'
|
||||
value = config[key]
|
||||
try:
|
||||
|
@ -107,8 +107,8 @@ class Command(BaseCommand):
|
|||
new_value.append('%s%s' % (color, line))
|
||||
value = '\n'.join(new_value)
|
||||
|
||||
s += '%s: %s%s\n' % (key, color, value)
|
||||
self.console.write(s.strip())
|
||||
string += '%s: %s%s\n' % (key, color, value)
|
||||
self.console.write(string.strip())
|
||||
|
||||
return client.core.get_config().addCallback(_on_get_config)
|
||||
|
||||
|
@ -123,7 +123,7 @@ class Command(BaseCommand):
|
|||
self.console.write('{!error!}%s' % ex)
|
||||
return
|
||||
|
||||
if key not in list(config.keys()):
|
||||
if key not in config:
|
||||
self.console.write('{!error!}Invalid key: %s' % key)
|
||||
return
|
||||
|
||||
|
@ -141,4 +141,4 @@ class Command(BaseCommand):
|
|||
return client.core.set_config({key: val}).addCallback(on_set_config)
|
||||
|
||||
def complete(self, text):
|
||||
return [k for k in component.get('CoreConfig').keys() if k.startswith(text)]
|
||||
return [k for k in component.get('CoreConfig') if k.startswith(text)]
|
||||
|
|
|
@ -82,7 +82,7 @@ class Command(BaseCommand):
|
|||
return
|
||||
request_options.append(opt)
|
||||
if not request_options:
|
||||
request_options = [opt for opt in torrent_options.keys()]
|
||||
request_options = list(torrent_options)
|
||||
request_options.append('name')
|
||||
|
||||
d = client.core.get_torrents_status({'id': torrent_ids}, request_options)
|
||||
|
|
|
@ -235,7 +235,7 @@ class TorrentView(InputKeyHandler):
|
|||
|
||||
# Get first element so we can check if it has given field
|
||||
# and if it's a string
|
||||
first_element = state[list(state.keys())[0]]
|
||||
first_element = state[list(state)[0]]
|
||||
if field in first_element:
|
||||
def sort_key(s):
|
||||
try:
|
||||
|
|
|
@ -272,7 +272,7 @@ class AccountDialog(BaseDialog):
|
|||
|
||||
self.authlevel_combo = gtk.ComboBoxText()
|
||||
active_idx = None
|
||||
for idx, level in enumerate(levels_mapping.keys()):
|
||||
for idx, level in enumerate(levels_mapping):
|
||||
self.authlevel_combo.append_text(level)
|
||||
if authlevel and authlevel == level:
|
||||
active_idx = idx
|
||||
|
|
|
@ -411,7 +411,7 @@ class MenuBar(component.Component):
|
|||
'menuitem_max_connections': 'max_connections',
|
||||
'menuitem_upload_slots': 'max_upload_slots'
|
||||
}
|
||||
if widget.get_name() in list(funcs.keys()):
|
||||
if widget.get_name() in funcs:
|
||||
torrent_ids = component.get('TorrentView').get_selected_torrents()
|
||||
client.core.set_torrent_options(torrent_ids, {funcs[widget.get_name()]: -1})
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ class OptionsTab(Tab):
|
|||
# We only want to update values that have been applied in the core. This
|
||||
# is so we don't overwrite the user changes that haven't been applied yet.
|
||||
if self.prev_status is None:
|
||||
self.prev_status = {}.fromkeys(list(status.keys()), None)
|
||||
self.prev_status = {}.fromkeys(list(status), None)
|
||||
|
||||
if status != self.prev_status:
|
||||
if status['max_download_speed'] != self.prev_status['max_download_speed']:
|
||||
|
|
|
@ -60,7 +60,7 @@ class PathChoosersHandler(component.Component):
|
|||
self.config_properties.update(config)
|
||||
for chooser in self.path_choosers:
|
||||
chooser.set_config(config)
|
||||
keys = list(self.config_keys_to_funcs_mapping.keys())
|
||||
keys = list(self.config_keys_to_funcs_mapping)
|
||||
keys += self.paths_list_keys
|
||||
client.core.get_config_values(keys).addCallback(_on_config_values)
|
||||
|
||||
|
@ -109,7 +109,7 @@ class PathChoosersHandler(component.Component):
|
|||
chooser.set_values(values)
|
||||
|
||||
def get_config_keys(self):
|
||||
keys = list(self.config_keys_to_funcs_mapping.keys())
|
||||
keys = list(self.config_keys_to_funcs_mapping)
|
||||
keys += self.paths_list_keys
|
||||
return keys
|
||||
|
||||
|
|
|
@ -801,7 +801,7 @@ class Preferences(component.Component):
|
|||
|
||||
def update_dependent_widgets(name, value):
|
||||
dependency = dependents[name]
|
||||
for dep in dependency.keys():
|
||||
for dep in dependency:
|
||||
if dep in path_choosers:
|
||||
depwidget = path_choosers[dep]
|
||||
else:
|
||||
|
|
|
@ -287,7 +287,7 @@ class StatusBar(component.Component):
|
|||
This is called when we receive a ConfigValueChangedEvent from
|
||||
the core.
|
||||
"""
|
||||
if key in list(self.config_value_changed_dict.keys()):
|
||||
if key in self.config_value_changed_dict:
|
||||
self.config_value_changed_dict[key](value)
|
||||
|
||||
def _on_max_connections_global(self, max_connections):
|
||||
|
|
|
@ -179,7 +179,7 @@ class SystemTray(component.Component):
|
|||
def config_value_changed(self, key, value):
|
||||
"""This is called when we received a config_value_changed signal from
|
||||
the core."""
|
||||
if key in list(self.config_value_changed_dict.keys()):
|
||||
if key in self.config_value_changed_dict:
|
||||
self.config_value_changed_dict[key](value)
|
||||
|
||||
def _on_max_download_speed(self, max_download_speed):
|
||||
|
|
|
@ -413,15 +413,15 @@ class TorrentView(ListView, component.Component):
|
|||
|
||||
if columns is None:
|
||||
# We need to iterate through all columns
|
||||
columns = list(self.columns.keys())
|
||||
columns = list(self.columns)
|
||||
|
||||
# Iterate through supplied list of columns to update
|
||||
for column in columns:
|
||||
# Make sure column is visible and has 'status_field' set.
|
||||
# If not, we can ignore it.
|
||||
if self.columns[column].column.get_visible() is True \
|
||||
and self.columns[column].hidden is False \
|
||||
and self.columns[column].status_field is not None:
|
||||
if (self.columns[column].column.get_visible() is True
|
||||
and self.columns[column].hidden is False
|
||||
and self.columns[column].status_field is not None):
|
||||
for field in self.columns[column].status_field:
|
||||
status_keys.append(field)
|
||||
self.columns_to_update.append(column)
|
||||
|
@ -486,7 +486,7 @@ class TorrentView(ListView, component.Component):
|
|||
|
||||
# Get the columns to update from one of the torrents
|
||||
if status:
|
||||
torrent_id = list(status.keys())[0]
|
||||
torrent_id = list(status)[0]
|
||||
fields_to_update = []
|
||||
for column in self.columns_to_update:
|
||||
column_index = self.get_column_index(column)
|
||||
|
@ -626,7 +626,7 @@ class TorrentView(ListView, component.Component):
|
|||
return {}
|
||||
|
||||
def get_visible_torrents(self):
|
||||
return list(self.status.keys())
|
||||
return list(self.status)
|
||||
|
||||
# Callbacks #
|
||||
def on_button_press_event(self, widget, event):
|
||||
|
|
|
@ -125,7 +125,7 @@ class SessionProxy(component.Component):
|
|||
# Keep track of keys we need to request from the core
|
||||
keys_to_get = []
|
||||
if not keys:
|
||||
keys = self.torrents[torrent_id][1].keys()
|
||||
keys = list(self.torrents[torrent_id][1])
|
||||
|
||||
for key in keys:
|
||||
if time() - self.cache_times[torrent_id].get(key, 0.0) > self.cache_time:
|
||||
|
@ -192,7 +192,7 @@ class SessionProxy(component.Component):
|
|||
|
||||
# Create the status dict
|
||||
if not torrent_ids:
|
||||
torrent_ids = list(result.keys())
|
||||
torrent_ids = list(result)
|
||||
|
||||
return self.create_status_dict(torrent_ids, keys)
|
||||
|
||||
|
@ -216,13 +216,14 @@ class SessionProxy(component.Component):
|
|||
if not filter_dict:
|
||||
# This means we want all the torrents status
|
||||
# We get a list of any torrent_ids with expired status dicts
|
||||
to_fetch = find_torrents_to_fetch(list(self.torrents.keys()))
|
||||
torrents_list = list(self.torrents)
|
||||
to_fetch = find_torrents_to_fetch(torrents_list)
|
||||
if to_fetch:
|
||||
d = client.core.get_torrents_status({'id': to_fetch}, keys, True)
|
||||
return d.addCallback(on_status, list(self.torrents.keys()), keys)
|
||||
return d.addCallback(on_status, torrents_list, keys)
|
||||
|
||||
# Don't need to fetch anything
|
||||
return maybeDeferred(self.create_status_dict, list(self.torrents.keys()), keys)
|
||||
return maybeDeferred(self.create_status_dict, torrents_list, keys)
|
||||
|
||||
if len(filter_dict) == 1 and 'id' in filter_dict:
|
||||
# At this point we should have a filter with just "id" in it
|
||||
|
|
|
@ -90,10 +90,8 @@ class Auth(JSONComponent):
|
|||
self.worker.stop()
|
||||
|
||||
def _clean_sessions(self):
|
||||
session_ids = list(self.config['sessions'].keys())
|
||||
|
||||
now = time.gmtime()
|
||||
for session_id in session_ids:
|
||||
for session_id in list(self.config['sessions']):
|
||||
session = self.config['sessions'][session_id]
|
||||
|
||||
if 'expires' not in session:
|
||||
|
|
|
@ -899,7 +899,7 @@ class WebApi(JSONComponent):
|
|||
:type config: dictionary
|
||||
"""
|
||||
web_config = component.get('DelugeWeb').config
|
||||
for key in config.keys():
|
||||
for key in config:
|
||||
if key in ['sessions', 'pwd_salt', 'pwd_sha1']:
|
||||
log.warn('Ignored attempt to overwrite web config key: %s', key)
|
||||
continue
|
||||
|
@ -918,7 +918,7 @@ class WebApi(JSONComponent):
|
|||
"""
|
||||
|
||||
return {
|
||||
'enabled_plugins': list(component.get('Web.PluginManager').plugins.keys()),
|
||||
'enabled_plugins': list(component.get('Web.PluginManager').plugins),
|
||||
'available_plugins': component.get('Web.PluginManager').available_plugins
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue