summaryrefslogtreecommitdiff
path: root/searxng_extra/update/update_external_bangs.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2021-12-27 09:26:22 +0100
committerMarkus Heiser <markus.heiser@darmarit.de>2021-12-27 09:26:22 +0100
commit3d96a9839a12649874b6d4cf9466bd3616b0a03c (patch)
treee7d54d1e345b1e792d538ddc250f4827bb2fd9b9 /searxng_extra/update/update_external_bangs.py
parentfcdc2c2cd26e24c2aa3f064d93cee3e29dc2a30c (diff)
downloadsearxng-3d96a9839a12649874b6d4cf9466bd3616b0a03c.tar.gz
searxng-3d96a9839a12649874b6d4cf9466bd3616b0a03c.zip
[format.python] initial formatting of the python code
This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searxng_extra/update/update_external_bangs.py')
-rwxr-xr-xsearxng_extra/update/update_external_bangs.py11
1 files changed, 4 insertions, 7 deletions
diff --git a/searxng_extra/update/update_external_bangs.py b/searxng_extra/update/update_external_bangs.py
index 27882bb24..d5c6b585a 100755
--- a/searxng_extra/update/update_external_bangs.py
+++ b/searxng_extra/update/update_external_bangs.py
@@ -113,13 +113,13 @@ def parse_ddg_bangs(ddg_bangs):
# only for the https protocol: "https://example.com" becomes "//example.com"
if bang_url.startswith(HTTPS_COLON + '//'):
- bang_url = bang_url[len(HTTPS_COLON):]
+ bang_url = bang_url[len(HTTPS_COLON) :]
#
- if bang_url.startswith(HTTP_COLON + '//') and bang_url[len(HTTP_COLON):] in bang_urls:
+ if bang_url.startswith(HTTP_COLON + '//') and bang_url[len(HTTP_COLON) :] in bang_urls:
# if the bang_url uses the http:// protocol, and the same URL exists in https://
# then reuse the https:// bang definition. (written //example.com)
- bang_def_output = bang_urls[bang_url[len(HTTP_COLON):]]
+ bang_def_output = bang_urls[bang_url[len(HTTP_COLON) :]]
else:
# normal use case : new http:// URL or https:// URL (without "https:", see above)
bang_rank = str(bang_definition['r'])
@@ -151,9 +151,6 @@ def get_bangs_filename():
if __name__ == '__main__':
bangs_url, bangs_version = get_bang_url()
print(f'fetch bangs from {bangs_url}')
- output = {
- 'version': bangs_version,
- 'trie': parse_ddg_bangs(fetch_ddg_bangs(bangs_url))
- }
+ output = {'version': bangs_version, 'trie': parse_ddg_bangs(fetch_ddg_bangs(bangs_url))}
with open(get_bangs_filename(), 'w', encoding="utf8") as fp:
json.dump(output, fp, ensure_ascii=False, indent=4)