From 4c06837a5047a5d3a7ae9bd5ec9fb38f86eb5268 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 10 Feb 2023 13:40:12 +0100 Subject: [PATCH] [mod] make python code pylint 2.16.1 compliant Signed-off-by: Markus Heiser --- .pylintrc | 2 +- searx/autocomplete.py | 1 + searx/engines/crossref.py | 1 + searx/engines/docker_hub.py | 1 + searx/engines/gigablast.py | 2 +- searx/search/processors/online.py | 1 + searx/webapp.py | 2 ++ searxng_extra/update/update_ahmia_blacklist.py | 2 ++ searxng_extra/update/update_firefox_version.py | 3 ++- 9 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.pylintrc b/.pylintrc index 51cea773e..a5b00227e 100644 --- a/.pylintrc +++ b/.pylintrc @@ -404,4 +404,4 @@ known-third-party=enchant # Exceptions that will emit a warning when being caught. Defaults to # "Exception" -overgeneral-exceptions=Exception +overgeneral-exceptions=builtins.Exception diff --git a/searx/autocomplete.py b/searx/autocomplete.py index 6fb5537a2..aeb697a14 100644 --- a/searx/autocomplete.py +++ b/searx/autocomplete.py @@ -3,6 +3,7 @@ """This module implements functions needed for the autocompleter. """ +# pylint: disable=use-dict-literal from json import loads from urllib.parse import urlencode diff --git a/searx/engines/crossref.py b/searx/engines/crossref.py index fbe2f0c2a..e12a0da5b 100644 --- a/searx/engines/crossref.py +++ b/searx/engines/crossref.py @@ -2,6 +2,7 @@ # lint: pylint """Semantic Scholar (Science) """ +# pylint: disable=use-dict-literal from urllib.parse import urlencode from searx.utils import html_to_text diff --git a/searx/engines/docker_hub.py b/searx/engines/docker_hub.py index 1e492b196..cde96d016 100644 --- a/searx/engines/docker_hub.py +++ b/searx/engines/docker_hub.py @@ -3,6 +3,7 @@ """Docker Hub (IT) """ +# pylint: disable=use-dict-literal from json import loads from urllib.parse import urlencode diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index 1c40ff331..382711b10 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -3,7 +3,7 @@ """ Gigablast (Web) """ -# pylint: disable=invalid-name +# pylint: disable=invalid-name, use-dict-literal import re from time import time diff --git a/searx/search/processors/online.py b/searx/search/processors/online.py index dd5d1e36b..242718416 100644 --- a/searx/search/processors/online.py +++ b/searx/search/processors/online.py @@ -4,6 +4,7 @@ """Processores for engine-type: ``online`` """ +# pylint: disable=use-dict-literal from timeit import default_timer import asyncio diff --git a/searx/webapp.py b/searx/webapp.py index d9ca3941c..07225908c 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -5,6 +5,8 @@ """WebbApp """ +# pylint: disable=use-dict-literal + import hashlib import hmac import json diff --git a/searxng_extra/update/update_ahmia_blacklist.py b/searxng_extra/update/update_ahmia_blacklist.py index 26c485195..a11413f14 100755 --- a/searxng_extra/update/update_ahmia_blacklist.py +++ b/searxng_extra/update/update_ahmia_blacklist.py @@ -9,6 +9,7 @@ Output file: :origin:`searx/data/ahmia_blacklist.txt` (:origin:`CI Update data .. _Ahmia's blacklist: https://ahmia.fi/blacklist/ """ +# pylint: disable=use-dict-literal from os.path import join @@ -21,6 +22,7 @@ URL = 'https://ahmia.fi/blacklist/banned/' def fetch_ahmia_blacklist(): resp = requests.get(URL, timeout=3.0) if resp.status_code != 200: + # pylint: disable=broad-exception-raised raise Exception("Error fetching Ahmia blacklist, HTTP code " + resp.status_code) return resp.text.split() diff --git a/searxng_extra/update/update_firefox_version.py b/searxng_extra/update/update_firefox_version.py index 384d0002f..51aec39c5 100755 --- a/searxng_extra/update/update_firefox_version.py +++ b/searxng_extra/update/update_firefox_version.py @@ -1,13 +1,13 @@ #!/usr/bin/env python # lint: pylint # SPDX-License-Identifier: AGPL-3.0-or-later - """Fetch firefox useragent signatures Output file: :origin:`searx/data/useragents.json` (:origin:`CI Update data ... <.github/workflows/data-update.yml>`). """ +# pylint: disable=use-dict-literal import json import re @@ -40,6 +40,7 @@ useragents = { def fetch_firefox_versions(): resp = requests.get(URL, timeout=2.0) if resp.status_code != 200: + # pylint: disable=broad-exception-raised raise Exception("Error fetching firefox versions, HTTP code " + resp.status_code) dom = html.fromstring(resp.text) versions = []