mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 19:01:00 +00:00
[fix] issues reported by pylint 3.1.0
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
3bea2e7e3a
commit
50d5a9ff60
4 changed files with 7 additions and 8 deletions
|
@ -111,8 +111,7 @@ class Network:
|
||||||
return
|
return
|
||||||
if isinstance(local_addresses, str):
|
if isinstance(local_addresses, str):
|
||||||
local_addresses = [local_addresses]
|
local_addresses = [local_addresses]
|
||||||
for address in local_addresses:
|
yield from local_addresses
|
||||||
yield address
|
|
||||||
|
|
||||||
def get_ipaddress_cycle(self):
|
def get_ipaddress_cycle(self):
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -191,8 +191,7 @@ class PluginStore:
|
||||||
self.plugins: List[Plugin] = []
|
self.plugins: List[Plugin] = []
|
||||||
|
|
||||||
def __iter__(self):
|
def __iter__(self):
|
||||||
for plugin in self.plugins:
|
yield from self.plugins
|
||||||
yield plugin
|
|
||||||
|
|
||||||
def register(self, plugin):
|
def register(self, plugin):
|
||||||
self.plugins.append(plugin)
|
self.plugins.append(plugin)
|
||||||
|
|
|
@ -14,7 +14,7 @@ This scheduler is not generic on purpose: if more feature are required, a dedica
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import time
|
import time
|
||||||
import importlib
|
from pathlib import Path
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
from searx.redisdb import client as get_redis_client
|
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')
|
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):
|
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.
|
"""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 call this function is multiple workers
|
||||||
* to kill workers at any time as long there is one at least one worker
|
* 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:
|
while True:
|
||||||
# ask the Redis script what to do
|
# ask the Redis script what to do
|
||||||
# the script says
|
# the script says
|
||||||
|
|
|
@ -97,8 +97,7 @@ def add_currency_label(db, label, iso4217, language):
|
||||||
def wikidata_request_result_iterator(request):
|
def wikidata_request_result_iterator(request):
|
||||||
result = wikidata.send_wikidata_query(request.replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL))
|
result = wikidata.send_wikidata_query(request.replace('%LANGUAGES_SPARQL%', LANGUAGES_SPARQL))
|
||||||
if result is not None:
|
if result is not None:
|
||||||
for r in result['results']['bindings']:
|
yield from result['results']['bindings']
|
||||||
yield r
|
|
||||||
|
|
||||||
|
|
||||||
def fetch_db():
|
def fetch_db():
|
||||||
|
|
Loading…
Reference in a new issue