From 5c867543404fbec01ad3290bed1cdbadf6e4c78b Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 7 Sep 2021 13:25:26 +0200 Subject: [PATCH 1/3] [pylint] .pylintrc - disable missing-function-docstring Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914168470 Signed-off-by: Markus Heiser --- .pylintrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.pylintrc b/.pylintrc index eb6d500b3..141715258 100644 --- a/.pylintrc +++ b/.pylintrc @@ -59,7 +59,9 @@ confidence= # --enable=similarities". If you want to run only the classes checker, but have # no Warning level messages displayed, use"--disable=all --enable=classes # --disable=W" -disable=bad-whitespace, duplicate-code +disable=bad-whitespace, + duplicate-code, + missing-function-docstring, # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option From f0059b80edd892cea2ed42c8fe350e9377956c9d Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 7 Sep 2021 13:26:59 +0200 Subject: [PATCH 2/3] [pylint] engines: drop no longer needed 'missing-function-docstring' Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914168470 Signed-off-by: Markus Heiser --- searx/engines/__init__.py | 1 - searx/engines/apkmirror.py | 2 +- searx/engines/artic.py | 2 -- searx/engines/core.py | 1 - searx/engines/deviantart.py | 1 - searx/engines/digg.py | 1 - searx/engines/docker_hub.py | 1 - searx/engines/duckduckgo_definitions.py | 1 - searx/engines/genius.py | 2 +- searx/engines/gigablast.py | 2 +- searx/engines/google.py | 2 -- searx/engines/google_news.py | 2 +- searx/engines/google_scholar.py | 2 +- searx/engines/google_videos.py | 2 +- searx/engines/mediathekviewweb.py | 2 -- searx/engines/meilisearch.py | 2 +- searx/engines/mongodb.py | 1 - searx/engines/mysql_server.py | 1 - searx/engines/openstreetmap.py | 1 - searx/engines/postgresql.py | 1 - searx/engines/redis_server.py | 1 - searx/engines/solidtorrents.py | 2 -- searx/engines/solr.py | 2 +- searx/engines/springer.py | 2 -- searx/engines/sqlite.py | 1 - searx/engines/unsplash.py | 1 - searx/engines/xpath.py | 1 - searx/engines/yahoo_news.py | 2 +- 28 files changed, 9 insertions(+), 33 deletions(-) diff --git a/searx/engines/__init__.py b/searx/engines/__init__.py index 1ac675c4c..154cd605f 100644 --- a/searx/engines/__init__.py +++ b/searx/engines/__init__.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """This module implements the engine loader. Load and initialize the ``engines``, see :py:func:`load_engines` and register diff --git a/searx/engines/apkmirror.py b/searx/engines/apkmirror.py index 36e838227..746a8cd9c 100644 --- a/searx/engines/apkmirror.py +++ b/searx/engines/apkmirror.py @@ -3,7 +3,7 @@ """APKMirror """ -# pylint: disable=invalid-name, missing-function-docstring +# pylint: disable=invalid-name from urllib.parse import urlencode from lxml import html diff --git a/searx/engines/artic.py b/searx/engines/artic.py index 85d355ed3..104ab8839 100644 --- a/searx/engines/artic.py +++ b/searx/engines/artic.py @@ -8,8 +8,6 @@ Explore thousands of artworks from The Art Institute of Chicago. """ -# pylint: disable=missing-function-docstring - from json import loads from urllib.parse import urlencode diff --git a/searx/engines/core.py b/searx/engines/core.py index 5e87400bd..e83c8bbe9 100644 --- a/searx/engines/core.py +++ b/searx/engines/core.py @@ -3,7 +3,6 @@ """CORE (science) """ -# pylint: disable=missing-function-docstring from json import loads from datetime import datetime diff --git a/searx/engines/deviantart.py b/searx/engines/deviantart.py index 21d56831c..b13d54dd5 100644 --- a/searx/engines/deviantart.py +++ b/searx/engines/deviantart.py @@ -3,7 +3,6 @@ """ Deviantart (Images) """ -# pylint: disable=missing-function-docstring from urllib.parse import urlencode from lxml import html diff --git a/searx/engines/digg.py b/searx/engines/digg.py index 5c6fb3875..e12cc43c8 100644 --- a/searx/engines/digg.py +++ b/searx/engines/digg.py @@ -3,7 +3,6 @@ """ Digg (News, Social media) """ -# pylint: disable=missing-function-docstring from json import loads from urllib.parse import urlencode diff --git a/searx/engines/docker_hub.py b/searx/engines/docker_hub.py index d9d0f745b..e69f677b3 100644 --- a/searx/engines/docker_hub.py +++ b/searx/engines/docker_hub.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """Docker Hub (IT) """ diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index b9436f67f..3ef043964 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """DuckDuckGo (Instant Answer API) """ diff --git a/searx/engines/genius.py b/searx/engines/genius.py index 49fda0053..b0fcb09a8 100644 --- a/searx/engines/genius.py +++ b/searx/engines/genius.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=invalid-name, missing-function-docstring +# pylint: disable=invalid-name """Genius """ diff --git a/searx/engines/gigablast.py b/searx/engines/gigablast.py index 376467d9b..c2c51afe8 100644 --- a/searx/engines/gigablast.py +++ b/searx/engines/gigablast.py @@ -3,7 +3,7 @@ """ Gigablast (Web) """ -# pylint: disable=missing-function-docstring, invalid-name +# pylint: disable=invalid-name import re from json import loads diff --git a/searx/engines/google.py b/searx/engines/google.py index 0f79b70db..4e6fa6190 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -25,8 +25,6 @@ The google WEB engine itself has a special setup option: """ -# pylint: disable=invalid-name, missing-function-docstring - from urllib.parse import urlencode from lxml import html from searx.utils import match_language, extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index bab8bc86a..87ac9a19d 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -11,7 +11,7 @@ ignores some parameters from the common :ref:`google API`: """ -# pylint: disable=invalid-name, missing-function-docstring +# pylint: disable=invalid-name import binascii from datetime import datetime diff --git a/searx/engines/google_scholar.py b/searx/engines/google_scholar.py index 95b7d7a03..e6726463d 100644 --- a/searx/engines/google_scholar.py +++ b/searx/engines/google_scholar.py @@ -9,7 +9,7 @@ Definitions`_. https://developers.google.com/custom-search/docs/xml_results#WebSearch_Query_Parameter_Definitions """ -# pylint: disable=invalid-name, missing-function-docstring +# pylint: disable=invalid-name from urllib.parse import urlencode from datetime import datetime diff --git a/searx/engines/google_videos.py b/searx/engines/google_videos.py index b04ab5899..9403ef4f7 100644 --- a/searx/engines/google_videos.py +++ b/searx/engines/google_videos.py @@ -14,7 +14,7 @@ """ -# pylint: disable=invalid-name, missing-function-docstring +# pylint: disable=invalid-name import re from urllib.parse import urlencode diff --git a/searx/engines/mediathekviewweb.py b/searx/engines/mediathekviewweb.py index 80104ae73..bd7c16a5d 100644 --- a/searx/engines/mediathekviewweb.py +++ b/searx/engines/mediathekviewweb.py @@ -4,8 +4,6 @@ """ -# pylint: disable=missing-function-docstring - import datetime from json import loads, dumps diff --git a/searx/engines/meilisearch.py b/searx/engines/meilisearch.py index d0d304e2a..c41d23eb4 100644 --- a/searx/engines/meilisearch.py +++ b/searx/engines/meilisearch.py @@ -4,7 +4,7 @@ Meilisearch """ -# pylint: disable=global-statement, missing-function-docstring +# pylint: disable=global-statement from json import loads, dumps diff --git a/searx/engines/mongodb.py b/searx/engines/mongodb.py index 1f24c5acf..2ebb90539 100644 --- a/searx/engines/mongodb.py +++ b/searx/engines/mongodb.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """MongoDB engine (Offline) """ diff --git a/searx/engines/mysql_server.py b/searx/engines/mysql_server.py index 42b436f5e..be89eb86e 100644 --- a/searx/engines/mysql_server.py +++ b/searx/engines/mysql_server.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """MySQL database (offline) """ diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py index 721769a25..78c15320a 100644 --- a/searx/engines/openstreetmap.py +++ b/searx/engines/openstreetmap.py @@ -3,7 +3,6 @@ """OpenStreetMap (Map) """ -# pylint: disable=missing-function-docstring import re from json import loads diff --git a/searx/engines/postgresql.py b/searx/engines/postgresql.py index eb4e9b0b4..1eddcd519 100644 --- a/searx/engines/postgresql.py +++ b/searx/engines/postgresql.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """PostgreSQL database (offline) """ diff --git a/searx/engines/redis_server.py b/searx/engines/redis_server.py index e8c248e32..a48f0775b 100644 --- a/searx/engines/redis_server.py +++ b/searx/engines/redis_server.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """Redis engine (offline) """ diff --git a/searx/engines/solidtorrents.py b/searx/engines/solidtorrents.py index 57bf675cd..7fbef9190 100644 --- a/searx/engines/solidtorrents.py +++ b/searx/engines/solidtorrents.py @@ -4,8 +4,6 @@ """ -# pylint: disable=missing-function-docstring - from json import loads from urllib.parse import urlencode diff --git a/searx/engines/solr.py b/searx/engines/solr.py index e38a103a9..e26f19442 100644 --- a/searx/engines/solr.py +++ b/searx/engines/solr.py @@ -4,7 +4,7 @@ Solr """ -# pylint: disable=global-statement, missing-function-docstring +# pylint: disable=global-statement from json import loads from urllib.parse import urlencode diff --git a/searx/engines/springer.py b/searx/engines/springer.py index 4288d0b4c..246e59b44 100644 --- a/searx/engines/springer.py +++ b/searx/engines/springer.py @@ -4,8 +4,6 @@ """ -# pylint: disable=missing-function-docstring - from datetime import datetime from json import loads from urllib.parse import urlencode diff --git a/searx/engines/sqlite.py b/searx/engines/sqlite.py index 9a639ff9a..292448602 100644 --- a/searx/engines/sqlite.py +++ b/searx/engines/sqlite.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """SQLite database (Offline) diff --git a/searx/engines/unsplash.py b/searx/engines/unsplash.py index dcca18ee6..1445b4cec 100644 --- a/searx/engines/unsplash.py +++ b/searx/engines/unsplash.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """Unsplash """ diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index a7a5e57ab..8338d5301 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """The XPath engine is a *generic* engine with which it is possible to configure engines in the settings. diff --git a/searx/engines/yahoo_news.py b/searx/engines/yahoo_news.py index 750373ffb..ec07cd408 100644 --- a/searx/engines/yahoo_news.py +++ b/searx/engines/yahoo_news.py @@ -6,7 +6,7 @@ Yahoo News is "English only" and do not offer localized nor language queries. """ -# pylint: disable=invalid-name, missing-function-docstring +# pylint: disable=invalid-name import re from urllib.parse import urlencode From 2a3b9a2e26fc9570c2dd2f070257968a2b3a1149 Mon Sep 17 00:00:00 2001 From: Markus Heiser Date: Tue, 7 Sep 2021 13:34:35 +0200 Subject: [PATCH 3/3] [pylint] searx: drop no longer needed 'missing-function-docstring' Suggested-by: @dalf https://github.com/searxng/searxng/issues/102#issuecomment-914168470 Signed-off-by: Markus Heiser --- searx/__init__.py | 2 +- searx/flaskfix.py | 2 +- searx/metrics/__init__.py | 2 +- searx/network/__init__.py | 2 +- searx/network/client.py | 2 +- searx/network/network.py | 2 +- searx/network/raise_for_httperror.py | 1 - searx/preferences.py | 18 +++++++++--------- searx/search/__init__.py | 2 +- searx/search/checker/__main__.py | 2 +- searx/search/checker/background.py | 2 +- searx/search/processors/abstract.py | 2 -- searx/search/processors/online_currency.py | 2 -- searx/settings_defaults.py | 1 - searx/unixthreadname.py | 2 +- searx/version.py | 2 +- searx/webapp.py | 1 - 17 files changed, 20 insertions(+), 27 deletions(-) diff --git a/searx/__init__.py b/searx/__init__.py index 0b73d5204..265f926bc 100644 --- a/searx/__init__.py +++ b/searx/__init__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring, missing-module-docstring +# pylint: disable=missing-module-docstring from os.path import dirname, abspath import logging diff --git a/searx/flaskfix.py b/searx/flaskfix.py index c069df453..47aabfa53 100644 --- a/searx/flaskfix.py +++ b/searx/flaskfix.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring,missing-function-docstring +# pylint: disable=missing-module-docstring from urllib.parse import urlparse diff --git a/searx/metrics/__init__.py b/searx/metrics/__init__.py index 2ef73149b..995f182af 100644 --- a/searx/metrics/__init__.py +++ b/searx/metrics/__init__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring, missing-function-docstring +# pylint: disable=missing-module-docstring import typing import math diff --git a/searx/network/__init__.py b/searx/network/__init__.py index 3dc99da48..7b0396a12 100644 --- a/searx/network/__init__.py +++ b/searx/network/__init__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring, missing-function-docstring, global-statement +# pylint: disable=missing-module-docstring, global-statement import asyncio import threading diff --git a/searx/network/client.py b/searx/network/client.py index 60171e6c3..187ae5366 100644 --- a/searx/network/client.py +++ b/searx/network/client.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring, missing-function-docstring, global-statement +# pylint: disable=missing-module-docstring, global-statement import asyncio import logging diff --git a/searx/network/network.py b/searx/network/network.py index 94e91593d..d09a2ee0e 100644 --- a/searx/network/network.py +++ b/searx/network/network.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint # pylint: disable=global-statement -# pylint: disable=missing-module-docstring, missing-class-docstring, missing-function-docstring +# pylint: disable=missing-module-docstring, missing-class-docstring import atexit import asyncio diff --git a/searx/network/raise_for_httperror.py b/searx/network/raise_for_httperror.py index 0f550918d..a2f554614 100644 --- a/searx/network/raise_for_httperror.py +++ b/searx/network/raise_for_httperror.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """Raise exception for an HTTP response is an error. """ diff --git a/searx/preferences.py b/searx/preferences.py index c19a11f4b..26506556a 100644 --- a/searx/preferences.py +++ b/searx/preferences.py @@ -117,7 +117,7 @@ class MultipleChoiceSetting(EnumStringSetting): self._validate_selections(elements) self.value = elements - def parse_form(self, data): # pylint: disable=missing-function-docstring + def parse_form(self, data): if self.locked: return @@ -154,7 +154,7 @@ class SetSetting(Setting): for element in elements: self.values.add(element) - def parse_form(self, data): # pylint: disable=missing-function-docstring + def parse_form(self, data): if self.locked: return @@ -226,22 +226,22 @@ class SwitchableSetting(Setting): if not hasattr(self, 'choices'): raise MissingArgumentException('missing argument: choices') - def transform_form_items(self, items): # pylint: disable=missing-function-docstring + def transform_form_items(self, items): # pylint: disable=no-self-use return items - def transform_values(self, values): # pylint: disable=missing-function-docstring + def transform_values(self, values): # pylint: disable=no-self-use return values - def parse_cookie(self, data): # pylint: disable=missing-function-docstring + def parse_cookie(self, data): # pylint: disable=attribute-defined-outside-init if data[DISABLED] != '': self.disabled = set(data[DISABLED].split(',')) if data[ENABLED] != '': self.enabled = set(data[ENABLED].split(',')) - def parse_form(self, items): # pylint: disable=missing-function-docstring + def parse_form(self, items): if self.locked: return @@ -262,14 +262,14 @@ class SwitchableSetting(Setting): resp.set_cookie('disabled_{0}'.format(self.value), ','.join(self.disabled), max_age=COOKIE_MAX_AGE) resp.set_cookie('enabled_{0}'.format(self.value), ','.join(self.enabled), max_age=COOKIE_MAX_AGE) - def get_disabled(self): # pylint: disable=missing-function-docstring + def get_disabled(self): disabled = self.disabled for choice in self.choices: # pylint: disable=no-member if not choice['default_on'] and choice['id'] not in self.enabled: disabled.add(choice['id']) return self.transform_values(disabled) - def get_enabled(self): # pylint: disable=missing-function-docstring + def get_enabled(self): enabled = self.enabled for choice in self.choices: # pylint: disable=no-member if choice['default_on'] and choice['id'] not in self.disabled: @@ -515,7 +515,7 @@ class Preferences: resp.set_cookie(k, v, max_age=COOKIE_MAX_AGE) return resp - def validate_token(self, engine): # pylint: disable=missing-function-docstring + def validate_token(self, engine): valid = True if hasattr(engine, 'tokens') and engine.tokens: valid = False diff --git a/searx/search/__init__.py b/searx/search/__init__.py index 041a54c4b..d8d3e1e1c 100644 --- a/searx/search/__init__.py +++ b/searx/search/__init__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring, missing-function-docstring +# pylint: disable=missing-module-docstring import typing import threading diff --git a/searx/search/checker/__main__.py b/searx/search/checker/__main__.py index e1de860b7..4ce4ca76b 100644 --- a/searx/search/checker/__main__.py +++ b/searx/search/checker/__main__.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring, missing-function-docstring +# pylint: disable=missing-module-docstring import sys import io diff --git a/searx/search/checker/background.py b/searx/search/checker/background.py index f79a5d2df..d9f11a71c 100644 --- a/searx/search/checker/background.py +++ b/searx/search/checker/background.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-module-docstring, missing-function-docstring +# pylint: disable=missing-module-docstring import json import random diff --git a/searx/search/processors/abstract.py b/searx/search/processors/abstract.py index 81724f052..c8d81c026 100644 --- a/searx/search/processors/abstract.py +++ b/searx/search/processors/abstract.py @@ -19,8 +19,6 @@ from searx.utils import get_engine_from_settings logger = logger.getChild('searx.search.processor') SUSPENDED_STATUS = {} -# pylint: disable=missing-function-docstring - class SuspendedStatus: """Class to handle suspend state.""" diff --git a/searx/search/processors/online_currency.py b/searx/search/processors/online_currency.py index 4f642fa72..3213a11e5 100644 --- a/searx/search/processors/online_currency.py +++ b/searx/search/processors/online_currency.py @@ -12,8 +12,6 @@ from .online import OnlineProcessor parser_re = re.compile('.*?(\\d+(?:\\.\\d+)?) ([^.0-9]+) (?:in|to) ([^.0-9]+)', re.I) -# pylint: disable=missing-function-docstring - def normalize_name(name): name = name.lower().replace('-', ' ').rstrip('s') name = re.sub(' +', ' ', name) diff --git a/searx/settings_defaults.py b/searx/settings_defaults.py index 42d88f2bc..62625b912 100644 --- a/searx/settings_defaults.py +++ b/searx/settings_defaults.py @@ -1,6 +1,5 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """Implementation of the default settings. """ diff --git a/searx/unixthreadname.py b/searx/unixthreadname.py index 9a6f53813..0f1f54936 100644 --- a/searx/unixthreadname.py +++ b/searx/unixthreadname.py @@ -14,7 +14,7 @@ else: old_thread_init = threading.Thread.__init__ def new_thread_init(self, *args, **kwargs): - # pylint: disable=protected-access, disable=c-extension-no-member, disable=missing-function-docstring + # pylint: disable=protected-access, disable=c-extension-no-member old_thread_init(self, *args, **kwargs) setproctitle.setthreadtitle(self._name) threading.Thread.__init__ = new_thread_init diff --git a/searx/version.py b/searx/version.py index daada6020..ac42834d9 100644 --- a/searx/version.py +++ b/searx/version.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring,missing-module-docstring,missing-class-docstring +# pylint: disable=,missing-module-docstring,missing-class-docstring import re import os diff --git a/searx/webapp.py b/searx/webapp.py index e29b7f442..6fcf7c464 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -1,7 +1,6 @@ #!/usr/bin/env python # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -# pylint: disable=missing-function-docstring """WebbApp """