From c75425655fdadf9554b97ae0309a6181acd34ce3 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 4 Jun 2021 09:35:26 +0200 Subject: [enh] openstreetmap / map template: improve results implements ideas described in #69 * update the engine * use wikidata * update map.html template --- searx/data/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'searx/data/__init__.py') diff --git a/searx/data/__init__.py b/searx/data/__init__.py index c482a6b5a..b0e7d31d8 100644 --- a/searx/data/__init__.py +++ b/searx/data/__init__.py @@ -3,7 +3,7 @@ from pathlib import Path __init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'EXTERNAL_URLS', 'WIKIDATA_UNITS', 'EXTERNAL_BANGS', - 'bangs_loader', 'ahmia_blacklist_loader'] + 'OSM_KEYS_TAGS', 'bangs_loader', 'ahmia_blacklist_loader'] data_dir = Path(__file__).parent @@ -23,3 +23,4 @@ USER_AGENTS = load('useragents.json') EXTERNAL_URLS = load('external_urls.json') WIKIDATA_UNITS = load('wikidata_units.json') EXTERNAL_BANGS = load('external_bangs.json') +OSM_KEYS_TAGS = load('osm_keys_tags.json') -- cgit v1.2.3 From 2e5d823162c9078a3e248445662e35e9e6361c66 Mon Sep 17 00:00:00 2001 From: Alexandre Flament Date: Fri, 4 Jun 2021 18:23:30 +0200 Subject: [fix] searx/data/__init__.py: rename __init__ as __all__ --- searx/data/__init__.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'searx/data/__init__.py') diff --git a/searx/data/__init__.py b/searx/data/__init__.py index b0e7d31d8..f566dafc2 100644 --- a/searx/data/__init__.py +++ b/searx/data/__init__.py @@ -1,9 +1,19 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later + import json from pathlib import Path -__init__ = ['ENGINES_LANGUGAGES', 'CURRENCIES', 'USER_AGENTS', 'EXTERNAL_URLS', 'WIKIDATA_UNITS', 'EXTERNAL_BANGS', - 'OSM_KEYS_TAGS', 'bangs_loader', 'ahmia_blacklist_loader'] +__all__ = [ + 'ENGINES_LANGUAGES', + 'CURRENCIES', + 'USER_AGENTS', + 'EXTERNAL_URLS', + 'WIKIDATA_UNITS', + 'EXTERNAL_BANGS', + 'OSM_KEYS_TAGS', + 'ahmia_blacklist_loader', +] data_dir = Path(__file__).parent -- cgit v1.2.3 From 5cf1ae2672cfc0969b4c49b4004604cbac6b3b3c Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Sun, 6 Jun 2021 08:13:50 +0200 Subject: [pylint] searx/data/__init__.py BTW: add doc strings and moved __all__ to the top [1] [1] https://www.python.org/dev/peps/pep-0008/#module-level-dunder-names Signed-off-by: Markus Heiser --- searx/data/__init__.py | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) (limited to 'searx/data/__init__.py') diff --git a/searx/data/__init__.py b/searx/data/__init__.py index f566dafc2..0f40355ec 100644 --- a/searx/data/__init__.py +++ b/searx/data/__init__.py @@ -1,8 +1,10 @@ # SPDX-License-Identifier: AGPL-3.0-or-later +# lint: pylint +"""This module holds the *data* created by:: -import json -from pathlib import Path + make data.all +""" __all__ = [ 'ENGINES_LANGUAGES', @@ -14,23 +16,32 @@ __all__ = [ 'OSM_KEYS_TAGS', 'ahmia_blacklist_loader', ] -data_dir = Path(__file__).parent +import json +from pathlib import Path -def load(filename): - with open(data_dir / filename, encoding='utf-8') as fd: - return json.load(fd) +data_dir = Path(__file__).parent +def _load(filename): + with open(data_dir / filename, encoding='utf-8') as f: + return json.load(f) def ahmia_blacklist_loader(): - with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as fd: - return fd.read().split() + """Load data from `ahmia_blacklist.txt` and return a list of MD5 values of onion + names. The MD5 values are fetched by:: + + searx_extra/update/update_ahmia_blacklist.py + + This function is used by :py:mod:`searx.plugins.ahmia_filter`. + """ + with open(str(data_dir / 'ahmia_blacklist.txt'), encoding='utf-8') as f: + return f.read().split() -ENGINES_LANGUAGES = load('engines_languages.json') -CURRENCIES = load('currencies.json') -USER_AGENTS = load('useragents.json') -EXTERNAL_URLS = load('external_urls.json') -WIKIDATA_UNITS = load('wikidata_units.json') -EXTERNAL_BANGS = load('external_bangs.json') -OSM_KEYS_TAGS = load('osm_keys_tags.json') +ENGINES_LANGUAGES = _load('engines_languages.json') +CURRENCIES = _load('currencies.json') +USER_AGENTS = _load('useragents.json') +EXTERNAL_URLS = _load('external_urls.json') +WIKIDATA_UNITS = _load('wikidata_units.json') +EXTERNAL_BANGS = _load('external_bangs.json') +OSM_KEYS_TAGS = _load('osm_keys_tags.json') -- cgit v1.2.3