.oO SearXNG Developer Documentation Oo.
|
Public Member Functions | |
Config | from_toml (cls, pathlib.Path schema_file, pathlib.Path cfg_file, dict deprecated) |
__init__ (self, typing.Dict cfg_schema, typing.Dict[str, str] deprecated) | |
Any | __getitem__ (self, str key) |
validate (self, dict cfg) | |
update (self, dict upd_cfg) | |
default (self, str name) | |
Any | get (self, str name, Any default=UNSET, bool replace=True) |
set (self, str name, val) | |
path (self, str name, default=UNSET) | |
pyobj (self, name, default=UNSET) | |
Public Attributes | |
cfg_schema = cfg_schema | |
deprecated = deprecated | |
cfg = copy.deepcopy(cfg_schema) | |
Static Public Attributes | |
UNSET = UNSET | |
Protected Member Functions | |
_get_parent_dict (self, name) | |
searx.botdetection.config.Config.__init__ | ( | self, | |
typing.Dict | cfg_schema, | ||
typing.Dict[str, str] | deprecated ) |
Construtor of class Config. :param cfg_schema: Schema of the configuration :param deprecated: dictionary that maps deprecated configuration names to a messages These values are needed for validation, see :py:obj:`validate`.
Definition at line 83 of file config.py.
Any searx.botdetection.config.Config.__getitem__ | ( | self, | |
str | key ) |
Definition at line 96 of file config.py.
References searx.botdetection.config.Config.get(), searx.metrics.models.CounterStorage.get(), searx.metrics.models.HistogramStorage.get(), and searx.network.Request.get().
|
protected |
Definition at line 141 of file config.py.
References searx.botdetection.config.Config.cfg, searx.favicons.cache.FaviconCacheMEM.cfg, searx.favicons.cache.FaviconCacheSQLite.cfg, and searx.botdetection.config.value().
Referenced by searx.botdetection.config.Config.get(), and searx.botdetection.config.Config.set().
searx.botdetection.config.Config.default | ( | self, | |
str | name ) |
Returns default value of field ``name`` in ``self.cfg_schema``.
Definition at line 110 of file config.py.
References searx.botdetection.config.Config.cfg_schema, and searx.botdetection.config.value().
Referenced by searx.settings_defaults.SettingsDirectoryValue.__call__(), and searx.settings_defaults.SettingsValue.__call__().
Config searx.botdetection.config.Config.from_toml | ( | cls, | |
pathlib.Path | schema_file, | ||
pathlib.Path | cfg_file, | ||
dict | deprecated ) |
Definition at line 60 of file config.py.
References searx.botdetection.config.toml_load().
Any searx.botdetection.config.Config.get | ( | self, | |
str | name, | ||
Any | default = UNSET, | ||
bool | replace = True ) |
Returns the value to which ``name`` points in the configuration. If there is no such ``name`` in the config and the ``default`` is :py:obj:`UNSET`, a :py:obj:`KeyError` is raised.
Definition at line 114 of file config.py.
References searx.botdetection.config.Config._get_parent_dict().
Referenced by searx.botdetection.config.Config.__getitem__(), searx.botdetection.config.Config.path(), and searx.botdetection.config.Config.pyobj().
searx.botdetection.config.Config.path | ( | self, | |
str | name, | ||
default = UNSET ) |
Get a :py:class:`pathlib.Path` object from a config string.
Definition at line 151 of file config.py.
References searx.botdetection.config.Config.get(), searx.metrics.models.CounterStorage.get(), searx.metrics.models.HistogramStorage.get(), and searx.network.Request.get().
searx.botdetection.config.Config.pyobj | ( | self, | |
name, | |||
default = UNSET ) |
Get python object refered by full qualiffied name (FQN) in the config string.
Definition at line 161 of file config.py.
References searx.botdetection.config.Config.get(), searx.metrics.models.CounterStorage.get(), searx.metrics.models.HistogramStorage.get(), and searx.network.Request.get().
searx.botdetection.config.Config.set | ( | self, | |
str | name, | ||
val ) |
Set the value to which ``name`` points in the configuration. If there is no such ``name`` in the config, a :py:obj:`KeyError` is raised.
Definition at line 132 of file config.py.
References searx.botdetection.config.Config._get_parent_dict().
searx.botdetection.config.Config.update | ( | self, | |
dict | upd_cfg ) |
Update this configuration by ``upd_cfg``.
Definition at line 105 of file config.py.
References searx.botdetection.config.Config.cfg, searx.favicons.cache.FaviconCacheMEM.cfg, searx.favicons.cache.FaviconCacheSQLite.cfg, and searx.botdetection.config.dict_deepupdate().
searx.botdetection.config.Config.validate | ( | self, | |
dict | cfg ) |
Validation of dictionary ``cfg`` on :py:obj:`Config.SCHEMA`. Validation is done by :py:obj:`validate`.
Definition at line 99 of file config.py.
References searx.botdetection.config.Config.cfg_schema, searx.botdetection.config.Config.deprecated, and searx.botdetection.config.Config.validate().
Referenced by searx.botdetection.config.Config.validate().
searx.botdetection.config.Config.cfg = copy.deepcopy(cfg_schema) |
Definition at line 94 of file config.py.
Referenced by searx.botdetection.config.Config._get_parent_dict(), searx.favicons.cache.FaviconCacheSQLite.next_maintenance_time(), searx.favicons.cache.FaviconCacheSQLite.set(), and searx.botdetection.config.Config.update().
searx.botdetection.config.Config.cfg_schema = cfg_schema |
Definition at line 92 of file config.py.
Referenced by searx.botdetection.config.Config.default(), and searx.botdetection.config.Config.validate().
searx.botdetection.config.Config.deprecated = deprecated |
Definition at line 93 of file config.py.
Referenced by searx.botdetection.config.Config.validate().