Implement models for searx/answerers

sort froms

Import List from typing to support Python 3.8

Use SearchQuery model

Remove list for List

use Dict instead of dict

Use RawTextQuery instead of SearchQuery, type a dict, and remove unecessary str() method in webapp

improve docstring, remove test code

Implement a BaseQuery class and use that, improve answerer tests based on updated types

Add back sys

fix new linting issues

add space

Update answerer.py - use dict

use future annotations

use BaseQuery for RawTextQuery
This commit is contained in:
Grant Lanham 2024-03-09 18:22:35 -05:00
parent e2af3e4970
commit fed105b09e
9 changed files with 95 additions and 32 deletions

View file

@ -1,6 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
# pylint: disable=missing-module-docstring
from abc import ABC
import typing
import babel
@ -24,7 +25,13 @@ class EngineRef:
return hash((self.name, self.category))
class SearchQuery:
class BaseQuery(ABC): # pylint: disable=too-few-public-methods
"""Contains properties among all query classes"""
query: str
class SearchQuery(BaseQuery):
"""container for all the search parameters (query, language, etc...)"""
__slots__ = (