1
0
mirror of https://github.com/searxng/searxng.git synced 2024-11-04 20:30:11 +01:00

Drop typing-extensions dependency (#3265)

Co-authored-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Alexandre Flament 2024-03-02 13:10:31 +01:00 committed by GitHub
parent 1892a87fd2
commit 38fdd2288a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 8 deletions

View File

@ -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

View File

@ -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)

View File

@ -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