From cd033b5416a86a89920f1240595b7a2e7a9a35a0 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 7 Sep 2021 10:26:15 +0200 Subject: [PATCH 1/2] [fix] drop useless pylint: disable=undefined-variable Since 7b235a1 (see line 591) it is no longer needed to disable 'undefined-variable' for names defined in:: PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914068609 Signed-off-by: Markus Heiser --- searx/engines/duckduckgo_definitions.py | 2 +- searx/engines/google.py | 1 - searx/engines/google_images.py | 1 - searx/engines/google_news.py | 1 - searx/engines/google_scholar.py | 1 - searx/engines/google_videos.py | 1 - searx/engines/peertube.py | 1 - searx/engines/qwant.py | 1 - 8 files changed, 1 insertion(+), 8 deletions(-) diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index e35b55f74..b9436f67f 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -64,7 +64,7 @@ def request(query, params): params['url'] = URL.format(query=urlencode({'q': query})) language = match_language( params['language'], - supported_languages, # pylint: disable=undefined-variable + supported_languages, language_aliases ) language = language.split('-')[0] diff --git a/searx/engines/google.py b/searx/engines/google.py index d1f564d99..0f79b70db 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -277,7 +277,6 @@ def request(query, params): offset = (params['pageno'] - 1) * 10 lang_info = get_lang_info( - # pylint: disable=undefined-variable params, supported_languages, language_aliases, True ) diff --git a/searx/engines/google_images.py b/searx/engines/google_images.py index bd13144b2..ffdd6675e 100644 --- a/searx/engines/google_images.py +++ b/searx/engines/google_images.py @@ -92,7 +92,6 @@ def request(query, params): """Google-Video search request""" lang_info = get_lang_info( - # pylint: disable=undefined-variable params, supported_languages, language_aliases, False ) logger.debug( diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 0dd0c7b94..bab8bc86a 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -75,7 +75,6 @@ def request(query, params): """Google-News search request""" lang_info = get_lang_info( - # pylint: disable=undefined-variable params, supported_languages, language_aliases, False ) logger.debug( diff --git a/searx/engines/google_scholar.py b/searx/engines/google_scholar.py index 5c7a0d9e9..95b7d7a03 100644 --- a/searx/engines/google_scholar.py +++ b/searx/engines/google_scholar.py @@ -73,7 +73,6 @@ def request(query, params): offset = (params['pageno'] - 1) * 10 lang_info = get_lang_info( - # pylint: disable=undefined-variable params, supported_languages, language_aliases, False ) logger.debug( diff --git a/searx/engines/google_videos.py b/searx/engines/google_videos.py index f75b9f5d5..b04ab5899 100644 --- a/searx/engines/google_videos.py +++ b/searx/engines/google_videos.py @@ -110,7 +110,6 @@ def request(query, params): """Google-Video search request""" lang_info = get_lang_info( - # pylint: disable=undefined-variable params, supported_languages, language_aliases, False ) logger.debug( diff --git a/searx/engines/peertube.py b/searx/engines/peertube.py index 058065c03..f9cd50be1 100644 --- a/searx/engines/peertube.py +++ b/searx/engines/peertube.py @@ -34,7 +34,6 @@ def request(query, params): search_url = sanitized_url + "/api/v1/search/videos/?pageno={pageno}&{query}" query_dict = {"search": query} language = params["language"].split("-")[0] - # pylint: disable=undefined-variable if "all" != language and language in supported_languages: query_dict["languageOneOf"] = language params["url"] = search_url.format( diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py index 8d03d8324..18e6a65d8 100644 --- a/searx/engines/qwant.py +++ b/searx/engines/qwant.py @@ -89,7 +89,6 @@ def request(query, params): else: language = match_language( params['language'], - # pylint: disable=undefined-variable supported_languages, language_aliases, ) From 82847df3001b1f8b7d78d36180c02479e45fb4e1 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 7 Sep 2021 10:29:38 +0200 Subject: [PATCH 2/2] [fix] add 'categories' to PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES androp no longer needed (see line 591 in 7b235a1):: # pylint: disable=undefined-variable Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914068609 Signed-off-by: Markus Heiser --- manage | 2 +- searx/engines/xpath.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/manage b/manage index 8b1975bde..bd89e7f2b 100755 --- a/manage +++ b/manage @@ -37,7 +37,7 @@ PYLINT_SEARX_DISABLE_OPTION="\ I,C,R,\ W0105,W0212,W0511,W0603,W0613,W0621,W0702,W0703,W1401,\ E1136" -PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES="supported_languages,language_aliases,logger" +PYLINT_ADDITIONAL_BUILTINS_FOR_ENGINES="supported_languages,language_aliases,logger,categories" PYLINT_OPTIONS="-m pylint -j 0 --rcfile .pylintrc" help() { diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 3a8d32a6a..a7a5e57ab 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -184,7 +184,7 @@ def response(resp): ''' results = [] dom = html.fromstring(resp.text) - is_onion = 'onions' in categories # pylint: disable=undefined-variable + is_onion = 'onions' in categories if results_xpath: for result in eval_xpath_list(dom, results_xpath):