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.
41 cached = TOML_CACHE_CFG.get(str(cfg_file))
42 if use_cache
and cached:
45 with cfg_file.open(
"rb")
as f:
48 cfg = msgspec.toml.decode(data, type=_FaviconConfig)
49 schema = cfg.favicons.cfg_schema
50 if schema != CONFIG_SCHEMA:
52 f
"config schema version {CONFIG_SCHEMA} is needed, version {schema} is given in {cfg_file}"
56 if use_cache
and cached:
57 TOML_CACHE_CFG[str(cfg_file.resolve())] = cfg