.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.favicons.config.FaviconConfig Class Reference
Inheritance diagram for searx.favicons.config.FaviconConfig:
Collaboration diagram for searx.favicons.config.FaviconConfig:

Public Member Functions

"FaviconConfig" from_toml_file (cls, pathlib.Path cfg_file, bool use_cache)

Static Public Attributes

FaviconCacheConfig cache = msgspec.field(default_factory=FaviconCacheConfig)
FaviconProxyConfig proxy = msgspec.field(default_factory=FaviconProxyConfig)

Detailed Description

The class aggregates configurations of the favicon tools

Definition at line 20 of file config.py.

Member Function Documentation

◆ from_toml_file()

"FaviconConfig" searx.favicons.config.FaviconConfig.from_toml_file ( cls,
pathlib.Path cfg_file,
bool use_cache )
Create a config object from a TOML file, the ``use_cache`` argument
specifies whether a cache should be used.

Definition at line 36 of file config.py.

36 def from_toml_file(cls, cfg_file: pathlib.Path, use_cache: bool) -> "FaviconConfig":
37 """Create a config object from a TOML file, the ``use_cache`` argument
38 specifies whether a cache should be used.
39 """
40
41 cached = TOML_CACHE_CFG.get(str(cfg_file))
42 if use_cache and cached:
43 return cached
44
45 with cfg_file.open("rb") as f:
46 data = f.read()
47
48 cfg = msgspec.toml.decode(data, type=_FaviconConfig)
49 schema = cfg.favicons.cfg_schema
50 if schema != CONFIG_SCHEMA:
51 raise ValueError(
52 f"config schema version {CONFIG_SCHEMA} is needed, version {schema} is given in {cfg_file}"
53 )
54
55 cfg = cfg.favicons
56 if use_cache and cached:
57 TOML_CACHE_CFG[str(cfg_file.resolve())] = cfg
58
59 return cfg
60
61

Member Data Documentation

◆ cache

FaviconCacheConfig searx.favicons.config.FaviconConfig.cache = msgspec.field(default_factory=FaviconCacheConfig)
static

Definition at line 29 of file config.py.

◆ proxy

FaviconProxyConfig searx.favicons.config.FaviconConfig.proxy = msgspec.field(default_factory=FaviconProxyConfig)
static

Definition at line 32 of file config.py.


The documentation for this class was generated from the following file:
  • /home/andrew/Documents/code/public/searxng/searx/favicons/config.py