diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-04-27 15:13:39 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-04-27 15:13:39 +0200 |
commit | 924f9afea37b6c545a03505a7ec291cf44654ca7 (patch) | |
tree | e6dde4db9f29e6ffad19827569abc89db79e4544 /searx/search/processors/online_currency.py | |
parent | b1557b544368b416c158c13f12946859abbe00e0 (diff) | |
download | searxng-924f9afea37b6c545a03505a7ec291cf44654ca7.tar.gz searxng-924f9afea37b6c545a03505a7ec291cf44654ca7.zip |
[lint] pylint searx/search/processors files / BTW add some doc-strings
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/search/processors/online_currency.py')
-rw-r--r-- | searx/search/processors/online_currency.py | 15 |
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): |