mirror of
https://github.com/searxng/searxng.git
synced 2024-11-16 17:40:11 +01:00
[black] upgrade black 22.12.0 --> 24.2.0
The issue discussed in [1] has been solved since [2] has been merged into black / now we can upgrade without touching 69 files as it was needed with black 23.1.0 [3]. [1] https://github.com/searxng/searxng/pull/2159#issuecomment-1425723977 [2] https://github.com/psf/black/pull/4060 [3] https://github.com/searxng/searxng/pull/2159/files Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
48d04871a4
commit
a7b51f023e
@ -1,7 +1,7 @@
|
|||||||
mock==5.1.0
|
mock==5.1.0
|
||||||
nose2[coverage_plugin]==0.14.1
|
nose2[coverage_plugin]==0.14.1
|
||||||
cov-core==1.15.0
|
cov-core==1.15.0
|
||||||
black==22.12.0
|
black==24.2.0
|
||||||
pylint==3.0.3
|
pylint==3.0.3
|
||||||
splinter==0.21.0
|
splinter==0.21.0
|
||||||
selenium==4.18.1
|
selenium==4.18.1
|
||||||
|
@ -211,7 +211,6 @@ def value(name: str, data_dict: dict):
|
|||||||
def validate(
|
def validate(
|
||||||
schema_dict: typing.Dict, data_dict: typing.Dict, deprecated: typing.Dict[str, str]
|
schema_dict: typing.Dict, data_dict: typing.Dict, deprecated: typing.Dict[str, str]
|
||||||
) -> typing.Tuple[bool, list]:
|
) -> typing.Tuple[bool, list]:
|
||||||
|
|
||||||
"""Deep validation of dictionary in ``data_dict`` against dictionary in
|
"""Deep validation of dictionary in ``data_dict`` against dictionary in
|
||||||
``schema_dict``. Argument deprecated is a dictionary that maps deprecated
|
``schema_dict``. Argument deprecated is a dictionary that maps deprecated
|
||||||
configuration names to a messages::
|
configuration names to a messages::
|
||||||
|
@ -25,6 +25,7 @@ url = 'https://api.deezer.com/'
|
|||||||
search_url = url + 'search?{query}&index={offset}'
|
search_url = url + 'search?{query}&index={offset}'
|
||||||
iframe_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
|
iframe_src = "https://www.deezer.com/plugins/player?type=tracks&id={audioid}"
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
offset = (params['pageno'] - 1) * 25
|
offset = (params['pageno'] - 1) * 25
|
||||||
|
@ -29,6 +29,7 @@ search_url = (
|
|||||||
url + "search/text/?query={query}&page={page}&fields=name,url,download,created,description,type&token={api_key}"
|
url + "search/text/?query={query}&page={page}&fields=name,url,download,created,description,type&token={api_key}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# search request
|
# search request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
params["url"] = search_url.format(
|
params["url"] = search_url.format(
|
||||||
|
@ -79,6 +79,7 @@ main_langs = {
|
|||||||
'zh': '简体中文',
|
'zh': '简体中文',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
# translate the locale (e.g. 'en-US') to language code ('en')
|
# translate the locale (e.g. 'en-US') to language code ('en')
|
||||||
|
@ -66,14 +66,14 @@ def construct_body(result):
|
|||||||
year=result['release_year'],
|
year=result['release_year'],
|
||||||
)
|
)
|
||||||
img_src = pdbe_preview_url.format(pdb_id=result['pdb_id'])
|
img_src = pdbe_preview_url.format(pdb_id=result['pdb_id'])
|
||||||
except (KeyError):
|
except KeyError:
|
||||||
content = None
|
content = None
|
||||||
img_src = None
|
img_src = None
|
||||||
|
|
||||||
# construct url for preview image
|
# construct url for preview image
|
||||||
try:
|
try:
|
||||||
img_src = pdbe_preview_url.format(pdb_id=result['pdb_id'])
|
img_src = pdbe_preview_url.format(pdb_id=result['pdb_id'])
|
||||||
except (KeyError):
|
except KeyError:
|
||||||
img_src = None
|
img_src = None
|
||||||
|
|
||||||
return [title, content, img_src]
|
return [title, content, img_src]
|
||||||
|
@ -80,7 +80,7 @@ def response(resp):
|
|||||||
for src in definitions:
|
for src in definitions:
|
||||||
infobox += f"<div><small>{src[0]}</small>"
|
infobox += f"<div><small>{src[0]}</small>"
|
||||||
infobox += "<ul>"
|
infobox += "<ul>"
|
||||||
for (def_text, sub_def) in src[1]:
|
for def_text, sub_def in src[1]:
|
||||||
infobox += f"<li>{def_text}</li>"
|
infobox += f"<li>{def_text}</li>"
|
||||||
if sub_def:
|
if sub_def:
|
||||||
infobox += "<ol>"
|
infobox += "<ol>"
|
||||||
|
@ -29,6 +29,7 @@ api_client_secret = None
|
|||||||
url = 'https://api.spotify.com/'
|
url = 'https://api.spotify.com/'
|
||||||
search_url = url + 'v1/search?{query}&type=track&offset={offset}'
|
search_url = url + 'v1/search?{query}&type=track&offset={offset}'
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
offset = (params['pageno'] - 1) * 20
|
offset = (params['pageno'] - 1) * 20
|
||||||
|
@ -31,6 +31,7 @@ paging = True
|
|||||||
url = 'https://music.yandex.ru'
|
url = 'https://music.yandex.ru'
|
||||||
search_url = url + '/handlers/music-search.jsx'
|
search_url = url + '/handlers/music-search.jsx'
|
||||||
|
|
||||||
|
|
||||||
# do search-request
|
# do search-request
|
||||||
def request(query, params):
|
def request(query, params):
|
||||||
args = {'text': query, 'page': params['pageno'] - 1}
|
args = {'text': query, 'page': params['pageno'] - 1}
|
||||||
|
@ -22,7 +22,7 @@ _url_fields = ['iframe_src', 'audio_src']
|
|||||||
|
|
||||||
def on_result(request, search, result):
|
def on_result(request, search, result):
|
||||||
|
|
||||||
for (pattern, replacement) in replacements.items():
|
for pattern, replacement in replacements.items():
|
||||||
|
|
||||||
if parsed in result:
|
if parsed in result:
|
||||||
if pattern.search(result[parsed].netloc):
|
if pattern.search(result[parsed].netloc):
|
||||||
|
@ -39,7 +39,6 @@ MAP_STR2BOOL: Dict[str, bool] = OrderedDict(
|
|||||||
|
|
||||||
|
|
||||||
class ValidationException(Exception):
|
class ValidationException(Exception):
|
||||||
|
|
||||||
"""Exption from ``cls.__init__`` when configuration value is invalid."""
|
"""Exption from ``cls.__init__`` when configuration value is invalid."""
|
||||||
|
|
||||||
|
|
||||||
|
@ -32,7 +32,6 @@ def iso4217_to_name(iso4217, language):
|
|||||||
|
|
||||||
|
|
||||||
class OnlineCurrencyProcessor(OnlineProcessor):
|
class OnlineCurrencyProcessor(OnlineProcessor):
|
||||||
|
|
||||||
"""Processor class used by ``online_currency`` engines."""
|
"""Processor class used by ``online_currency`` engines."""
|
||||||
|
|
||||||
engine_type = 'online_currency'
|
engine_type = 'online_currency'
|
||||||
|
@ -14,7 +14,6 @@ along with searx. If not, see < http://www.gnu.org/licenses/ >.
|
|||||||
|
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
from searx.engines import command as command_engine
|
from searx.engines import command as command_engine
|
||||||
from tests import SearxTestCase
|
from tests import SearxTestCase
|
||||||
|
|
||||||
|
@ -207,7 +207,9 @@ class TestXPathUtils(SearxTestCase):
|
|||||||
l = utils.detect_language('The quick brown fox jumps over\nthe lazy dog')
|
l = utils.detect_language('The quick brown fox jumps over\nthe lazy dog')
|
||||||
self.assertEqual(l, 'en')
|
self.assertEqual(l, 'en')
|
||||||
|
|
||||||
l = utils.detect_language('いろはにほへと ちりぬるを わかよたれそ つねならむ うゐのおくやま けふこえて あさきゆめみし ゑひもせす')
|
l = utils.detect_language(
|
||||||
|
'いろはにほへと ちりぬるを わかよたれそ つねならむ うゐのおくやま けふこえて あさきゆめみし ゑひもせす'
|
||||||
|
)
|
||||||
self.assertEqual(l, 'ja')
|
self.assertEqual(l, 'ja')
|
||||||
|
|
||||||
l = utils.detect_language('Pijamalı hasta yağız şoföre çabucak güvendi.')
|
l = utils.detect_language('Pijamalı hasta yağız şoföre çabucak güvendi.')
|
||||||
|
Loading…
Reference in New Issue
Block a user