From 1022228d950c2a809ed613df1a515d9a6cafda7c Mon Sep 17 00:00:00 2001 From: Dalf Date: Thu, 6 Aug 2020 17:42:46 +0200 Subject: Drop Python 2 (1/n): remove unicode string and url_utils --- searx/answerers/statistics/answerer.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'searx/answerers/statistics') diff --git a/searx/answerers/statistics/answerer.py b/searx/answerers/statistics/answerer.py index 73dd25cfd..cfd1b3e23 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', @@ -44,7 +41,7 @@ def answer(query): if answer is None: return [] - return [{'answer': unicode(answer)}] + return [{'answer': str(answer)}] # required answerer function -- cgit v1.2.3 From c225db45c8a4ab466bff049216f7e0189dc1b067 Mon Sep 17 00:00:00 2001 From: Dalf Date: Tue, 11 Aug 2020 16:25:03 +0200 Subject: Drop Python 2 (4/n): SearchQuery.query is a str instead of bytes --- searx/answerers/statistics/answerer.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'searx/answerers/statistics') diff --git a/searx/answerers/statistics/answerer.py b/searx/answerers/statistics/answerer.py index cfd1b3e23..abd4be7f5 100644 --- a/searx/answerers/statistics/answerer.py +++ b/searx/answerers/statistics/answerer.py @@ -27,15 +27,15 @@ 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: -- cgit v1.2.3