2024-04-07 15:52:00 +02:00
|
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
2025-12-02 10:18:00 +00:00
|
|
|
# pylint: disable=missing-module-docstring
|
2024-04-07 15:52:00 +02:00
|
|
|
|
2025-12-02 10:18:00 +00:00
|
|
|
import typing as t
|
2024-12-15 09:59:50 +01:00
|
|
|
|
2025-12-02 10:18:00 +00:00
|
|
|
from flask_babel import gettext # pyright: ignore[reportUnknownVariableType]
|
2024-04-07 15:52:00 +02:00
|
|
|
|
2025-03-20 07:47:38 +01:00
|
|
|
from searx.plugins import Plugin, PluginInfo
|
2024-08-21 17:50:44 +02:00
|
|
|
|
2025-12-02 10:18:00 +00:00
|
|
|
if t.TYPE_CHECKING:
|
2025-03-20 07:47:38 +01:00
|
|
|
from searx.plugins import PluginCfg
|
2024-04-07 15:52:00 +02:00
|
|
|
|
2025-03-20 07:47:38 +01:00
|
|
|
|
2025-12-02 10:18:00 +00:00
|
|
|
@t.final
|
2025-03-20 07:47:38 +01:00
|
|
|
class SXNGPlugin(Plugin):
|
2025-12-02 10:18:00 +00:00
|
|
|
"""Parses and solves mathematical expressions."""
|
2025-03-20 07:47:38 +01:00
|
|
|
|
|
|
|
|
id = "calculator"
|
|
|
|
|
|
|
|
|
|
def __init__(self, plg_cfg: "PluginCfg") -> None:
|
|
|
|
|
super().__init__(plg_cfg)
|
|
|
|
|
|
|
|
|
|
self.info = PluginInfo(
|
|
|
|
|
id=self.id,
|
2025-12-02 10:18:00 +00:00
|
|
|
name=gettext("Calculator"),
|
|
|
|
|
description=gettext("Parses and solves mathematical expressions."),
|
|
|
|
|
preference_section="query",
|
2025-03-20 07:47:38 +01:00
|
|
|
)
|