mirror of
https://github.com/searxng/searxng.git
synced 2025-07-13 16:29:17 +02:00
[refactor] add type hints & remove Setting._post_init
Previously the Setting classes used a horrible _post_init hack that prevented proper type checking.
This commit is contained in:
parent
93c6829b27
commit
bb06758a7b
4 changed files with 133 additions and 139 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue