diff options
Diffstat (limited to 'searx/preferences.py')
| -rw-r--r-- | searx/preferences.py | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/searx/preferences.py b/searx/preferences.py index 209cf06f1..9f810ec72 100644 --- a/searx/preferences.py +++ b/searx/preferences.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Searx preferences implementation. """ +from __future__ import annotations # pylint: disable=useless-object-inheritance @@ -13,12 +14,14 @@ from collections import OrderedDict import flask import babel +import searx.plugins + from searx import settings, autocomplete, favicons from searx.enginelib import Engine -from searx.plugins import Plugin +from searx.engines import DEFAULT_CATEGORY +from searx.extended_types import SXNG_Request from searx.locales import LOCALE_NAMES from searx.webutils import VALID_LANGUAGE_CODE -from searx.engines import DEFAULT_CATEGORY COOKIE_MAX_AGE = 60 * 60 * 24 * 365 * 5 # 5 years @@ -312,7 +315,7 @@ class EnginesSetting(BooleanChoices): class PluginsSetting(BooleanChoices): """Plugin settings""" - def __init__(self, default_value, plugins: Iterable[Plugin]): + def __init__(self, default_value, plugins: Iterable[searx.plugins.Plugin]): super().__init__(default_value, {plugin.id: plugin.default_on for plugin in plugins}) def transform_form_items(self, items): @@ -340,7 +343,7 @@ class ClientPref: return tag @classmethod - def from_http_request(cls, http_request: flask.Request): + def from_http_request(cls, http_request: SXNG_Request): """Build ClientPref object from HTTP request. - `Accept-Language used for locale setting @@ -375,11 +378,11 @@ class Preferences: def __init__( self, - themes: List[str], - categories: List[str], - engines: Dict[str, Engine], - plugins: Iterable[Plugin], - client: Optional[ClientPref] = None, + themes: list[str], + categories: list[str], + engines: dict[str, Engine], + plugins: searx.plugins.PluginStorage, + client: ClientPref | None = None, ): super().__init__() |