diff options
author | Martin Fischer <martin@push-f.com> | 2022-01-04 11:53:42 +0100 |
---|---|---|
committer | Martin Fischer <martin@push-f.com> | 2022-01-06 14:21:14 +0100 |
commit | bb06758a7b737befcb28b8fe202d2c6da767146d (patch) | |
tree | b0d410e89d838ddd1a1d839a2ba1c5db96fb3f55 /searx/plugins | |
parent | 93c6829b27d5319ca85af798015f1e11da566f1f (diff) | |
download | searxng-bb06758a7b737befcb28b8fe202d2c6da767146d.tar.gz searxng-bb06758a7b737befcb28b8fe202d2c6da767146d.zip |
[refactor] add type hints & remove Setting._post_init
Previously the Setting classes used a horrible _post_init
hack that prevented proper type checking.
Diffstat (limited to 'searx/plugins')
-rw-r--r-- | searx/plugins/__init__.py | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index 7815c2099..6c1bea8d0 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -10,10 +10,20 @@ from os.path import abspath, basename, dirname, exists, join from shutil import copyfile from pkgutil import iter_modules from logging import getLogger +from typing import List from searx import logger, settings +class Plugin: # pylint: disable=too-few-public-methods + """This class is currently never initialized and only used for type hinting.""" + + id: str + name: str + description: str + default_on: bool + + logger = logger.getChild("plugins") required_attrs = ( @@ -175,7 +185,7 @@ def load_and_initialize_plugin(plugin_module_name, external, init_args): class PluginStore: def __init__(self): - self.plugins = [] + self.plugins: List[Plugin] = [] def __iter__(self): for plugin in self.plugins: |