.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.answerers._core.ModuleAnswerer Class Reference
+ Inheritance diagram for searx.answerers._core.ModuleAnswerer:
+ Collaboration diagram for searx.answerers._core.ModuleAnswerer:

Public Member Functions

 __init__ (self, mod)
 
list[BaseAnsweranswer (self, str query)
 
AnswererInfo info (self)
 

Public Attributes

 module = mod
 

Additional Inherited Members

- Static Public Attributes inherited from searx.answerers._core.Answerer
list keywords [str]
 

Detailed Description

A wrapper class for legacy *answerers* where the names (keywords, answer,
info) are implemented on the module level (not in a class).

.. note::

   For internal use only!

Definition at line 59 of file _core.py.

Constructor & Destructor Documentation

◆ __init__()

searx.answerers._core.ModuleAnswerer.__init__ ( self,
mod )

Definition at line 68 of file _core.py.

68 def __init__(self, mod):
69
70 for name in ["keywords", "self_info", "answer"]:
71 if not getattr(mod, name, None):
72 raise SystemExit(2)
73 if not isinstance(mod.keywords, tuple):
74 raise SystemExit(2)
75
76 self.module = mod
77 self.keywords = mod.keywords # type: ignore
78

Member Function Documentation

◆ answer()

list[BaseAnswer] searx.answerers._core.ModuleAnswerer.answer ( self,
str query )
Function that returns a list of answers to the question/query.

Reimplemented from searx.answerers._core.Answerer.

Definition at line 79 of file _core.py.

79 def answer(self, query: str) -> list[BaseAnswer]:
80 return self.module.answer(query)
81

References answer(), and module.

Referenced by answer().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ info()

AnswererInfo searx.answerers._core.ModuleAnswerer.info ( self)
Informations about the *answerer*, see :py:obj:`AnswererInfo`.

Reimplemented from searx.answerers._core.Answerer.

Definition at line 82 of file _core.py.

82 def info(self) -> AnswererInfo:
83 kwargs = self.module.self_info()
84 kwargs["keywords"] = self.keywords
85 return AnswererInfo(**kwargs)
86
87

References searx.answerers._core.Answerer.keywords, searx.answerers._core.AnswererInfo.keywords, and module.

Member Data Documentation

◆ module


The documentation for this class was generated from the following file: