From 20de10df4eb02f228512604ed1db092eaa08ec3e Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Fri, 28 Nov 2025 12:34:49 +0100 Subject: [PATCH] Revert "[fix:py3.14] Struct fields aren't discovered in Python 3.14" This reverts commit 8fdc59a7604cd661638586ff0381530da86eb76c. --- searx/cache.py | 4 ---- searx/favicons/cache.py | 4 ---- searx/favicons/config.py | 3 --- searx/favicons/proxy.py | 3 --- searx/result_types/_base.py | 4 ---- searx/result_types/answer.py | 3 --- searx/result_types/code.py | 4 ---- searx/result_types/keyvalue.py | 3 --- searx/result_types/paper.py | 4 ---- searx/weather.py | 13 ++++--------- 10 files changed, 4 insertions(+), 41 deletions(-) diff --git a/searx/cache.py b/searx/cache.py index 062f34768..ea58c9328 100644 --- a/searx/cache.py +++ b/searx/cache.py @@ -5,10 +5,6 @@ ---- """ -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations - __all__ = ["ExpireCacheCfg", "ExpireCacheStats", "ExpireCache", "ExpireCacheSQLite"] import abc diff --git a/searx/favicons/cache.py b/searx/favicons/cache.py index d724e086c..f623ac3a7 100644 --- a/searx/favicons/cache.py +++ b/searx/favicons/cache.py @@ -17,10 +17,6 @@ """ -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations - import typing as t import os diff --git a/searx/favicons/config.py b/searx/favicons/config.py index 217fce049..c22e1f3f0 100644 --- a/searx/favicons/config.py +++ b/searx/favicons/config.py @@ -1,9 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # pylint: disable=missing-module-docstring -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations import pathlib import msgspec diff --git a/searx/favicons/proxy.py b/searx/favicons/proxy.py index 6a0867458..1346d19b0 100644 --- a/searx/favicons/proxy.py +++ b/searx/favicons/proxy.py @@ -1,9 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Implementations for a favicon proxy""" -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations from typing import Callable diff --git a/searx/result_types/_base.py b/searx/result_types/_base.py index ffcf7f143..04e95dc07 100644 --- a/searx/result_types/_base.py +++ b/searx/result_types/_base.py @@ -16,10 +16,6 @@ :members: """ -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations - __all__ = ["Result"] import typing as t diff --git a/searx/result_types/answer.py b/searx/result_types/answer.py index d6c28001d..1a24f12f1 100644 --- a/searx/result_types/answer.py +++ b/searx/result_types/answer.py @@ -28,9 +28,6 @@ template. """ # pylint: disable=too-few-public-methods -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations __all__ = ["AnswerSet", "Answer", "Translations", "WeatherAnswer"] diff --git a/searx/result_types/code.py b/searx/result_types/code.py index d6cd84724..d6dec104e 100644 --- a/searx/result_types/code.py +++ b/searx/result_types/code.py @@ -14,10 +14,6 @@ template. For highlighting the code passages, Pygments_ is used. """ # pylint: disable=too-few-public-methods, disable=invalid-name -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations - __all__ = ["Code"] import typing as t diff --git a/searx/result_types/keyvalue.py b/searx/result_types/keyvalue.py index d68318da6..33718e7c2 100644 --- a/searx/result_types/keyvalue.py +++ b/searx/result_types/keyvalue.py @@ -13,9 +13,6 @@ template. """ # pylint: disable=too-few-public-methods -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations __all__ = ["KeyValue"] diff --git a/searx/result_types/paper.py b/searx/result_types/paper.py index dd23a72d2..6cad4c2f8 100644 --- a/searx/result_types/paper.py +++ b/searx/result_types/paper.py @@ -21,10 +21,6 @@ Related topics: """ # pylint: disable=too-few-public-methods, disable=invalid-name -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations - __all__ = ["Paper"] import typing as t diff --git a/searx/weather.py b/searx/weather.py index 5627cd0db..a5832410d 100644 --- a/searx/weather.py +++ b/searx/weather.py @@ -2,15 +2,6 @@ """Implementations used for weather conditions and forecast.""" # pylint: disable=too-few-public-methods -# Struct fields aren't discovered in Python 3.14 -# - https://github.com/searxng/searxng/issues/5284 -from __future__ import annotations - -# msgspec: note that if using PEP 563 “postponed evaluation of annotations” -# (e.g. from __future__ import annotations) only the following spellings will -# work: https://jcristharif.com/msgspec/structs.html#class-variables -from typing import ClassVar - __all__ = [ "symbol_url", "Temperature", @@ -23,6 +14,10 @@ __all__ = [ "GeoLocation", ] +# msgspec: note that if using PEP 563 “postponed evaluation of annotations” +# (e.g. from __future__ import annotations) only the following spellings will +# work: https://jcristharif.com/msgspec/structs.html#class-variables +from typing import ClassVar import typing as t import base64