[mod] searx.utils.dict_subset: rewrite with comprehension

This commit is contained in:
Alexandre Flament 2021-08-24 15:28:08 +02:00
parent 3b0f70ed0f
commit 697ebeddcc
1 changed files with 1 additions and 5 deletions

View File

@ -262,11 +262,7 @@ def dict_subset(d, properties):
>>> >> dict_subset({'A': 'a', 'B': 'b', 'C': 'c'}, ['A', 'D'])
{'A': 'a'}
"""
result = {}
for k in properties:
if k in d:
result[k] = d[k]
return result
return {k: d[k] for k in properties if k in d}
def get_torrent_size(filesize, filesize_multiplier):