summaryrefslogtreecommitdiff
path: root/searx/answerers
diff options
context:
space:
mode:
Diffstat (limited to 'searx/answerers')
-rw-r--r--searx/answerers/__init__.py15
-rw-r--r--searx/answerers/random/answerer.py2
-rw-r--r--searx/answerers/statistics/answerer.py1
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