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

Public Member Functions

 info (self)
 
list[BaseAnsweranswer (self, str query)
 

Static Public Attributes

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

Detailed Description

Random value generator

Definition at line 51 of file random.py.

Member Function Documentation

◆ answer()

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

Reimplemented from searx.answerers._core.Answerer.

Definition at line 74 of file random.py.

74 def answer(self, query: str) -> list[BaseAnswer]:
75
76 parts = query.split()
77 if len(parts) != 2 or parts[1] not in self.random_types:
78 return []
79
80 return [Answer(answer=self.random_types[parts[1]]())]

◆ info()

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

Reimplemented from searx.answerers._core.Answerer.

Definition at line 65 of file random.py.

65 def info(self):
66
67 return AnswererInfo(
68 name=gettext(self.__doc__),
69 description=gettext("Generate different random values"),
70 keywords=self.keywords,
71 examples=[f"random {x}" for x in self.random_types],
72 )
73

Member Data Documentation

◆ random_types

dict searx.answerers.random.SXNGAnswerer.random_types
static
Initial value:
= {
"string": random_string,
"int": random_int,
"float": random_float,
"sha256": random_sha256,
"uuid": random_uuid,
"color": random_color,
}

Definition at line 56 of file random.py.


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