SearXNG is a free internet metasearch engine which aggregates results from various search services and databases. Users are neither tracked nor profiled.
Python bingbravedegoogleduckduckgogooglemetasearchprivacypythonqwantsearchsearch-enginesearxsearxngstartpageyahoo
[fix] pyright repported errors
Alexandre Flament2babf59adcc9
diff --git a/manage b/manageindex f7cada3e1..c887826e2 100755--- a/manage+++ b/manage@@ -698,7 +698,8 @@ test.pyright() {| grep -v '/engines/.*.py.* - warning: "logger" is not defined'\| grep -v '/plugins/.*.py.* - error: "logger" is not defined'\| grep -v '/engines/.*.py.* - warning: "supported_languages" is not defined' \- | grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined'+ | grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined' \+ | grep -v '/engines/.*.py.* - warning: "categories" is not defined'dump_return $?}diff --git a/searx/compat.py b/searx/compat.pyindex 504df7da2..15e27d45d 100644--- a/searx/compat.py+++ b/searx/compat.py@@ -7,8 +7,11 @@# pylint: disable=C,R+__all__ = ('cached_property',)++try:- from functools import cached_property # pylint: disable=unused-import+ from functools import cached_property # type: ignoreexcept ImportError:diff --git a/searx/engines/mongodb.py b/searx/engines/mongodb.pyindex c833ca9e0..63452bb68 100644--- a/searx/engines/mongodb.py+++ b/searx/engines/mongodb.py@@ -5,7 +5,7 @@"""import re-from pymongo import MongoClient # pylint: disable=import-error+from pymongo import MongoClient # pyright: ignore # pylint: disable=import-errorengine_type = 'offline'diff --git a/searx/engines/mysql_server.py b/searx/engines/mysql_server.pyindex c16093fb0..8d0a49565 100644--- a/searx/engines/mysql_server.py+++ b/searx/engines/mysql_server.py@@ -6,7 +6,7 @@# import error is ignored because the admin has to install mysql manually to use# the engine-import mysql.connector # pylint: disable=import-error+import mysql.connector # pyright: ignore # pylint: disable=import-errorengine_type = 'offline'auth_plugin = 'caching_sha2_password'diff --git a/searx/engines/postgresql.py b/searx/engines/postgresql.pyindex d8bbabe27..d7ff6a11b 100644--- a/searx/engines/postgresql.py+++ b/searx/engines/postgresql.py@@ -6,7 +6,7 @@# import error is ignored because the admin has to install mysql manually to use# the engine-import psycopg2 # pylint: disable=import-error+import psycopg2 # pyright: ignore # pylint: disable=import-errorengine_type = 'offline'host = "127.0.0.1"diff --git a/searx/search/__init__.py b/searx/search/__init__.pyindex c517814de..9d337916c 100644--- a/searx/search/__init__.py+++ b/searx/search/__init__.py@@ -2,11 +2,12 @@# lint: pylint# pylint: disable=missing-module-docstring, too-few-public-methods-import typingimport threadingfrom timeit import default_timerfrom uuid import uuid4+import flask+from searx import settingsfrom searx.answerers import askfrom searx.external_bang import get_bang_url@@ -181,7 +182,7 @@ class SearchWithPlugins(Search):__slots__ = 'ordered_plugin_list', 'request'- def __init__(self, search_query: SearchQuery, ordered_plugin_list, request: "flask.Request"):+ def __init__(self, search_query: SearchQuery, ordered_plugin_list, request: flask.Request):super().__init__(search_query)self.ordered_plugin_list = ordered_plugin_listself.result_container.on_result = self._on_resultdiff --git a/searx/search/checker/background.py b/searx/search/checker/background.pyindex f47e7d752..f8dfed4fa 100644--- a/searx/search/checker/background.py+++ b/searx/search/checker/background.py@@ -16,7 +16,7 @@ from searx import logger, settings, searx_debugfrom searx.exceptions import SearxSettingsExceptionfrom searx.search.processors import PROCESSORSfrom searx.search.checker import Checker-from searx.shared import schedule, storage+from searx.shared import schedule, storage # pyright: ignoreCHECKER_RESULT = 'CHECKER_RESULT'diff --git a/searx/shared/__init__.py b/searx/shared/__init__.pyindex 98c9a11c2..f03679c61 100644--- a/searx/shared/__init__.py+++ b/searx/shared/__init__.py@@ -1,11 +1,14 @@# SPDX-License-Identifier: AGPL-3.0-or-laterimport logging+import importliblogger = logging.getLogger('searx.shared')+__all__ = ['SharedDict', 'schedule']+try:- import uwsgi+ uwsgi = importlib.import_module('uwsgi')except:# no uwsgifrom .shared_simple import SimpleSharedDict as SharedDict, schedulediff --git a/searx/shared/shared_uwsgi.py b/searx/shared/shared_uwsgi.pyindex 4a6b0a155..0248c6234 100644--- a/searx/shared/shared_uwsgi.py+++ b/searx/shared/shared_uwsgi.py@@ -2,7 +2,7 @@import timefrom typing import Optional-import uwsgi # pylint: disable=E0401+import uwsgi # pyright: ignore # pylint: disable=E0401from . import shared_abstractdiff --git a/searx/utils.py b/searx/utils.pyindex 15f4d7092..4910b1b85 100644--- a/searx/utils.py+++ b/searx/utils.py@@ -66,7 +66,7 @@ def searx_useragent() -> str:).strip()-def gen_useragent(os_string: str = None) -> str:+def gen_useragent(os_string: Optional[str] = None) -> str:"""Return a random browser User AgentSee searx/data/useragents.json@@ -570,7 +570,7 @@ def eval_xpath(element: ElementBase, xpath_spec: XPathSpecType):raise SearxEngineXPathException(xpath_spec, arg) from e-def eval_xpath_list(element: ElementBase, xpath_spec: XPathSpecType, min_len: int = None):+def eval_xpath_list(element: ElementBase, xpath_spec: XPathSpecType, min_len: Optional[int] = None):"""Same as eval_xpath, check if the result is a listArgs:diff --git a/searx/version.py b/searx/version.pyindex ec72062e6..cefdb7a43 100644--- a/searx/version.py+++ b/searx/version.py@@ -6,6 +6,7 @@ import osimport shleximport subprocessimport logging+import importlib# fallback values# if there is searx.version_frozen module, and it is not possible to get the git tag@@ -73,7 +74,8 @@ def get_git_version():try:- from searx.version_frozen import VERSION_STRING, VERSION_TAG, GIT_URL, GIT_BRANCH+ vf = importlib.import_module('searx.version_frozen')+ VERSION_STRING, VERSION_TAG, GIT_URL, GIT_BRANCH = vf.VERSION_STRING, vf.VERSION_TAG, vf.GIT_URL, vf.GIT_BRANCHexcept ImportError:try:try:diff --git a/searx/webapp.py b/searx/webapp.pyindex 151eb5cc6..83bbeac06 100755--- a/searx/webapp.py+++ b/searx/webapp.py@@ -1303,7 +1303,7 @@ def opensearch():def favicon():theme = request.preferences.get_value("theme")return send_from_directory(- os.path.join(app.root_path, settings['ui']['static_path'], 'themes', theme, 'img'),+ os.path.join(app.root_path, settings['ui']['static_path'], 'themes', theme, 'img'), # pyright: ignore'favicon.png',mimetype='image/vnd.microsoft.icon',)