mirror of
https://github.com/searxng/searxng.git
synced 2025-07-14 00:39:18 +02:00
[format.python] initial formatting of the python code
This patch was generated by black [1]:: make format.python [1] https://github.com/psf/black Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
fcdc2c2cd2
commit
3d96a9839a
184 changed files with 2800 additions and 2836 deletions
|
@ -20,16 +20,19 @@ result_template = 'key-value.html'
|
|||
exact_match_only = True
|
||||
|
||||
_redis_client = None
|
||||
|
||||
|
||||
def init(_engine_settings):
|
||||
global _redis_client # pylint: disable=global-statement
|
||||
_redis_client = redis.StrictRedis(
|
||||
host = host,
|
||||
port = port,
|
||||
db = db,
|
||||
password = password or None,
|
||||
decode_responses = True,
|
||||
host=host,
|
||||
port=port,
|
||||
db=db,
|
||||
password=password or None,
|
||||
decode_responses=True,
|
||||
)
|
||||
|
||||
|
||||
def search(query, _params):
|
||||
if not exact_match_only:
|
||||
return search_keys(query)
|
||||
|
@ -42,21 +45,20 @@ def search(query, _params):
|
|||
if ' ' in query:
|
||||
qset, rest = query.split(' ', 1)
|
||||
ret = []
|
||||
for res in _redis_client.hscan_iter(
|
||||
qset, match='*{}*'.format(rest)
|
||||
):
|
||||
ret.append({
|
||||
res[0]: res[1],
|
||||
'template': result_template,
|
||||
})
|
||||
for res in _redis_client.hscan_iter(qset, match='*{}*'.format(rest)):
|
||||
ret.append(
|
||||
{
|
||||
res[0]: res[1],
|
||||
'template': result_template,
|
||||
}
|
||||
)
|
||||
return ret
|
||||
return []
|
||||
|
||||
|
||||
def search_keys(query):
|
||||
ret = []
|
||||
for key in _redis_client.scan_iter(
|
||||
match='*{}*'.format(query)
|
||||
):
|
||||
for key in _redis_client.scan_iter(match='*{}*'.format(query)):
|
||||
key_type = _redis_client.type(key)
|
||||
res = None
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue