mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-13 16:52:58 -07:00
Remove list(dict.keys()) --> dict.keys() and list(dict.values()) --> dict.values()
This commit is contained in:
parent
f4eff8a8c5
commit
e26182c96e
7 changed files with 15 additions and 15 deletions
|
@ -61,7 +61,7 @@ else:
|
|||
|
||||
class API2(object):
|
||||
def __init__(self, **kwargs):
|
||||
self._api_valid_methods = list(self._api_docs().keys())
|
||||
self._api_valid_methods = self._api_docs().keys()
|
||||
self._api_authenticated = False
|
||||
self._api_out_type = 'json' # default
|
||||
self._api_msg = None
|
||||
|
|
|
@ -692,7 +692,7 @@ class Config(object):
|
|||
""" Initialize the config with values from a file """
|
||||
self._config_file = config_file
|
||||
self._config = ConfigObj(self._config_file, encoding='utf-8')
|
||||
for key in list(_CONFIG_DEFINITIONS.keys()):
|
||||
for key in _CONFIG_DEFINITIONS:
|
||||
self.check_setting(key)
|
||||
self._upgrade()
|
||||
self._blacklist()
|
||||
|
@ -752,7 +752,7 @@ class Config(object):
|
|||
new_config[key][subkey] = value
|
||||
|
||||
# next make sure that everything we expect to have defined is so
|
||||
for key in list(_CONFIG_DEFINITIONS.keys()):
|
||||
for key in _CONFIG_DEFINITIONS:
|
||||
key, definition_type, section, ini_key, default = self._define(key)
|
||||
self.check_setting(key)
|
||||
if section not in new_config:
|
||||
|
|
|
@ -202,7 +202,7 @@ class MonitorDatabase(object):
|
|||
trans_type = 'update'
|
||||
changes_before = self.connection.total_changes
|
||||
|
||||
gen_params = lambda my_dict: [x + " = ?" for x in list(my_dict.keys())]
|
||||
gen_params = lambda my_dict: [x + " = ?" for x in my_dict]
|
||||
|
||||
update_query = "UPDATE " + table_name + " SET " + ", ".join(gen_params(value_dict)) + \
|
||||
" WHERE " + " AND ".join(gen_params(key_dict))
|
||||
|
|
|
@ -99,7 +99,7 @@ class DataTables(object):
|
|||
filtered = self.ssp_db.select(query, args=args)
|
||||
|
||||
# Remove NULL rows
|
||||
filtered = [row for row in filtered if not all(v is None for v in list(row.values()))]
|
||||
filtered = [row for row in filtered if not all(v is None for v in row.values())]
|
||||
|
||||
# Build grand totals
|
||||
totalcount = self.ssp_db.select('SELECT COUNT(id) as total_count from %s' % table_name)[0]['total_count']
|
||||
|
|
|
@ -1233,7 +1233,7 @@ def strip_tag(data, agent_id=None):
|
|||
'u': [],
|
||||
'a': ['href'],
|
||||
'font': ['color']}
|
||||
data = bleach.clean(data, tags=list(whitelist.keys()), attributes=whitelist, strip=True)
|
||||
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||
|
||||
elif agent_id == 13:
|
||||
# Allow tags b, i, code, pre, a[href] for Telegram
|
||||
|
@ -1242,7 +1242,7 @@ def strip_tag(data, agent_id=None):
|
|||
'code': [],
|
||||
'pre': [],
|
||||
'a': ['href']}
|
||||
data = bleach.clean(data, tags=list(whitelist.keys()), attributes=whitelist, strip=True)
|
||||
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||
|
||||
elif agent_id in (10, 14, 20, 25):
|
||||
# Don't remove tags for Email, Slack, Discord, and Webhook
|
||||
|
@ -1250,7 +1250,7 @@ def strip_tag(data, agent_id=None):
|
|||
|
||||
else:
|
||||
whitelist = {}
|
||||
data = bleach.clean(data, tags=list(whitelist.keys()), attributes=whitelist, strip=True)
|
||||
data = bleach.clean(data, tags=whitelist.keys(), attributes=whitelist, strip=True)
|
||||
|
||||
# Resubstitute temporary tokens for < and > in parameter prefix and suffix
|
||||
return data.replace('%temp_lt_token%', '<').replace('%temp_gt_token%', '>')
|
||||
|
|
|
@ -2787,7 +2787,7 @@ class SCRIPTS(Notifier):
|
|||
for root, dirs, files in os.walk(scriptdir):
|
||||
for f in files:
|
||||
name, ext = os.path.splitext(f)
|
||||
if ext in list(self.script_exts.keys()):
|
||||
if ext in self.script_exts:
|
||||
rfp = os.path.join(os.path.relpath(root, scriptdir), f)
|
||||
fp = os.path.join(root, f)
|
||||
scripts[fp] = rfp
|
||||
|
@ -2931,7 +2931,7 @@ class SCRIPTS(Notifier):
|
|||
def _return_config_options(self):
|
||||
config_option = [{'label': 'Supported File Types',
|
||||
'description': '<span class="inline-pre">' + \
|
||||
', '.join(list(self.script_exts.keys())) + '</span>',
|
||||
', '.join(self.script_exts) + '</span>',
|
||||
'input_type': 'help'
|
||||
},
|
||||
{'label': 'Script Folder',
|
||||
|
@ -3719,8 +3719,8 @@ def upgrade_config_to_db():
|
|||
for script, actions in script_actions.items():
|
||||
if any(agent_actions[a] for a in actions):
|
||||
temp_config = notifier_config
|
||||
temp_config.update({a: 0 for a in list(agent_actions.keys())})
|
||||
temp_config.update({a + '_subject': '' for a in list(agent_actions.keys())})
|
||||
temp_config.update({a: 0 for a in agent_actions})
|
||||
temp_config.update({a + '_subject': '' for a in agent_actions})
|
||||
for a in actions:
|
||||
if agent_actions[a]:
|
||||
temp_config[a] = agent_actions[a]
|
||||
|
|
|
@ -2356,7 +2356,7 @@ class PmsConnect(object):
|
|||
hub_identifier = helpers.get_xml_attr(h, 'hubIdentifier')
|
||||
|
||||
if size == '0' or not hub_identifier.startswith('collection.related') or \
|
||||
media_type not in list(children_results_list.keys()):
|
||||
media_type not in children_results_list:
|
||||
continue
|
||||
|
||||
result_data = []
|
||||
|
@ -2811,7 +2811,7 @@ class PmsConnect(object):
|
|||
|
||||
for h in hubs:
|
||||
if helpers.get_xml_attr(h, 'size') == '0' or \
|
||||
helpers.get_xml_attr(h, 'type') not in list(search_results_list.keys()):
|
||||
helpers.get_xml_attr(h, 'type') not in search_results_list:
|
||||
continue
|
||||
|
||||
if h.getElementsByTagName('Video'):
|
||||
|
@ -2843,7 +2843,7 @@ class PmsConnect(object):
|
|||
metadata = self.get_metadata_details(rating_key=rating_key)
|
||||
search_results_list[metadata['media_type']].append(metadata)
|
||||
|
||||
output = {'results_count': sum(len(s) for s in list(search_results_list.values())),
|
||||
output = {'results_count': sum(len(s) for s in search_results_list.values()),
|
||||
'results_list': search_results_list
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue