summaryrefslogtreecommitdiff
path: root/searx/engines
diff options
context:
space:
mode:
authorAlexandre Flament <alex@al-f.net>2020-11-16 09:43:23 +0100
committerAlexandre Flament <alex@al-f.net>2020-12-01 15:21:19 +0100
commitb00d108673082fc2487b2d122db00d988f561427 (patch)
tree51b5324935f24864730d705efd9f4f6a9dea465f /searx/engines
parent9ed3ee2bebf2f159d4231d9aad9df53aea6db90a (diff)
downloadsearxng-b00d108673082fc2487b2d122db00d988f561427.tar.gz
searxng-b00d108673082fc2487b2d122db00d988f561427.zip
[mod] pylint: numerous minor code fixes
Diffstat (limited to 'searx/engines')
-rw-r--r--searx/engines/acgsou.py1
-rw-r--r--searx/engines/arxiv.py2
-rwxr-xr-xsearx/engines/base.py5
-rw-r--r--searx/engines/bing_images.py2
-rw-r--r--searx/engines/bing_news.py2
-rw-r--r--searx/engines/bing_videos.py2
-rw-r--r--searx/engines/currency_convert.py2
-rw-r--r--searx/engines/duckduckgo.py4
-rw-r--r--searx/engines/duckduckgo_definitions.py2
-rw-r--r--searx/engines/duckduckgo_images.py2
-rw-r--r--searx/engines/filecrop.py2
-rw-r--r--searx/engines/google_images.py5
-rw-r--r--searx/engines/google_news.py2
-rw-r--r--searx/engines/peertube.py1
-rw-r--r--searx/engines/pubmed.py2
-rw-r--r--searx/engines/yahoo_news.py2
16 files changed, 14 insertions, 24 deletions
diff --git a/searx/engines/acgsou.py b/searx/engines/acgsou.py
index 553b49b69..a436df283 100644
--- a/searx/engines/acgsou.py
+++ b/searx/engines/acgsou.py
@@ -41,7 +41,6 @@ def response(resp):
# defaults
filesize = 0
magnet_link = "magnet:?xt=urn:btih:{}&tr=http://tracker.acgsou.com:2710/announce"
- torrent_link = ""
try:
category = extract_text(result.xpath(xpath_category)[0])
diff --git a/searx/engines/arxiv.py b/searx/engines/arxiv.py
index e54de4a58..6e231c382 100644
--- a/searx/engines/arxiv.py
+++ b/searx/engines/arxiv.py
@@ -61,7 +61,7 @@ def response(resp):
content = content_string.format(doi_content="", abstract_content=abstract)
if len(content) > 300:
- content = content[0:300] + "..."
+ content = content[0:300] + "..."
# TODO: center snippet on query term
publishedDate = datetime.strptime(entry.xpath('.//published')[0].text, '%Y-%m-%dT%H:%M:%SZ')
diff --git a/searx/engines/base.py b/searx/engines/base.py
index 0114f9798..3648d7ed0 100755
--- a/searx/engines/base.py
+++ b/searx/engines/base.py
@@ -80,10 +80,7 @@ def response(resp):
date = datetime.now() # needed in case no dcdate is available for an item
for item in entry:
- if item.attrib["name"] == "dchdate":
- harvestDate = item.text
-
- elif item.attrib["name"] == "dcdate":
+ if item.attrib["name"] == "dcdate":
date = item.text
elif item.attrib["name"] == "dctitle":
diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py
index 3085e1deb..2bcf82b84 100644
--- a/searx/engines/bing_images.py
+++ b/searx/engines/bing_images.py
@@ -18,7 +18,7 @@ from json import loads
from searx.utils import match_language
from searx.engines.bing import language_aliases
-from searx.engines.bing import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.bing import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
# engine dependent config
categories = ['images']
diff --git a/searx/engines/bing_news.py b/searx/engines/bing_news.py
index aeef7d19a..5489c7549 100644
--- a/searx/engines/bing_news.py
+++ b/searx/engines/bing_news.py
@@ -17,7 +17,7 @@ from urllib.parse import urlencode, urlparse, parse_qsl
from lxml import etree
from searx.utils import list_get, match_language
from searx.engines.bing import language_aliases
-from searx.engines.bing import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.bing import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
# engine dependent config
categories = ['news']
diff --git a/searx/engines/bing_videos.py b/searx/engines/bing_videos.py
index 4393ea590..143c71a3e 100644
--- a/searx/engines/bing_videos.py
+++ b/searx/engines/bing_videos.py
@@ -16,7 +16,7 @@ from urllib.parse import urlencode
from searx.utils import match_language
from searx.engines.bing import language_aliases
-from searx.engines.bing import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.bing import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
categories = ['videos']
paging = True
diff --git a/searx/engines/currency_convert.py b/searx/engines/currency_convert.py
index 0e91d31e9..f41c135b9 100644
--- a/searx/engines/currency_convert.py
+++ b/searx/engines/currency_convert.py
@@ -41,8 +41,6 @@ def request(query, params):
from_currency = name_to_iso4217(from_currency.strip())
to_currency = name_to_iso4217(to_currency.strip())
- q = (from_currency + to_currency).upper()
-
params['url'] = url.format(from_currency, to_currency)
params['amount'] = amount
params['from'] = from_currency
diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py
index 21cd926aa..c1c984623 100644
--- a/searx/engines/duckduckgo.py
+++ b/searx/engines/duckduckgo.py
@@ -49,11 +49,11 @@ correction_xpath = '//div[@id="did_you_mean"]//a'
# match query's language to a region code that duckduckgo will accept
-def get_region_code(lang, lang_list=[]):
+def get_region_code(lang, lang_list=None):
if lang == 'all':
return None
- lang_code = match_language(lang, lang_list, language_aliases, 'wt-WT')
+ lang_code = match_language(lang, lang_list or [], language_aliases, 'wt-WT')
lang_parts = lang_code.split('-')
# country code goes first
diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py
index 5758022d2..5a7649173 100644
--- a/searx/engines/duckduckgo_definitions.py
+++ b/searx/engines/duckduckgo_definitions.py
@@ -16,7 +16,7 @@ from lxml import html
from searx import logger
from searx.data import WIKIDATA_UNITS
from searx.engines.duckduckgo import language_aliases
-from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
from searx.utils import extract_text, html_to_text, match_language, get_string_replaces_function
from searx.external_urls import get_external_url, get_earth_coordinates_url, area_to_osm_zoom
diff --git a/searx/engines/duckduckgo_images.py b/searx/engines/duckduckgo_images.py
index 943b74880..438a8d54c 100644
--- a/searx/engines/duckduckgo_images.py
+++ b/searx/engines/duckduckgo_images.py
@@ -16,7 +16,7 @@
from json import loads
from urllib.parse import urlencode
from searx.engines.duckduckgo import get_region_code
-from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.duckduckgo import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
from searx.poolrequests import get
# engine dependent config
diff --git a/searx/engines/filecrop.py b/searx/engines/filecrop.py
index eef5be6e8..0331e7b19 100644
--- a/searx/engines/filecrop.py
+++ b/searx/engines/filecrop.py
@@ -8,7 +8,7 @@ search_url = url + '/search.php?{query}&size_i=0&size_f=100000000&engine_r=1&eng
paging = True
-class FilecropResultParser(HTMLParser):
+class FilecropResultParser(HTMLParser): # pylint: disable=W0223 # (see https://bugs.python.org/issue31844)
def __init__(self):
HTMLParser.__init__(self)
diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py
index 9669d81c3..a3daf6070 100644
--- a/searx/engines/google_images.py
+++ b/searx/engines/google_images.py
@@ -29,10 +29,7 @@ from lxml import html
from flask_babel import gettext
from searx import logger
from searx.utils import extract_text, eval_xpath
-from searx.engines.google import _fetch_supported_languages, supported_languages_url # NOQA
-
-# pylint: disable=unused-import
-# pylint: enable=unused-import
+from searx.engines.google import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
from searx.engines.google import (
get_lang_country,
diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py
index 6cfc0c8e7..f1b7cfa79 100644
--- a/searx/engines/google_news.py
+++ b/searx/engines/google_news.py
@@ -13,7 +13,7 @@
from urllib.parse import urlencode
from lxml import html
from searx.utils import match_language
-from searx.engines.google import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.google import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
# search-url
categories = ['news']
diff --git a/searx/engines/peertube.py b/searx/engines/peertube.py
index 58ff38c02..e43b2a6b7 100644
--- a/searx/engines/peertube.py
+++ b/searx/engines/peertube.py
@@ -90,6 +90,5 @@ def response(resp):
def _fetch_supported_languages(resp):
- ret_val = {}
peertube_languages = list(loads(resp.text).keys())
return peertube_languages
diff --git a/searx/engines/pubmed.py b/searx/engines/pubmed.py
index 7eb2e92f9..07c45709e 100644
--- a/searx/engines/pubmed.py
+++ b/searx/engines/pubmed.py
@@ -81,7 +81,7 @@ def response(resp):
pass
if len(content) > 300:
- content = content[0:300] + "..."
+ content = content[0:300] + "..."
# TODO: center snippet on query term
res_dict = {'url': url,
diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py
index 11941cfe1..793d1104a 100644
--- a/searx/engines/yahoo_news.py
+++ b/searx/engines/yahoo_news.py
@@ -14,7 +14,7 @@ from datetime import datetime, timedelta
from urllib.parse import urlencode
from lxml import html
from searx.engines.yahoo import parse_url, language_aliases
-from searx.engines.yahoo import _fetch_supported_languages, supported_languages_url # NOQA
+from searx.engines.yahoo import _fetch_supported_languages, supported_languages_url # NOQA # pylint: disable=unused-import
from dateutil import parser
from searx.utils import extract_text, extract_url, match_language