mirror of
https://github.com/searxng/searxng.git
synced 2025-08-02 18:12:21 +02:00
[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>
This commit is contained in:
parent
8205f170ff
commit
542f7d0d7b
118 changed files with 261 additions and 369 deletions
|
@ -1,5 +1,4 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
# pylint: disable=missing-module-docstring, missing-class-docstring
|
||||
|
||||
import sys
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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():
|
||||
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
from urllib.parse import urlparse, parse_qsl
|
||||
from flask_babel import gettext
|
||||
import re
|
||||
from searx import settings
|
||||
# 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
|
||||
from searx import settings
|
||||
|
||||
regex = re.compile(r'10\.\d{4,9}/[^\s]+')
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
# lint: pylint
|
||||
# pylint: disable=missing-module-docstring,invalid-name
|
||||
|
||||
import re
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue