diff options
| author | Noémi Ványi <kvch@users.noreply.github.com> | 2020-09-12 14:51:35 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-09-12 14:51:35 +0200 |
| commit | 2370234d0978f59dd62efa4a4931e41ad31444d1 (patch) | |
| tree | d3863e22b3d34092484146ce0bdc6e0ca8d36216 /searx/answerers/statistics | |
| parent | 272158944bf13503e2597018fc60a00baddec660 (diff) | |
| parent | bdac99d4f0349a71d7ecb9a4c61687356afedd6b (diff) | |
Merge pull request #2137 from dalf/drop-python-2
Drop Python 2
Diffstat (limited to 'searx/answerers/statistics')
| -rw-r--r-- | searx/answerers/statistics/answerer.py | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/searx/answerers/statistics/answerer.py b/searx/answerers/statistics/answerer.py index 73dd25cfd..abd4be7f5 100644 --- a/searx/answerers/statistics/answerer.py +++ b/searx/answerers/statistics/answerer.py @@ -1,11 +1,8 @@ -from sys import version_info from functools import reduce from operator import mul from flask_babel import gettext -if version_info[0] == 3: - unicode = str keywords = ('min', 'max', @@ -30,21 +27,21 @@ def answer(query): func = parts[0] answer = None - if func == b'min': + if func == 'min': answer = min(args) - elif func == b'max': + elif func == 'max': answer = max(args) - elif func == b'avg': + elif func == 'avg': answer = sum(args) / len(args) - elif func == b'sum': + elif func == 'sum': answer = sum(args) - elif func == b'prod': + elif func == 'prod': answer = reduce(mul, args, 1) if answer is None: return [] - return [{'answer': unicode(answer)}] + return [{'answer': str(answer)}] # required answerer function |