diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2024-03-11 14:06:26 +0100 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarIT.de> | 2024-03-11 14:55:38 +0100 |
commit | 542f7d0d7bd1a12e1884ba4a1508b40e2514d472 (patch) | |
tree | 5256282b267e494200d02914593457854567fec4 /searx/plugins | |
parent | 8205f170ff983e5240d32dc17d7fdb526ebe5fe7 (diff) | |
download | searxng-542f7d0d7bd1a12e1884ba4a1508b40e2514d472.tar.gz searxng-542f7d0d7bd1a12e1884ba4a1508b40e2514d472.zip |
[mod] pylint all files with one profile / drop PYLINT_SEARXNG_DISABLE_OPTION
In the past, some files were tested with the standard profile, others with a
profile in which most of the messages were switched off ... some files were not
checked at all.
- ``PYLINT_SEARXNG_DISABLE_OPTION`` has been abolished
- the distinction ``# lint: pylint`` is no longer necessary
- the pylint tasks have been reduced from three to two
1. ./searx/engines -> lint engines with additional builtins
2. ./searx ./searxng_extra ./tests -> lint all other python files
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/plugins')
-rw-r--r-- | searx/plugins/__init__.py | 1 | ||||
-rw-r--r-- | searx/plugins/ahmia_filter.py | 9 | ||||
-rw-r--r-- | searx/plugins/hash_plugin.py | 26 | ||||
-rw-r--r-- | searx/plugins/hostname_replace.py | 7 | ||||
-rw-r--r-- | searx/plugins/oa_doi_rewrite.py | 9 | ||||
-rw-r--r-- | searx/plugins/self_info.py | 1 | ||||
-rw-r--r-- | searx/plugins/tor_check.py | 1 | ||||
-rw-r--r-- | searx/plugins/tracker_url_remover.py | 23 |
8 files changed, 26 insertions, 51 deletions
diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index 41dd1a0ef..c3aad5f32 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -1,5 +1,4 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -# lint: pylint # pylint: disable=missing-module-docstring, missing-class-docstring import sys diff --git a/searx/plugins/ahmia_filter.py b/searx/plugins/ahmia_filter.py index 326da9ca1..bbf137103 100644 --- a/searx/plugins/ahmia_filter.py +++ b/searx/plugins/ahmia_filter.py @@ -1,6 +1,5 @@ -''' - SPDX-License-Identifier: AGPL-3.0-or-later -''' +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring from hashlib import md5 from searx.data import ahmia_blacklist_loader @@ -13,14 +12,14 @@ preference_section = 'onions' ahmia_blacklist = None -def on_result(request, search, result): +def on_result(_request, _search, result): if not result.get('is_onion') or not result.get('parsed_url'): return True result_hash = md5(result['parsed_url'].hostname.encode()).hexdigest() return result_hash not in ahmia_blacklist -def init(app, settings): +def init(_app, settings): global ahmia_blacklist # pylint: disable=global-statement if not settings['outgoing']['using_tor_proxy']: # disable the plugin diff --git a/searx/plugins/hash_plugin.py b/searx/plugins/hash_plugin.py index edb91dd8e..c27e2a432 100644 --- a/searx/plugins/hash_plugin.py +++ b/searx/plugins/hash_plugin.py @@ -1,25 +1,11 @@ -''' -searx is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring -searx is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with searx. If not, see < http://www.gnu.org/licenses/ >. - -(C) 2015 by Adam Tauber, <asciimoo@gmail.com> -(C) 2018, 2020 by Vaclav Zouzalik -''' - -from flask_babel import gettext import hashlib import re +from flask_babel import gettext + name = "Hash plugin" description = gettext("Converts strings to different hash digests.") default_on = True @@ -30,7 +16,7 @@ query_examples = 'sha512 The quick brown fox jumps over the lazy dog' parser_re = re.compile('(md5|sha1|sha224|sha256|sha384|sha512) (.*)', re.I) -def post_search(request, search): +def post_search(_request, search): # process only on first page if search.search_query.pageno > 1: return True @@ -40,7 +26,7 @@ def post_search(request, search): return True function, string = m.groups() - if string.strip().__len__() == 0: + if not string.strip(): # end if the string is empty return True diff --git a/searx/plugins/hostname_replace.py b/searx/plugins/hostname_replace.py index 5a1df6921..1b3f8609c 100644 --- a/searx/plugins/hostname_replace.py +++ b/searx/plugins/hostname_replace.py @@ -1,10 +1,13 @@ # SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring import re from urllib.parse import urlunparse, urlparse + +from flask_babel import gettext + from searx import settings from searx.plugins import logger -from flask_babel import gettext name = gettext('Hostname replace') description = gettext('Rewrite result hostnames or remove results based on the hostname') @@ -20,7 +23,7 @@ parsed = 'parsed_url' _url_fields = ['iframe_src', 'audio_src'] -def on_result(request, search, result): +def on_result(_request, _search, result): for pattern, replacement in replacements.items(): diff --git a/searx/plugins/oa_doi_rewrite.py b/searx/plugins/oa_doi_rewrite.py index f0e07735d..6a214282c 100644 --- a/searx/plugins/oa_doi_rewrite.py +++ b/searx/plugins/oa_doi_rewrite.py @@ -1,9 +1,12 @@ +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring + +import re from urllib.parse import urlparse, parse_qsl + from flask_babel import gettext -import re from searx import settings - regex = re.compile(r'10\.\d{4,9}/[^\s]+') name = gettext('Open Access DOI rewrite') @@ -31,7 +34,7 @@ def get_doi_resolver(preferences): return doi_resolvers[selected_resolver] -def on_result(request, search, result): +def on_result(request, _search, result): if 'parsed_url' not in result: return True diff --git a/searx/plugins/self_info.py b/searx/plugins/self_info.py index 8079ee0d4..75a2a76c9 100644 --- a/searx/plugins/self_info.py +++ b/searx/plugins/self_info.py @@ -1,5 +1,4 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -# lint: pylint # pylint: disable=missing-module-docstring,invalid-name import re diff --git a/searx/plugins/tor_check.py b/searx/plugins/tor_check.py index 831c90ce5..3816d8ece 100644 --- a/searx/plugins/tor_check.py +++ b/searx/plugins/tor_check.py @@ -1,5 +1,4 @@ # SPDX-License-Identifier: AGPL-3.0-or-later -# lint: pylint """A plugin to check if the ip address of the request is a Tor exit-node if the user searches for ``tor-check``. It fetches the tor exit node list from https://check.torproject.org/exit-addresses and parses all the IPs into a list, diff --git a/searx/plugins/tracker_url_remover.py b/searx/plugins/tracker_url_remover.py index 42c58e524..2961cd026 100644 --- a/searx/plugins/tracker_url_remover.py +++ b/searx/plugins/tracker_url_remover.py @@ -1,24 +1,11 @@ -''' -searx is free software: you can redistribute it and/or modify -it under the terms of the GNU Affero General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +# SPDX-License-Identifier: AGPL-3.0-or-later +# pylint: disable=missing-module-docstring -searx is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU Affero General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with searx. If not, see < http://www.gnu.org/licenses/ >. - -(C) 2015 by Adam Tauber, <asciimoo@gmail.com> -''' - -from flask_babel import gettext import re from urllib.parse import urlunparse, parse_qsl, urlencode +from flask_babel import gettext + regexes = { re.compile(r'utm_[^&]+'), re.compile(r'(wkey|wemail)[^&]*'), @@ -32,7 +19,7 @@ default_on = True preference_section = 'privacy' -def on_result(request, search, result): +def on_result(_request, _search, result): if 'parsed_url' not in result: return True |