diff --git a/searx/_settings.py b/searx/_settings.py index 0db62474c..dd9b0c774 100644 --- a/searx/_settings.py +++ b/searx/_settings.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Implementation of the :py:obj:`preference ` settings.""" + # pylint: disable = too-few-public-methods import typing as t diff --git a/searx/answerers/__init__.py b/searx/answerers/__init__.py index 7c8c8003f..292966d22 100644 --- a/searx/answerers/__init__.py +++ b/searx/answerers/__init__.py @@ -38,7 +38,6 @@ area: """ - __all__ = ["AnswererInfo", "Answerer", "AnswerStorage"] diff --git a/searx/answerers/_core.py b/searx/answerers/_core.py index c102be125..558ab9f30 100644 --- a/searx/answerers/_core.py +++ b/searx/answerers/_core.py @@ -13,7 +13,6 @@ from dataclasses import dataclass from searx.utils import load_module from searx.result_types.answer import BaseAnswer - _default = pathlib.Path(__file__).parent log: logging.Logger = logging.getLogger("searx.answerers") diff --git a/searx/botdetection/__init__.py b/searx/botdetection/__init__.py index 5799b0f10..4e5151008 100644 --- a/searx/botdetection/__init__.py +++ b/searx/botdetection/__init__.py @@ -5,7 +5,6 @@ Implementations used for bot detection. """ - __all__ = ["init", "dump_request", "get_network", "too_many_requests", "ProxyFix"] diff --git a/searx/botdetection/config.py b/searx/botdetection/config.py index 418d76a46..f2ec4750c 100644 --- a/searx/botdetection/config.py +++ b/searx/botdetection/config.py @@ -182,7 +182,7 @@ class Config: if default is UNSET: raise KeyError(name) return default - (modulename, name) = str(fqn).rsplit('.', 1) + modulename, name = str(fqn).rsplit('.', 1) m = __import__(modulename, {}, {}, [name], 0) return getattr(m, name) diff --git a/searx/botdetection/http_accept.py b/searx/botdetection/http_accept.py index 1ae34d358..df462fd4a 100644 --- a/searx/botdetection/http_accept.py +++ b/searx/botdetection/http_accept.py @@ -13,7 +13,6 @@ Accept_ header .. """ - from ipaddress import ( IPv4Network, IPv6Network, diff --git a/searx/botdetection/http_accept_encoding.py b/searx/botdetection/http_accept_encoding.py index 918490ce5..59aa9cad2 100644 --- a/searx/botdetection/http_accept_encoding.py +++ b/searx/botdetection/http_accept_encoding.py @@ -14,7 +14,6 @@ bot if the Accept-Encoding_ header .. """ - from ipaddress import ( IPv4Network, IPv6Network, diff --git a/searx/botdetection/http_accept_language.py b/searx/botdetection/http_accept_language.py index 626ed6b0e..e18ff2978 100644 --- a/searx/botdetection/http_accept_language.py +++ b/searx/botdetection/http_accept_language.py @@ -11,7 +11,6 @@ if the Accept-Language_ header is unset. """ - from ipaddress import ( IPv4Network, IPv6Network, diff --git a/searx/botdetection/http_connection.py b/searx/botdetection/http_connection.py index 0b7d9ae76..854a7ef8b 100644 --- a/searx/botdetection/http_connection.py +++ b/searx/botdetection/http_connection.py @@ -11,7 +11,6 @@ the Connection_ header is set to ``close``. """ - from ipaddress import ( IPv4Network, IPv6Network, diff --git a/searx/botdetection/http_sec_fetch.py b/searx/botdetection/http_sec_fetch.py index c1ea7333f..90da0b595 100644 --- a/searx/botdetection/http_sec_fetch.py +++ b/searx/botdetection/http_sec_fetch.py @@ -20,6 +20,7 @@ Metadata`_. A request is filtered out in case of: """ + # pylint: disable=unused-argument diff --git a/searx/botdetection/http_user_agent.py b/searx/botdetection/http_user_agent.py index 76d2558ce..c65cb2aa5 100644 --- a/searx/botdetection/http_user_agent.py +++ b/searx/botdetection/http_user_agent.py @@ -12,7 +12,6 @@ the User-Agent_ header is unset or matches the regular expression """ - import re from ipaddress import ( IPv4Network, @@ -25,7 +24,6 @@ import flask from . import config from ._helpers import too_many_requests - USER_AGENT = ( r'(' + r'unknown' diff --git a/searx/botdetection/ip_limit.py b/searx/botdetection/ip_limit.py index b2559a97b..abad65039 100644 --- a/searx/botdetection/ip_limit.py +++ b/searx/botdetection/ip_limit.py @@ -55,7 +55,6 @@ from ._helpers import ( logger, ) - logger = logger.getChild('ip_limit') BURST_WINDOW = 20 diff --git a/searx/botdetection/ip_lists.py b/searx/botdetection/ip_lists.py index 19f0e3667..2072f859f 100644 --- a/searx/botdetection/ip_lists.py +++ b/searx/botdetection/ip_lists.py @@ -23,6 +23,7 @@ The ``ip_lists`` method implements :py:obj:`block-list ` and ] """ + # pylint: disable=unused-argument diff --git a/searx/botdetection/trusted_proxies.py b/searx/botdetection/trusted_proxies.py index 1e4c68837..bf0f23b62 100644 --- a/searx/botdetection/trusted_proxies.py +++ b/searx/botdetection/trusted_proxies.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Implementation of a middleware to determine the real IP of an HTTP request (:py:obj:`flask.request.remote_addr`) behind a proxy chain.""" + # pylint: disable=too-many-branches diff --git a/searx/botdetection/valkeydb.py b/searx/botdetection/valkeydb.py index 44f265803..9041064e5 100644 --- a/searx/botdetection/valkeydb.py +++ b/searx/botdetection/valkeydb.py @@ -1,7 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Providing a Valkey database for the botdetection methods.""" - import valkey __all__ = ["set_valkey_client", "get_valkey_client"] diff --git a/searx/brand.py b/searx/brand.py index dcd1dd9ed..85596a844 100644 --- a/searx/brand.py +++ b/searx/brand.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Implementations needed for a branding of SearXNG.""" + # pylint: disable=too-few-public-methods # Struct fields aren't discovered in Python 3.14 diff --git a/searx/cache.py b/searx/cache.py index 93304f150..7bef21956 100644 --- a/searx/cache.py +++ b/searx/cache.py @@ -465,7 +465,7 @@ class ExpireCacheSQLite(sqlitedb.SQLiteAppl, ExpireCache): # Check if value is expired. It's possible that it's expired but has not # yet been automatically deleted by the periodic maintenance - (value, expire) = row + value, expire = row now = time.time() if expire < now: # The record is deleted during the maintenance interval. Deleting diff --git a/searx/compat.py b/searx/compat.py index 418d537ca..067a9fb91 100644 --- a/searx/compat.py +++ b/searx/compat.py @@ -3,7 +3,6 @@ import warnings - # limiter backward compatibility # ------------------------------ diff --git a/searx/data/__init__.py b/searx/data/__init__.py index fc3031680..feb1b2083 100644 --- a/searx/data/__init__.py +++ b/searx/data/__init__.py @@ -4,6 +4,7 @@ make data.all """ + # pylint: disable=invalid-name __all__ = ["ahmia_blacklist_loader", "data_dir", "get_cache"] diff --git a/searx/data/tracker_patterns.py b/searx/data/tracker_patterns.py index ed4415bce..fb60bf690 100644 --- a/searx/data/tracker_patterns.py +++ b/searx/data/tracker_patterns.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Simple implementation to store TrackerPatterns data in a SQL database.""" + # pylint: disable=too-many-branches import typing as t diff --git a/searx/engines/azure.py b/searx/engines/azure.py index e00d75872..c4e63eb9e 100644 --- a/searx/engines/azure.py +++ b/searx/engines/azure.py @@ -25,6 +25,7 @@ To use this engine, add an entry similar to the following to your engine list in https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app """ + import typing as t from searx.enginelib import EngineCache diff --git a/searx/engines/base.py b/searx/engines/base.py index d0f0bfde3..212b4e896 100755 --- a/searx/engines/base.py +++ b/searx/engines/base.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """BASE (Scholar publications)""" + from datetime import datetime import re diff --git a/searx/engines/command.py b/searx/engines/command.py index 29950ae4e..2795c3330 100644 --- a/searx/engines/command.py +++ b/searx/engines/command.py @@ -83,7 +83,6 @@ from threading import Thread from searx import logger from searx.result_types import EngineResults - engine_type = 'offline' paging = True command = [] diff --git a/searx/engines/docker_hub.py b/searx/engines/docker_hub.py index dc1d1ddfa..cbb653346 100644 --- a/searx/engines/docker_hub.py +++ b/searx/engines/docker_hub.py @@ -1,5 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Docker Hub (IT)""" + # pylint: disable=use-dict-literal from urllib.parse import urlencode diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index e2801d7e6..b32e0ed77 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -164,6 +164,7 @@ Terms / phrases that you keep coming across: https://developer.mozilla.org/en-US/docs/Web/HTTP/Reference/Headers/Accept-Language """ + # pylint: disable=global-statement import json diff --git a/searx/engines/duckduckgo_definitions.py b/searx/engines/duckduckgo_definitions.py index bf2168827..ecb20fe0e 100644 --- a/searx/engines/duckduckgo_definitions.py +++ b/searx/engines/duckduckgo_definitions.py @@ -12,6 +12,7 @@ least we could not find out how language support should work. It seems that most of the features are based on English terms. """ + import typing as t from urllib.parse import urlencode, urlparse, urljoin diff --git a/searx/engines/duckduckgo_weather.py b/searx/engines/duckduckgo_weather.py index 070d09d85..7a0956b67 100644 --- a/searx/engines/duckduckgo_weather.py +++ b/searx/engines/duckduckgo_weather.py @@ -17,7 +17,6 @@ from searx.result_types import EngineResults from searx.extended_types import SXNG_Response from searx import weather - about = { "website": 'https://duckduckgo.com/', "wikidata_id": 'Q12805', diff --git a/searx/engines/dummy-offline.py b/searx/engines/dummy-offline.py index 4e9d8b202..c3d6baac5 100644 --- a/searx/engines/dummy-offline.py +++ b/searx/engines/dummy-offline.py @@ -2,7 +2,6 @@ # pylint: disable=invalid-name """Dummy Offline""" - # about about = { "wikidata_id": None, diff --git a/searx/engines/github_code.py b/searx/engines/github_code.py index 0a2d26699..73a112de0 100644 --- a/searx/engines/github_code.py +++ b/searx/engines/github_code.py @@ -65,7 +65,6 @@ code lines are just relabeled (starting from 1) and appended (a disjoint set of code blocks in a single file might be returned from the API). """ - import typing as t from urllib.parse import urlencode diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 3971bc03a..e42fc8bf7 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -23,6 +23,7 @@ The google news API ignores some parameters from the common :ref:`google API`: .. _num: https://developers.google.com/custom-search/docs/xml_results#numsp .. _save: https://developers.google.com/custom-search/docs/xml_results#safesp """ + import typing as t import json diff --git a/searx/engines/google_videos.py b/searx/engines/google_videos.py index 0860368fd..b415d3347 100644 --- a/searx/engines/google_videos.py +++ b/searx/engines/google_videos.py @@ -11,6 +11,7 @@ .. _data URLs: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URIs """ + import re from urllib.parse import urlencode, urlparse, parse_qs, unquote from lxml import html diff --git a/searx/engines/hex.py b/searx/engines/hex.py index 4c4920f68..6a546889a 100644 --- a/searx/engines/hex.py +++ b/searx/engines/hex.py @@ -4,7 +4,6 @@ from urllib.parse import urlencode from dateutil import parser - about = { # pylint: disable=line-too-long "website": "https://hex.pm/", diff --git a/searx/engines/jisho.py b/searx/engines/jisho.py index b167d864a..ae9b0103c 100644 --- a/searx/engines/jisho.py +++ b/searx/engines/jisho.py @@ -108,14 +108,12 @@ def get_infobox(alt_forms, result_url, definitions): infobox_content.append(f'

Other forms: {", ".join(alt_forms[1:])}

') # definitions - infobox_content.append( - ''' + infobox_content.append(''' JMdict and JMnedict by EDRDG, CC BY-SA 3.0. Wikipedia, CC BY-SA 3.0.