mirror of
https://github.com/searxng/searxng.git
synced 2026-09-12 01:06:04 +00:00
fmt
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
"""BASE (Scholar publications)"""
|
||||
|
||||
from datetime import datetime
|
||||
import re
|
||||
|
||||
|
||||
@@ -83,7 +83,6 @@ from threading import Thread
|
||||
from searx import logger
|
||||
from searx.result_types import EngineResults
|
||||
|
||||
|
||||
engine_type = 'offline'
|
||||
paging = True
|
||||
command = []
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
# pylint: disable=invalid-name
|
||||
"""Dummy Offline"""
|
||||
|
||||
|
||||
# about
|
||||
about = {
|
||||
"wikidata_id": None,
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from urllib.parse import urlencode
|
||||
from dateutil import parser
|
||||
|
||||
|
||||
about = {
|
||||
# pylint: disable=line-too-long
|
||||
"website": "https://hex.pm/",
|
||||
|
||||
@@ -108,14 +108,12 @@ def get_infobox(alt_forms, result_url, definitions):
|
||||
infobox_content.append(f'<p><i>Other forms:</i> {", ".join(alt_forms[1:])}</p>')
|
||||
|
||||
# definitions
|
||||
infobox_content.append(
|
||||
'''
|
||||
infobox_content.append('''
|
||||
<small><a href="https://www.edrdg.org/wiki/index.php/JMdict-EDICT_Dictionary_Project">JMdict</a>
|
||||
and <a href="https://www.edrdg.org/enamdict/enamdict_doc.html">JMnedict</a>
|
||||
by <a href="https://www.edrdg.org/edrdg/licence.html">EDRDG</a>, CC BY-SA 3.0.</small>
|
||||
<ul>
|
||||
'''
|
||||
)
|
||||
''')
|
||||
for pos, engdef, extra in definitions:
|
||||
if pos == 'Wikipedia definition':
|
||||
infobox_content.append('</ul><small>Wikipedia, CC BY-SA 3.0.</small><ul>')
|
||||
|
||||
@@ -49,7 +49,6 @@ except ImportError:
|
||||
|
||||
from searx.result_types import EngineResults
|
||||
|
||||
|
||||
engine_type = 'offline'
|
||||
|
||||
# mongodb connection variables
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
from urllib.parse import urlencode
|
||||
from dateutil import parser
|
||||
|
||||
|
||||
about = {
|
||||
"website": "https://npms.io/",
|
||||
"wikidata_id": "Q7067518",
|
||||
|
||||
@@ -9,7 +9,6 @@ from datetime import datetime
|
||||
from searx.result_types import EngineResults, WeatherAnswer
|
||||
from searx import weather
|
||||
|
||||
|
||||
about = {
|
||||
"website": "https://open-meteo.com",
|
||||
"wikidata_id": None,
|
||||
|
||||
@@ -8,7 +8,6 @@ Openverse (formerly known as: Creative Commons search engine) [Images]
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
||||
about = {
|
||||
"website": 'https://openverse.org/',
|
||||
"wikidata_id": None,
|
||||
|
||||
@@ -12,7 +12,6 @@ from searx.enginelib import EngineCache
|
||||
from searx.exceptions import SearxEngineAPIException, SearxEngineAccessDeniedException
|
||||
from searx.network import get
|
||||
|
||||
|
||||
# about
|
||||
about = {
|
||||
"website": 'https://www.pexels.com',
|
||||
|
||||
@@ -48,7 +48,6 @@ Implementations
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import time
|
||||
import random
|
||||
from urllib.parse import urlencode
|
||||
|
||||
@@ -18,7 +18,6 @@ from searx.utils import eval_xpath_list, eval_xpath, extract_text, get_embeded_s
|
||||
from searx.locales import region_tag
|
||||
from searx.result_types import EngineResults
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from lxml.etree import ElementBase
|
||||
from searx.extended_types import SXNG_Response
|
||||
|
||||
@@ -35,6 +35,7 @@ Implementations
|
||||
===============
|
||||
|
||||
"""
|
||||
|
||||
import typing as t
|
||||
|
||||
from datetime import date, timedelta
|
||||
|
||||
@@ -34,7 +34,6 @@ from searx.exceptions import SearxEngineAPIException
|
||||
from searx.result_types import EngineResults
|
||||
from searx.extended_types import SXNG_Response
|
||||
|
||||
|
||||
base_url = 'http://localhost:8983'
|
||||
collection = ''
|
||||
rows = 10
|
||||
|
||||
@@ -117,7 +117,7 @@ def response(resp):
|
||||
|
||||
def init(engine_settings): # pylint: disable=unused-argument
|
||||
global CACHE # pylint: disable=global-statement
|
||||
CACHE = EngineCache(engine_settings["name"]) # type:ignore
|
||||
CACHE = EngineCache(engine_settings["name"]) # type: ignore
|
||||
|
||||
|
||||
def get_client_id() -> str | None:
|
||||
|
||||
@@ -44,6 +44,7 @@ Implementations
|
||||
===============
|
||||
|
||||
"""
|
||||
|
||||
import typing as t
|
||||
import sqlite3
|
||||
import contextlib
|
||||
|
||||
@@ -82,6 +82,7 @@ Startpage's category (for Web-search, News, Videos, ..) is set by
|
||||
Supported categories are ``web``, ``news`` and ``images``.
|
||||
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-statements
|
||||
|
||||
import re
|
||||
|
||||
@@ -74,7 +74,6 @@ Implementations
|
||||
===============
|
||||
"""
|
||||
|
||||
|
||||
from urllib.parse import urlencode
|
||||
from dateutil.parser import parse
|
||||
from searx.utils import html_to_text, humanize_number
|
||||
|
||||
@@ -12,7 +12,6 @@ from lxml import html
|
||||
from searx.result_types import EngineResults
|
||||
from searx.utils import eval_xpath_list, eval_xpath, extract_text
|
||||
|
||||
|
||||
if t.TYPE_CHECKING:
|
||||
from lxml.etree import ElementBase
|
||||
from searx.extended_types import SXNG_Response
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
|
||||
Some implementations are shared from :ref:`wikipedia engine`.
|
||||
"""
|
||||
|
||||
# pylint: disable=missing-class-docstring
|
||||
|
||||
import typing as t
|
||||
@@ -180,9 +181,7 @@ class WDAmountAttribute(WDAttribute):
|
||||
def get_where(self):
|
||||
return """ OPTIONAL { ?item p:{name} ?{name}Node .
|
||||
?{name}Node rdf:type wikibase:BestRank ; ps:{name} ?{name} .
|
||||
OPTIONAL { ?{name}Node psv:{name}/wikibase:quantityUnit ?{name}Unit. } }""".replace(
|
||||
'{name}', self.name
|
||||
)
|
||||
OPTIONAL { ?{name}Node psv:{name}/wikibase:quantityUnit ?{name}Unit. } }""".replace('{name}', self.name)
|
||||
|
||||
def get_group_by(self) -> str:
|
||||
return self.get_select()
|
||||
@@ -214,9 +213,7 @@ class WDArticle(WDAttribute):
|
||||
return """OPTIONAL { ?article{language} schema:about ?item ;
|
||||
schema:inLanguage "{language}" ;
|
||||
schema:isPartOf <https://{language}.wikipedia.org/> ;
|
||||
schema:name ?articleName{language} . }""".replace(
|
||||
'{language}', self.language
|
||||
)
|
||||
schema:name ?articleName{language} . }""".replace('{language}', self.language)
|
||||
|
||||
def get_group_by(self):
|
||||
return self.get_select()
|
||||
@@ -305,9 +302,7 @@ class WDGeoAttribute(WDAttribute):
|
||||
def get_where(self):
|
||||
return """OPTIONAL { ?item p:{name}/psv:{name} [
|
||||
wikibase:geoLatitude ?{name}Lat ;
|
||||
wikibase:geoLongitude ?{name}Long ] }""".replace(
|
||||
'{name}', self.name
|
||||
)
|
||||
wikibase:geoLongitude ?{name}Long ] }""".replace('{name}', self.name)
|
||||
|
||||
def get_group_by(self):
|
||||
return self.get_select()
|
||||
@@ -348,9 +343,7 @@ class WDDateAttribute(WDAttribute):
|
||||
wikibase:timePrecision ?{name}timePrecision ;
|
||||
wikibase:timeTimezone ?{name}timeZone ;
|
||||
wikibase:timeCalendarModel ?{name}timeCalendar ] . }
|
||||
hint:Prior hint:rangeSafe true;""".replace(
|
||||
'{name}', self.name
|
||||
)
|
||||
hint:Prior hint:rangeSafe true;""".replace('{name}', self.name)
|
||||
|
||||
def get_group_by(self):
|
||||
return self.get_select()
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
Wolfram|Alpha (Science)
|
||||
"""
|
||||
|
||||
|
||||
from json import loads
|
||||
from urllib.parse import urlencode
|
||||
|
||||
@@ -53,7 +52,7 @@ seconds."""
|
||||
|
||||
def init(engine_settings):
|
||||
global CACHE # pylint: disable=global-statement
|
||||
CACHE = EngineCache(engine_settings["name"]) # type:ignore
|
||||
CACHE = EngineCache(engine_settings["name"]) # type: ignore
|
||||
|
||||
|
||||
def obtain_token() -> str:
|
||||
|
||||
@@ -50,6 +50,7 @@ the engine).
|
||||
Implementations
|
||||
===============
|
||||
"""
|
||||
|
||||
# pylint: disable=fixme
|
||||
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ from lxml import html
|
||||
from searx.exceptions import SearxEngineCaptchaException
|
||||
from searx.utils import humanize_bytes, eval_xpath, eval_xpath_list, extract_text, extr
|
||||
|
||||
|
||||
# Engine metadata
|
||||
about = {
|
||||
"website": 'https://yandex.com/',
|
||||
|
||||
Reference in New Issue
Block a user