diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-03-11 14:06:26 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-03-11 14:55:38 +0100 |
commit | 542f7d0d7bd1a12e1884ba4a1508b40e2514d472 (patch) | |
tree | 5256282b267e494200d02914593457854567fec4 /searx/answerers | |
parent | 8205f170ff983e5240d32dc17d7fdb526ebe5fe7 (diff) | |
download | searxng-542f7d0d7bd1a12e1884ba4a1508b40e2514d472.tar.gz searxng-542f7d0d7bd1a12e1884ba4a1508b40e2514d472.zip |
[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION
In the past, some files were tested with the standard profile, others with a
profile in which most of the messages were switched off ... some files were not
checked at all.
- ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished
- the distinction ``# lint: pylint`` is no longer necessary
- the pylint tasks have been reduced from three to two
1. ./searx/engines -> lint engines with additional builtins
2. ./searx ./searxng_extra ./tests -> lint all other python files
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/answerers')
-rw-r--r-- | searx/answerers/__init__.py | 15 | ||||
-rw-r--r-- | searx/answerers/random/answerer.py | 2 | ||||
-rw-r--r-- | searx/answerers/statistics/answerer.py | 1 |
3 files changed, 13 insertions, 5 deletions
diff --git a/searx/answerers/__init__.py b/searx/answerers/__init__.py index 8e2b9b35a..346bbb085 100644 --- a/searx/answerers/__init__.py +++ b/searx/answerers/__init__.py @@ -1,25 +1,30 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring + +import sys from os import listdir from os.path import realpath, dirname, join, isdir -from searx.utils import load_module from collections import defaultdict +from searx.utils import load_module answerers_dir = dirname(realpath(__file__)) def load_answerers(): - answerers = [] + answerers = [] # pylint: disable=redefined-outer-name + for filename in listdir(answerers_dir): if not isdir(join(answerers_dir, filename)) or filename.startswith('_'): continue module = load_module('answerer.py', join(answerers_dir, filename)) - if not hasattr(module, 'keywords') or not isinstance(module.keywords, tuple) or not len(module.keywords): - exit(2) + if not hasattr(module, 'keywords') or not isinstance(module.keywords, tuple) or not module.keywords: + sys.exit(2) answerers.append(module) return answerers -def get_answerers_by_keywords(answerers): +def get_answerers_by_keywords(answerers): # pylint:disable=redefined-outer-name by_keyword = defaultdict(list) for answerer in answerers: for keyword in answerer.keywords: diff --git a/searx/answerers/random/answerer.py b/searx/answerers/random/answerer.py index a1306e2eb..efdce0407 100644 --- a/searx/answerers/random/answerer.py +++ b/searx/answerers/random/answerer.py @@ -1,3 +1,5 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later + import hashlib import random import string diff --git a/searx/answerers/statistics/answerer.py b/searx/answerers/statistics/answerer.py index 60f0d304f..3c38243de 100644 --- a/searx/answerers/statistics/answerer.py +++ b/searx/answerers/statistics/answerer.py @@ -1,3 +1,4 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later from functools import reduce from operator import mul |