From 542f7d0d7bd1a12e1884ba4a1508b40e2514d472 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 11 Mar 2024 14:06:26 +0100 Subject: [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 --- searx/answerers/__init__.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'searx/answerers/__init__.py') 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: -- cgit v1.2.3