From d84226bf63757b1d4245ab26e9c081daf42389aa Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Mon, 27 Dec 2021 10:16:20 +0100 Subject: [PATCH] [fix] issues reported by pylint Fix pylint issues from commit (3d96a983) [format.python] initial formatting of the python code Signed-off-by: Markus Heiser --- searx/engines/bing_images.py | 16 ++++++++++++---- searx/engines/bing_videos.py | 19 ++++++++++++++----- searx/engines/doku.py | 11 ++++++++--- searx/engines/duckduckgo_definitions.py | 4 ++-- searx/engines/duckduckgo_images.py | 4 ++-- searx/engines/etools.py | 9 ++++++++- searx/engines/wikidata.py | 4 ++-- searx/engines/yahoo_news.py | 7 ++++++- tests/unit/test_webutils.py | 2 +- 9 files changed, 55 insertions(+), 21 deletions(-) diff --git a/searx/engines/bing_images.py b/searx/engines/bing_images.py index 246d37a30..73b61b896 100644 --- a/searx/engines/bing_images.py +++ b/searx/engines/bing_images.py @@ -6,13 +6,13 @@ from urllib.parse import urlencode from lxml import html from json import loads -from searx.utils import match_language +from searx.utils import match_language from searx.engines.bing import language_aliases -from searx.engines.bing import ( +from searx.engines.bing import ( # pylint: disable=unused-import _fetch_supported_languages, supported_languages_url, -) # NOQA # pylint: disable=unused-import +) # about about = { @@ -34,7 +34,15 @@ number_of_results = 28 # search-url base_url = 'https://www.bing.com/' -search_string = 'images/search' '?{query}' '&count={count}' '&first={first}' '&tsc=ImageHoverTitle' +search_string = ( + # fmt: off + 'images/search' + '?{query}' + '&count={count}' + '&first={first}' + '&tsc=ImageHoverTitle' + # fmt: on +) time_range_string = '&qft=+filterui:age-lt{interval}' time_range_dict = {'day': '1440', 'week': '10080', 'month': '43200', 'year': '525600'} diff --git a/searx/engines/bing_videos.py b/searx/engines/bing_videos.py index ad61724a1..7f8820546 100644 --- a/searx/engines/bing_videos.py +++ b/searx/engines/bing_videos.py @@ -6,15 +6,15 @@ from json import loads from lxml import html from urllib.parse import urlencode -from searx.utils import match_language +from searx.utils import match_language from searx.engines.bing import language_aliases -from searx.engines.bing import ( + +from searx.engines.bing import ( # pylint: disable=unused-import _fetch_supported_languages, supported_languages_url, -) # NOQA # pylint: disable=unused-import +) -# about about = { "website": 'https://www.bing.com/videos', "wikidata_id": 'Q4914152', @@ -31,7 +31,16 @@ time_range_support = True number_of_results = 28 base_url = 'https://www.bing.com/' -search_string = 'videos/search' '?{query}' '&count={count}' '&first={first}' '&scope=video' '&FORM=QBLH' +search_string = ( + # fmt: off + 'videos/search' + '?{query}' + '&count={count}' + '&first={first}' + '&scope=video' + '&FORM=QBLH' + # fmt: on +) time_range_string = '&qft=+filterui:videoage-lt{interval}' time_range_dict = {'day': '1440', 'week': '10080', 'month': '43200', 'year': '525600'} diff --git a/searx/engines/doku.py b/searx/engines/doku.py index e81131cce..08f56bbe7 100644 --- a/searx/engines/doku.py +++ b/searx/engines/doku.py @@ -25,9 +25,14 @@ number_of_results = 5 # search-url # Doku is OpenSearch compatible base_url = 'http://localhost:8090' -search_url = '/?do=search' '&{query}' -# TODO '&startRecord={offset}'\ -# TODO '&maximumRecords={limit}'\ +search_url = ( + # fmt: off + '/?do=search' + '&{query}' + # fmt: on +) +# TODO '&startRecord={offset}' +# TODO '&maximumRecords={limit}' # do search-request diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index d4e813c2b..ad3c92169 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -10,10 +10,10 @@ from lxml import html from searx.data import WIKIDATA_UNITS from searx.engines.duckduckgo import language_aliases -from searx.engines.duckduckgo import ( +from searx.engines.duckduckgo import ( # pylint: disable=unused-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 21e24d2c9..2f75e16f1 100644 --- a/searx/engines/duckduckgo_images.py +++ b/searx/engines/duckduckgo_images.py @@ -7,10 +7,10 @@ from json import loads from urllib.parse import urlencode from searx.exceptions import SearxEngineAPIException from searx.engines.duckduckgo import get_region_code -from searx.engines.duckduckgo import ( +from searx.engines.duckduckgo import ( # pylint: disable=unused-import _fetch_supported_languages, supported_languages_url, -) # NOQA # pylint: disable=unused-import +) from searx.network import get # about diff --git a/searx/engines/etools.py b/searx/engines/etools.py index c66ceeb4b..347463291 100644 --- a/searx/engines/etools.py +++ b/searx/engines/etools.py @@ -22,7 +22,14 @@ paging = False safesearch = True base_url = 'https://www.etools.ch' -search_path = '/searchAdvancedSubmit.do' '?query={search_term}' '&pageResults=20' '&safeSearch={safesearch}' +search_path = ( + # fmt: off + '/searchAdvancedSubmit.do' + '?query={search_term}' + '&pageResults=20' + '&safeSearch={safesearch}' + # fmt: on +) def request(query, params): diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py index c8881d299..e5d3f55c0 100644 --- a/searx/engines/wikidata.py +++ b/searx/engines/wikidata.py @@ -14,10 +14,10 @@ from searx.data import WIKIDATA_UNITS from searx.network import post, get from searx.utils import match_language, searx_useragent, get_string_replaces_function from searx.external_urls import get_external_url, get_earth_coordinates_url, area_to_osm_zoom -from searx.engines.wikipedia import ( +from searx.engines.wikipedia import ( # pylint: disable=unused-import _fetch_supported_languages, supported_languages_url, -) # NOQA # pylint: disable=unused-import +) # about about = { diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py index 06f090f74..00f208b17 100644 --- a/searx/engines/yahoo_news.py +++ b/searx/engines/yahoo_news.py @@ -39,7 +39,12 @@ paging = True categories = ['news'] # search-url -search_url = 'https://news.search.yahoo.com/search' '?{query}&b={offset}' +search_url = ( + # fmt: off + 'https://news.search.yahoo.com/search' + '?{query}&b={offset}' + # fmt: on +) AGO_RE = re.compile(r'([0-9]+)\s*(year|month|week|day|minute|hour)') AGO_TIMEDELTA = { diff --git a/tests/unit/test_webutils.py b/tests/unit/test_webutils.py index 8bb3a0447..2b7c6fe5a 100644 --- a/tests/unit/test_webutils.py +++ b/tests/unit/test_webutils.py @@ -22,7 +22,7 @@ class TestWebUtils(SearxTestCase): self.assertEqual(webutils.highlight_content('', None), None) self.assertEqual(webutils.highlight_content(False, None), None) - contents = ['' 'not<'] + contents = ['not<'] for content in contents: self.assertEqual(webutils.highlight_content(content, None), content)