summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2024-03-02 13:10:31 +0100
committerGitHub <noreply@github.com>2024-03-02 13:10:31 +0100
commit38fdd2288a8c5ffbd94c6068bc4ef6ec9a3df415 (patch)
treebecee542e4921a5eda6c12b6201b88b7e14de58a
parent1892a87fd2139252b80f48f4e079a7b37b2b55c3 (diff)
downloadsearxng-38fdd2288a8c5ffbd94c6068bc4ef6ec9a3df415.tar.gz
searxng-38fdd2288a8c5ffbd94c6068bc4ef6ec9a3df415.zip
Drop typing-extensions dependency (#3265)
Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--requirements.txt1
-rw-r--r--searx/enginelib/traits.py9
-rw-r--r--searx/search/checker/background.py3
3 files changed, 5 insertions, 8 deletions
diff --git a/requirements.txt b/requirements.txt
index 78b7d1142..80f0bdb47 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -14,6 +14,5 @@ httpx-socks[asyncio]==0.7.7
setproctitle==1.3.3
redis==5.0.2
markdown-it-py==3.0.0
-typing_extensions==4.9.0
fasttext-predict==0.9.2.2
pytomlpp==1.0.13
diff --git a/searx/enginelib/traits.py b/searx/enginelib/traits.py
index 6402fde22..e1a5df79a 100644
--- a/searx/enginelib/traits.py
+++ b/searx/enginelib/traits.py
@@ -14,8 +14,7 @@ from __future__ import annotations
import json
import dataclasses
import types
-from typing import Dict, Iterable, Union, Callable, Optional, TYPE_CHECKING
-from typing_extensions import Literal, Self
+from typing import Dict, Literal, Iterable, Union, Callable, Optional, TYPE_CHECKING
from searx import locales
from searx.data import data_dir, ENGINE_TRAITS
@@ -136,7 +135,7 @@ class EngineTraits:
return EngineTraits(**dataclasses.asdict(self))
@classmethod
- def fetch_traits(cls, engine: Engine) -> Union[Self, None]:
+ def fetch_traits(cls, engine: Engine) -> Union['EngineTraits', None]:
"""Call a function ``fetch_traits(engine_traits)`` from engines namespace to fetch
and set properties from the origin engine in the object ``engine_traits``. If
function does not exists, ``None`` is returned.
@@ -204,7 +203,7 @@ class EngineTraitsMap(Dict[str, EngineTraits]):
json.dump(self, f, indent=2, sort_keys=True, cls=EngineTraitsEncoder)
@classmethod
- def from_data(cls) -> Self:
+ def from_data(cls) -> 'EngineTraitsMap':
"""Instantiate :class:`EngineTraitsMap` object from :py:obj:`ENGINE_TRAITS`"""
obj = cls()
for k, v in ENGINE_TRAITS.items():
@@ -212,7 +211,7 @@ class EngineTraitsMap(Dict[str, EngineTraits]):
return obj
@classmethod
- def fetch_traits(cls, log: Callable) -> Self:
+ def fetch_traits(cls, log: Callable) -> 'EngineTraitsMap':
from searx import engines # pylint: disable=cyclic-import, import-outside-toplevel
names = list(engines.engines)
diff --git a/searx/search/checker/background.py b/searx/search/checker/background.py
index aec2a1790..f16e4c25c 100644
--- a/searx/search/checker/background.py
+++ b/searx/search/checker/background.py
@@ -8,8 +8,7 @@ import time
import threading
import os
import signal
-from typing import Dict, Union, List, Any, Tuple, Optional
-from typing_extensions import TypedDict, Literal
+from typing import Any, Dict, List, Literal, Optional, Tuple, TypedDict, Union
import redis.exceptions