summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2021-08-24 15:28:08 +0200
committerAlexandre Flament <alex@al-f.net>2021-08-24 15:28:08 +0200
commit697ebeddcc6066e5c5f316c9ef2baf8d3769a868 (patch)
tree7c156a017b837e49ecb77ca9886d89e20ef7c069 /searx/utils.py
parent3b0f70ed0f981f76d90a8fab2a2bb73e5b1b97bb (diff)
downloadsearxng-697ebeddcc6066e5c5f316c9ef2baf8d3769a868.tar.gz
searxng-697ebeddcc6066e5c5f316c9ef2baf8d3769a868.zip
[mod] searx.utils.dict_subset: rewrite with comprehension
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py6
1 files changed, 1 insertions, 5 deletions
diff --git a/searx/utils.py b/searx/utils.py
index 5e2ab18c4..22824d829 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -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):