summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2023-06-05 10:37:42 +0200
committerMarkus Heiser <markus.heiser@darmarit.de>2023-06-05 14:07:19 +0200
commit22b13f4fa5fafd73ee1124fac4981a081906ff18 (patch)
tree83acfe2794afbc1363e7f7675bbbece4bf6be807
parentf3763d73ad8cf93ea32d7e12713662f7963d950f (diff)
downloadsearxng-22b13f4fa5fafd73ee1124fac4981a081906ff18.tar.gz
searxng-22b13f4fa5fafd73ee1124fac4981a081906ff18.zip
[mod] tools.Config.get(): add missing type annotations
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--searx/tools/config.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/searx/tools/config.py b/searx/tools/config.py
index f998031ba..d2710456f 100644
--- a/searx/tools/config.py
+++ b/searx/tools/config.py
@@ -8,6 +8,7 @@ structured dictionaries. The configuration schema is defined in a dictionary
structure and the configuration data is given in a dictionary structure.
"""
from __future__ import annotations
+from typing import Any
import copy
import typing
@@ -97,7 +98,7 @@ class Config:
self.deprecated = deprecated
self.cfg = copy.deepcopy(cfg_schema)
- def __getitem__(self, key: str):
+ def __getitem__(self, key: str) -> Any:
return self.get(key)
def validate(self, cfg: dict):
@@ -115,7 +116,7 @@ class Config:
"""Returns default value of field ``name`` in ``self.cfg_schema``."""
return value(name, self.cfg_schema)
- def get(self, name: str, default=UNSET, replace=True):
+ def get(self, name: str, default: Any = UNSET, replace: bool = True) -> Any:
"""Returns the value to which ``name`` points in the configuration.
If there is no such ``name`` in the config and the ``default`` is