mirror of
https://github.com/searxng/searxng.git
synced 2025-12-22 19:50:00 +00:00
[mod] addition of various type hints / engine processors
Continuation of #5147 .. typification of the engine processors. BTW: - removed obsolete engine property https_support - fixed & improved currency_convert - engine instances can now implement a engine.setup method [#5147] https://github.com/searxng/searxng/pull/5147 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
committed by
Markus Heiser
parent
23257bddce
commit
8f8343dc0d
@@ -24,17 +24,6 @@ LogParametersType = tuple[str, ...]
|
||||
|
||||
class ErrorContext: # pylint: disable=missing-class-docstring
|
||||
|
||||
__slots__ = (
|
||||
'filename',
|
||||
'function',
|
||||
'line_no',
|
||||
'code',
|
||||
'exception_classname',
|
||||
'log_message',
|
||||
'log_parameters',
|
||||
'secondary',
|
||||
)
|
||||
|
||||
def __init__( # pylint: disable=too-many-arguments
|
||||
self,
|
||||
filename: str,
|
||||
@@ -159,7 +148,7 @@ def get_messages(exc, filename) -> tuple[str, ...]: # pylint: disable=too-many-
|
||||
return ()
|
||||
|
||||
|
||||
def get_exception_classname(exc: Exception) -> str:
|
||||
def get_exception_classname(exc: BaseException) -> str:
|
||||
exc_class = exc.__class__
|
||||
exc_name = exc_class.__qualname__
|
||||
exc_module = exc_class.__module__
|
||||
@@ -182,7 +171,7 @@ def get_error_context(
|
||||
return ErrorContext(filename, function, line_no, code, exception_classname, log_message, log_parameters, secondary)
|
||||
|
||||
|
||||
def count_exception(engine_name: str, exc: Exception, secondary: bool = False) -> None:
|
||||
def count_exception(engine_name: str, exc: BaseException, secondary: bool = False) -> None:
|
||||
if not settings['general']['enable_metrics']:
|
||||
return
|
||||
framerecords = inspect.trace()
|
||||
|
||||
Reference in New Issue
Block a user