.oO SearXNG Developer Documentation Oo.
Loading...
Searching...
No Matches
searx.result_types.answer.Translations Class Reference
+ Inheritance diagram for searx.result_types.answer.Translations:
+ Collaboration diagram for searx.result_types.answer.Translations:

Classes

class  Item
 

Public Member Functions

 __post_init__ (self)
 
- Public Member Functions inherited from searx.result_types._base.Result
 normalize_result_fields (self)
 
 __post_init__ (self)
 
int __hash__ (self)
 
 __eq__ (self, other)
 
 __setitem__ (self, field_name, value)
 
 __getitem__ (self, field_name)
 
 __iter__ (self)
 
 as_dict (self)
 

Static Public Attributes

list translations [Translations.Item]
 
- Static Public Attributes inherited from searx.result_types._base.Result
str url = None
 
str template = "default.html"
 
str engine = ""
 
urllib parsed_url = None
 

Detailed Description

Answer type with a list of translations.

The items in the list of :py:obj:`Translations.translations` are of type
:py:obj:`Translations.Item`:

.. code:: python

   def response(resp):
       results = []
       ...
       foo_1 = Translations.Item(
           text="foobar",
           synonyms=["bar", "foo"],
           examples=["foo and bar are placeholders"],
       )
       foo_url="https://www.deepl.com/de/translator#en/de/foo"
       ...
       Translations(results=results, translations=[foo], url=foo_url)

Definition at line 90 of file answer.py.

Member Function Documentation

◆ __post_init__()

searx.result_types.answer.Translations.__post_init__ ( self)

Definition at line 119 of file answer.py.

119 def __post_init__(self):
120 if not self.translations:
121 raise ValueError("Translation does not have an item in the list translations")
122

References translations.

Member Data Documentation

◆ translations

list searx.result_types.answer.Translations.translations [Translations.Item]
static

Definition at line 116 of file answer.py.

Referenced by __post_init__().


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