[refactor] replace pydantic by msgspec

Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
Markus Heiser 2024-10-17 21:17:26 +02:00 committed by Markus Heiser
parent e392892578
commit 3e5621e1af
4 changed files with 25 additions and 22 deletions

View file

@ -12,7 +12,7 @@ import urllib.parse
import flask
from httpx import HTTPError
from pydantic import BaseModel
import msgspec
from searx import get_setting
@ -41,7 +41,7 @@ def _initial_resolver_map():
return d
class FaviconProxyConfig(BaseModel):
class FaviconProxyConfig(msgspec.Struct):
"""Configuration of the favicon proxy."""
max_age: int = 60 * 60 * 24 * 7 # seven days
@ -59,7 +59,7 @@ class FaviconProxyConfig(BaseModel):
outgoing request of the resolver. By default, the value from
:ref:`outgoing.request_timeout <settings outgoing>` setting is used."""
resolver_map: dict[str, str] = _initial_resolver_map()
resolver_map: dict[str, str] = msgspec.field(default_factory=_initial_resolver_map)
"""The resolver_map is a key / value dictionary where the key is the name of
the resolver and the value is the fully qualifying name (fqn) of resolver's
function (the callable). The resolvers from the python module