summaryrefslogtreecommitdiff
path: root/searx/search/processors/online_currency.py
diff options
context:
space:
mode:
Diffstat (limited to 'searx/search/processors/online_currency.py')
-rw-r--r--searx/search/processors/online_currency.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/searx/search/processors/online_currency.py b/searx/search/processors/online_currency.py
index 0dc3f3b6a..4f642fa72 100644
--- a/searx/search/processors/online_currency.py
+++ b/searx/search/processors/online_currency.py
@@ -1,4 +1,8 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
+# lint: pylint
+"""Processores for engine-type: ``online_currency``
+
+"""
import unicodedata
import re
@@ -6,32 +10,31 @@ import re
from searx.data import CURRENCIES
from .online import OnlineProcessor
-
parser_re = re.compile('.*?(\\d+(?:\\.\\d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)', re.I)
+# pylint: disable=missing-function-docstring
def normalize_name(name):
name = name.lower().replace('-', ' ').rstrip('s')
name = re.sub(' +', ' ', name)
return unicodedata.normalize('NFKD', name).lower()
-
def name_to_iso4217(name):
- global CURRENCIES
+ global CURRENCIES # pylint: disable=global-statement
name = normalize_name(name)
currency = CURRENCIES['names'].get(name, [name])
if isinstance(currency, str):
return currency
return currency[0]
-
def iso4217_to_name(iso4217, language):
- global CURRENCIES
+ global CURRENCIES # pylint: disable=global-statement
return CURRENCIES['iso4217'].get(iso4217, {}).get(language, iso4217)
-
class OnlineCurrencyProcessor(OnlineProcessor):
+ """Processor class used by ``online_currency`` engines."""
+
engine_type = 'online_currency'
def get_params(self, search_query, engine_category):