mirror of
https://github.com/searxng/searxng.git
synced 2026-05-07 18:03:51 +02:00
[mod] addition of various type hints / engine processors
Continuation of #5147 .. typification of the engine processors. BTW: - removed obsolete engine property https_support - fixed & improved currency_convert - engine instances can now implement a engine.setup method [#5147] https://github.com/searxng/searxng/pull/5147 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
23257bddce
commit
8f8343dc0d
@@ -1,8 +1,7 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# pylint: disable=missing-module-docstring, too-few-public-methods
|
||||
|
||||
# the public namespace has not yet been finally defined ..
|
||||
# __all__ = [..., ]
|
||||
__all__ = ["SearchWithPlugins"]
|
||||
|
||||
import typing as t
|
||||
|
||||
@@ -22,7 +21,7 @@ from searx.metrics import initialize as initialize_metrics, counter_inc
|
||||
from searx.network import initialize as initialize_network, check_network_configuration
|
||||
from searx.results import ResultContainer
|
||||
from searx.search.checker import initialize as initialize_checker
|
||||
from searx.search.processors import PROCESSORS, initialize as initialize_processors
|
||||
from searx.search.processors import PROCESSORS
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
@@ -44,7 +43,7 @@ def initialize(
|
||||
if check_network:
|
||||
check_network_configuration()
|
||||
initialize_metrics([engine['name'] for engine in settings_engines], enable_metrics)
|
||||
initialize_processors(settings_engines)
|
||||
PROCESSORS.init(settings_engines)
|
||||
if enable_checker:
|
||||
initialize_checker()
|
||||
|
||||
@@ -52,8 +51,6 @@ def initialize(
|
||||
class Search:
|
||||
"""Search information container"""
|
||||
|
||||
__slots__ = "search_query", "result_container", "start_time", "actual_timeout" # type: ignore
|
||||
|
||||
def __init__(self, search_query: "SearchQuery"):
|
||||
"""Initialize the Search"""
|
||||
# init vars
|
||||
@@ -185,8 +182,6 @@ class Search:
|
||||
class SearchWithPlugins(Search):
|
||||
"""Inherit from the Search class, add calls to the plugins."""
|
||||
|
||||
__slots__ = 'user_plugins', 'request'
|
||||
|
||||
def __init__(self, search_query: "SearchQuery", request: "SXNG_Request", user_plugins: list[str]):
|
||||
super().__init__(search_query)
|
||||
self.user_plugins = user_plugins
|
||||
|
||||
Reference in New Issue
Block a user