# SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint """Answer item in the result list. The answer result item is used in the :origin:`results.html ` template. A answer item is a dictionary type with dedicated keys and values. .. code:: python results.append({ 'answer' : str, 'url' : str, }) answer : ``str`` The answer string append by the engine. url : ``str`` A link that is related to the answer (e.g. the origin of the answer). """ def is_answer(result): """Returns ``True`` if result type is :py:obj:`.answer`, otherwise ``False`` In the result list a answer item is identified by the existence of the key ``answer``. """ return 'answer' in result class Answers(dict): """Dictionary of answers in the :py:obj:`.container.ResultContainer`""" def add(self, result): self[result['answer']] = result