@@ -1,8 +1,10 @@
1# SPDX-License-Identifier: AGPL-3.0-or-later
1# SPDX-License-Identifier: AGPL-3.0-or-later
3+"""This module holds the *data* created by::
3−import json
5+ make data.all
4−from pathlib import Path
8 'ENGINES_LANGUAGES',
10 'ENGINES_LANGUAGES',
@@ -14,23 +16,32 @@ __all__ = [
14 'OSM_KEYS_TAGS',
16 'OSM_KEYS_TAGS',
15 'ahmia_blacklist_loader',
17 'ahmia_blacklist_loader',
17−data_dir = Path(__file__).parent
21+from pathlib import Path
20−def load(filename):
23+data_dir = Path(__file__).parent
21− with open(data_dir / filename, encoding='utf-8') as fd:
26+ with open(data_dir / filename, encoding='utf-8') as f:
25def ahmia_blacklist_loader():
29def ahmia_blacklist_loader():
26− with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd:
30+ """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion
27− return fd.read().split()
31+ names. The MD5 values are fetched by::
33+ searx_extra/update/update_ahmia_blacklist.py
35+ This function is used by :py:mod:`searx.plugins.ahmia_filter`.
38+ with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f:
39+ return f.read().split()
30−ENGINES_LANGUAGES = load('engines_languages.json')
41+ENGINES_LANGUAGES = _load('engines_languages.json')
31−CURRENCIES = load('currencies.json')
42+CURRENCIES = _load('currencies.json')
32−USER_AGENTS = load('useragents.json')
43+USER_AGENTS = _load('useragents.json')
33−EXTERNAL_URLS = load('external_urls.json')
44+EXTERNAL_URLS = _load('external_urls.json')
34−WIKIDATA_UNITS = load('wikidata_units.json')
45+WIKIDATA_UNITS = _load('wikidata_units.json')
35−EXTERNAL_BANGS = load('external_bangs.json')
46+EXTERNAL_BANGS = _load('external_bangs.json')
36−OSM_KEYS_TAGS = load('osm_keys_tags.json')
47+OSM_KEYS_TAGS = _load('osm_keys_tags.json')