summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2024-03-09 08:34:43 +0100
committerMarkus Heiser <markus.heiser@darmarIT.de>2024-03-09 09:28:13 +0100
commit50d5a9ff60e16324ffa68b9a37ca87a7de81c450 (patch)
tree635f15c92a84ce57d04a658a1688f58dadc6abfc
parent3bea2e7e3a1ccd1feea50916b4a6f0e9963583c7 (diff)
downloadsearx-50d5a9ff60e16324ffa68b9a37ca87a7de81c450.tar.gz
searx-50d5a9ff60e16324ffa68b9a37ca87a7de81c450.zip
[fix] issues reported by pylint 3.1.0
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
-rw-r--r--searx/network/network.py3
-rw-r--r--searx/plugins/__init__.py3
-rw-r--r--searx/search/checker/scheduler.py6
-rwxr-xr-xsearxng_extra/update/update_currencies.py3
4 files changed, 7 insertions, 8 deletions
diff --git a/searx/network/network.py b/searx/network/network.py
index 3ab0bff3a..0cdfb1c43 100644
--- a/searx/network/network.py
+++ b/searx/network/network.py
@@ -111,8 +111,7 @@ class Network:
return
if isinstance(local_addresses, str):
local_addresses = [local_addresses]
- for address in local_addresses:
- yield address
+ yield from local_addresses
def get_ipaddress_cycle(self):
while True:
diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py
index 951ec9de3..41dd1a0ef 100644
--- a/searx/plugins/__init__.py
+++ b/searx/plugins/__init__.py
@@ -191,8 +191,7 @@ class PluginStore:
self.plugins: List[Plugin] = []
def __iter__(self):
- for plugin in self.plugins:
- yield plugin
+ yield from self.plugins
def register(self, plugin):
self.plugins.append(plugin)
diff --git a/searx/search/checker/scheduler.py b/searx/search/checker/scheduler.py
index cc3bb7380..7d7e90769 100644
--- a/searx/search/checker/scheduler.py
+++ b/searx/search/checker/scheduler.py
@@ -14,7 +14,7 @@ This scheduler is not generic on purpose: if more feature are required, a dedica
import logging
import time
-import importlib
+from pathlib import Path
from typing import Callable
from searx.redisdb import client as get_redis_client
@@ -23,6 +23,8 @@ from searx.redislib import lua_script_storage
logger = logging.getLogger('searx.search.checker')
+SCHEDULER_LUA = Path(__file__).parent / "scheduler.lua"
+
def scheduler_function(start_after_from: int, start_after_to: int, every_from: int, every_to: int, callback: Callable):
"""Run the checker periodically. The function never returns.
@@ -35,7 +37,7 @@ def scheduler_function(start_after_from: int, start_after_to: int, every_from: i
* to call this function is multiple workers
* to kill workers at any time as long there is one at least one worker
"""
- scheduler_now_script = importlib.resources.read_text(__package__, "scheduler.lua")
+ scheduler_now_script = SCHEDULER_LUA.open().read()
while True:
# ask the Redis script what to do
# the script says
diff --git a/searxng_extra/update/update_currencies.py b/searxng_extra/update/update_currencies.py
index a126d1532..c604e5420 100755
--- a/searxng_extra/update/update_currencies.py
+++ b/searxng_extra/update/update_currencies.py
@@ -97,8 +97,7 @@ def add_currency_label(db, label, iso4217, language):
def wikidata_request_result_iterator(request):
result = wikidata.send_wikidata_query(request.replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL))
if result is not None:
- for r in result['results']['bindings']:
- yield r
+ yield from result['results']['bindings']
def fetch_db():