activated pylint and fix messages from pylint::
searx/utils.py:44:0: R0903: Too few public methods (0/2) (too-few-public-methods)
searx/utils.py:58:0: C0103: Argument name "os" doesn't conform to '(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$' pattern (invalid-name)
searx/utils.py:151:4: R1705: Unnecessary "elif" after "return" (no-else-return)
searx/utils.py:263:0: C0103: Argument name "d" doesn't conform to '(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$' pattern (invalid-name)
searx/utils.py:322:4: R1705: Unnecessary "else" after "return" (no-else-return)
searx/utils.py:361:4: R1705: Unnecessary "else" after "return" (no-else-return)
searx/utils.py:378:12: C0103: Variable name "lc" doesn't conform to '(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*)|([a-z]))$' pattern (invalid-name)
searx/utils.py:452:0: R1710: Either all return statements in a function should return an expression, or none of them should. (inconsistent-return-statements)
searx/utils.py:464:0: C0103: Argument name "s" doesn't conform to '(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$' pattern (invalid-name)
searx/utils.py:489:4: C0103: Function name "f" doesn't conform to '(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$' pattern (invalid-name)
searx/utils.py:610:7: R1716: Simplify chained comparison between the operands (chained-comparison)
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
use
from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA
so it is possible to easily remove all unused import using autoflake:
autoflake --in-place --recursive --remove-all-unused-imports searx tests
Characters that were not ASCII were incorrectly decoded.
Add an helper function: searx.utils.ecma_unescape (Python implementation of unescape Javascript function).
Add match_language function in utils to match any user given
language code with a list of engine's supported languages.
Also add language_aliases dict on each engine to translate
standard language codes into the custom codes used by the engine.
The exact order is
* first from SEARX_SETTINGS_PATH,
* if not found then from searx code base,
* if not found then from /etc/searx/settings.yml
* if not found an exception stops searx loading