summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-12-27 09:16:03 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-12-27 09:16:03 +0100
commitfcdc2c2cd26e24c2aa3f064d93cee3e29dc2a30c (patch)
tree3e508c94d5ac69869aa69fc686cd54e02bfcad27 /searx/engines
parentc849731eb1df23b8509a947fcc2807adb34dc730 (diff)
downloadsearxng-fcdc2c2cd26e24c2aa3f064d93cee3e29dc2a30c.tar.gz
searxng-fcdc2c2cd26e24c2aa3f064d93cee3e29dc2a30c.zip
[format.python] disable py code formatting for some hunks of code
Disable the python code formatting from python-black, where the readability of code suffers by formatting. Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/archlinux.py2
-rw-r--r--searx/engines/bing_news.py4
-rw-r--r--searx/engines/sepiasearch.py2
-rw-r--r--searx/engines/wikidata.py22
4 files changed, 22 insertions, 8 deletions
diff --git a/searx/engines/archlinux.py b/searx/engines/archlinux.py
index aeac145d1..1aa8d0ade 100644
--- a/searx/engines/archlinux.py
+++ b/searx/engines/archlinux.py
@@ -39,6 +39,7 @@ def locale_to_lang_code(locale):
# wikis for some languages were moved off from the main site, we need to make
# requests to correct URLs to be able to get results in those languages
lang_urls = {
+ # fmt: off
'all': {
'base': 'https://wiki.archlinux.org',
'search': '/index.php?title=Special:Search&offset={offset}&{query}'
@@ -63,6 +64,7 @@ lang_urls = {
'base': 'http://archtr.org/wiki',
'search': '/index.php?title=Özel:Ara&offset={offset}&{query}'
}
+ # fmt: on
}
diff --git a/searx/engines/bing_news.py b/searx/engines/bing_news.py
index c2515385c..f0bc8bead 100644
--- a/searx/engines/bing_news.py
+++ b/searx/engines/bing_news.py
@@ -69,21 +69,25 @@ def image_url_cleanup(url_string):
def _get_url(query, language, offset, time_range):
if time_range in time_range_dict:
search_path = search_string_with_time.format(
+ # fmt: off
query = urlencode({
'q': query,
'setmkt': language
}),
offset = offset,
interval = time_range_dict[time_range]
+ # fmt: on
)
else:
# e.g. setmkt=de-de&setlang=de
search_path = search_string.format(
+ # fmt: off
query = urlencode({
'q': query,
'setmkt': language
}),
offset = offset
+ # fmt: on
)
return base_url + search_path
diff --git a/searx/engines/sepiasearch.py b/searx/engines/sepiasearch.py
index 8ccde404f..ebad20d01 100644
--- a/searx/engines/sepiasearch.py
+++ b/searx/engines/sepiasearch.py
@@ -23,9 +23,11 @@ paging = True
time_range_support = True
safesearch = True
supported_languages = [
+ # fmt: off
'en', 'fr', 'ja', 'eu', 'ca', 'cs', 'eo', 'el',
'de', 'it', 'nl', 'es', 'oc', 'gd', 'zh', 'pt',
'sv', 'pl', 'fi', 'ru'
+ # fmt: on
]
base_url = 'https://sepiasearch.org/api/v1/search/videos'
diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py
index f0dfc7595..59413499c 100644
--- a/searx/engines/wikidata.py
+++ b/searx/engines/wikidata.py
@@ -92,14 +92,20 @@ WHERE {
# https://www.w3.org/TR/sparql11-query/#rSTRING_LITERAL1
# https://lists.w3.org/Archives/Public/public-rdf-dawg/2011OctDec/0175.html
-sparql_string_escape = get_string_replaces_function({'\t': '\\\t',
- '\n': '\\\n',
- '\r': '\\\r',
- '\b': '\\\b',
- '\f': '\\\f',
- '\"': '\\\"',
- '\'': '\\\'',
- '\\': '\\\\'})
+sparql_string_escape = get_string_replaces_function(
+ # fmt: off
+ {
+ '\t': '\\\t',
+ '\n': '\\\n',
+ '\r': '\\\r',
+ '\b': '\\\b',
+ '\f': '\\\f',
+ '\"': '\\\"',
+ '\'': '\\\'',
+ '\\': '\\\\'
+ }
+ # fmt: on
+)
replace_http_by_https = get_string_replaces_function({'http:': 'https:'})