Loading Makefile +0 −5 Original line number Diff line number Diff line Loading @@ -213,10 +213,6 @@ gecko.driver: PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot ifeq ($(PY),2) test.pylint: @echo "LINT skip liniting py2" else # TODO: balance linting with pylint test.pylint: pyenvinstall Loading @@ -225,7 +221,6 @@ test.pylint: pyenvinstall searx/testing.py \ searx/engines/gigablast.py \ ) endif # ignored rules: # E402 module level import not at top of file Loading manage.sh +2 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ install_geckodriver() { return fi GECKODRIVER_VERSION="v0.24.0" PLATFORM="`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`" PLATFORM="`python3 -c "import platform; print(platform.system().lower(), platform.architecture()[0])"`" case "$PLATFORM" in "linux 32bit" | "linux2 32bit") ARCH="linux32";; "linux 64bit" | "linux2 64bit") ARCH="linux64";; Loading Loading @@ -136,7 +136,7 @@ docker_build() { # Check consistency between the git tag and the searx/version.py file # /!\ HACK : parse Python file with bash /!\ # otherwise it is not possible build the docker image without all Python dependencies ( version.py loads __init__.py ) # SEARX_PYTHON_VERSION=$(python -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)") # SEARX_PYTHON_VERSION=$(python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)") SEARX_PYTHON_VERSION=$(cat searx/version.py | grep "\(VERSION_MAJOR\|VERSION_MINOR\|VERSION_BUILD\) =" | cut -d\= -f2 | sed -e 's/^[[:space:]]*//' | paste -sd "." -) if [ $(echo "$SEARX_GIT_VERSION" | cut -d- -f1) != "$SEARX_PYTHON_VERSION" ]; then echo "Inconsistency between the last git tag and the searx/version.py file" Loading searx/__init__.py +2 −6 Original line number Diff line number Diff line Loading @@ -21,12 +21,8 @@ from os import environ from os.path import realpath, dirname, join, abspath, isfile from io import open from ssl import OPENSSL_VERSION_INFO, OPENSSL_VERSION try: from yaml import safe_load except: from sys import exit, stderr stderr.write('[E] install pyyaml\n') exit(2) searx_dir = abspath(dirname(__file__)) engine_dir = dirname(realpath(__file__)) Loading searx/answerers/__init__.py +2 −6 Original line number Diff line number Diff line from os import listdir from os.path import realpath, dirname, join, isdir from sys import version_info from searx.utils import load_module from collections import defaultdict if version_info[0] == 3: unicode = str answerers_dir = dirname(realpath(__file__)) Loading Loading @@ -36,10 +32,10 @@ def ask(query): results = [] query_parts = list(filter(None, query.query.split())) if query_parts[0].decode('utf-8') not in answerers_by_keywords: if query_parts[0].decode() not in answerers_by_keywords: return results for answerer in answerers_by_keywords[query_parts[0].decode('utf-8')]: for answerer in answerers_by_keywords[query_parts[0].decode()]: result = answerer(query) if result: results.append(result) Loading searx/answerers/random/answerer.py +7 −13 Original line number Diff line number Diff line import hashlib import random import string import sys import uuid from flask_babel import gettext Loading @@ -10,11 +9,6 @@ from flask_babel import gettext keywords = ('random',) random_int_max = 2**31 if sys.version_info[0] == 2: random_string_letters = string.lowercase + string.digits + string.uppercase else: unicode = str random_string_letters = string.ascii_lowercase + string.digits + string.ascii_uppercase Loading @@ -24,25 +18,25 @@ def random_characters(): def random_string(): return u''.join(random_characters()) return ''.join(random_characters()) def random_float(): return unicode(random.random()) return str(random.random()) def random_int(): return unicode(random.randint(-random_int_max, random_int_max)) return str(random.randint(-random_int_max, random_int_max)) def random_sha256(): m = hashlib.sha256() m.update(''.join(random_characters()).encode()) return unicode(m.hexdigest()) return str(m.hexdigest()) def random_uuid(): return unicode(uuid.uuid4()) return str(uuid.uuid4()) random_types = {b'string': random_string, Loading Loading @@ -70,4 +64,4 @@ def answer(query): def self_info(): return {'name': gettext('Random value generator'), 'description': gettext('Generate different random values'), 'examples': [u'random {}'.format(x.decode('utf-8')) for x in random_types]} 'examples': ['random {}'.format(x.decode()) for x in random_types]} Loading
Makefile +0 −5 Original line number Diff line number Diff line Loading @@ -213,10 +213,6 @@ gecko.driver: PHONY += test test.sh test.pylint test.pep8 test.unit test.coverage test.robot test: buildenv test.pylint test.pep8 test.unit gecko.driver test.robot ifeq ($(PY),2) test.pylint: @echo "LINT skip liniting py2" else # TODO: balance linting with pylint test.pylint: pyenvinstall Loading @@ -225,7 +221,6 @@ test.pylint: pyenvinstall searx/testing.py \ searx/engines/gigablast.py \ ) endif # ignored rules: # E402 module level import not at top of file Loading
manage.sh +2 −2 Original line number Diff line number Diff line Loading @@ -39,7 +39,7 @@ install_geckodriver() { return fi GECKODRIVER_VERSION="v0.24.0" PLATFORM="`python -c "import six; import platform; six.print_(platform.system().lower(), platform.architecture()[0])"`" PLATFORM="`python3 -c "import platform; print(platform.system().lower(), platform.architecture()[0])"`" case "$PLATFORM" in "linux 32bit" | "linux2 32bit") ARCH="linux32";; "linux 64bit" | "linux2 64bit") ARCH="linux64";; Loading Loading @@ -136,7 +136,7 @@ docker_build() { # Check consistency between the git tag and the searx/version.py file # /!\ HACK : parse Python file with bash /!\ # otherwise it is not possible build the docker image without all Python dependencies ( version.py loads __init__.py ) # SEARX_PYTHON_VERSION=$(python -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)") # SEARX_PYTHON_VERSION=$(python3 -c "import six; import searx.version; six.print_(searx.version.VERSION_STRING)") SEARX_PYTHON_VERSION=$(cat searx/version.py | grep "\(VERSION_MAJOR\|VERSION_MINOR\|VERSION_BUILD\) =" | cut -d\= -f2 | sed -e 's/^[[:space:]]*//' | paste -sd "." -) if [ $(echo "$SEARX_GIT_VERSION" | cut -d- -f1) != "$SEARX_PYTHON_VERSION" ]; then echo "Inconsistency between the last git tag and the searx/version.py file" Loading
searx/__init__.py +2 −6 Original line number Diff line number Diff line Loading @@ -21,12 +21,8 @@ from os import environ from os.path import realpath, dirname, join, abspath, isfile from io import open from ssl import OPENSSL_VERSION_INFO, OPENSSL_VERSION try: from yaml import safe_load except: from sys import exit, stderr stderr.write('[E] install pyyaml\n') exit(2) searx_dir = abspath(dirname(__file__)) engine_dir = dirname(realpath(__file__)) Loading
searx/answerers/__init__.py +2 −6 Original line number Diff line number Diff line from os import listdir from os.path import realpath, dirname, join, isdir from sys import version_info from searx.utils import load_module from collections import defaultdict if version_info[0] == 3: unicode = str answerers_dir = dirname(realpath(__file__)) Loading Loading @@ -36,10 +32,10 @@ def ask(query): results = [] query_parts = list(filter(None, query.query.split())) if query_parts[0].decode('utf-8') not in answerers_by_keywords: if query_parts[0].decode() not in answerers_by_keywords: return results for answerer in answerers_by_keywords[query_parts[0].decode('utf-8')]: for answerer in answerers_by_keywords[query_parts[0].decode()]: result = answerer(query) if result: results.append(result) Loading
searx/answerers/random/answerer.py +7 −13 Original line number Diff line number Diff line import hashlib import random import string import sys import uuid from flask_babel import gettext Loading @@ -10,11 +9,6 @@ from flask_babel import gettext keywords = ('random',) random_int_max = 2**31 if sys.version_info[0] == 2: random_string_letters = string.lowercase + string.digits + string.uppercase else: unicode = str random_string_letters = string.ascii_lowercase + string.digits + string.ascii_uppercase Loading @@ -24,25 +18,25 @@ def random_characters(): def random_string(): return u''.join(random_characters()) return ''.join(random_characters()) def random_float(): return unicode(random.random()) return str(random.random()) def random_int(): return unicode(random.randint(-random_int_max, random_int_max)) return str(random.randint(-random_int_max, random_int_max)) def random_sha256(): m = hashlib.sha256() m.update(''.join(random_characters()).encode()) return unicode(m.hexdigest()) return str(m.hexdigest()) def random_uuid(): return unicode(uuid.uuid4()) return str(uuid.uuid4()) random_types = {b'string': random_string, Loading Loading @@ -70,4 +64,4 @@ def answer(query): def self_info(): return {'name': gettext('Random value generator'), 'description': gettext('Generate different random values'), 'examples': [u'random {}'.format(x.decode('utf-8')) for x in random_types]} 'examples': ['random {}'.format(x.decode()) for x in random_types]}