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
[chore] add DeprecationWarning for obsolete engine.about.language property (#6265)
Markus Heiser4fb49b44988b
diff --git a/searx/enginelib/__init__.py b/searx/enginelib/__init__.pyindex 0af69190d..1fdcbe6e2 100644--- a/searx/enginelib/__init__.py+++ b/searx/enginelib/__init__.py@@ -220,6 +220,10 @@ class EngineAbout(msgspec.Struct, kw_only=True):is available via a :py:obj:`EngineAbout.wikidata_id`."""+ language: str = ""+ """Deprecated! Migrate your setting from `engine.about.language` to+ `engine.language`"""+class Engine(abc.ABC): # pylint: disable=too-few-public-methods"""Class of engine instances build from YAML settings.diff --git a/searx/engines/__init__.py b/searx/engines/__init__.pyindex 6713aebd1..4175c9414 100644--- a/searx/engines/__init__.py+++ b/searx/engines/__init__.py@@ -14,6 +14,7 @@ import sysimport copyimport osfrom os.path import realpath, dirname+import warningsimport typesimport inspect@@ -184,8 +185,9 @@ def set_loggers(engine: "Engine|types.ModuleType", engine_name: str):def update_engine_attributes(engine: "Engine | types.ModuleType", engine_data: dict[str, t.Any]):- # set engine attributes from engine_data+ # pylint: disable=too-many-branches+ # set engine attributes from engine_datakvargs: dict[str, t.Any]if isinstance(engine.about, EngineAbout):kvargs = {**msgspec.to_builtins(engine.about), **engine_data.get("about", {})}@@ -199,6 +201,18 @@ def update_engine_attributes(engine: "Engine | types.ModuleType", engine_data: df"engine '{engine_data['name']}' ({engine_data['engine']}) - in the about section --> {exc}") from exc+ # warn about deprecated engine settings++ if engine.about.language:+ if hasattr(engine, "language") and not engine.language:+ engine.language = engine.about.language+ warnings.warn(+ f"engine '{engine_data['name']}' ({engine_data['engine']})"+ f" - migrate engine.about.language to engine.language!",+ DeprecationWarning,+ 2,+ )+for param_name, param_value in engine_data.items():if param_name == "about":continue