[fix] spelling

This commit is contained in:
jazzzooo 2023-09-15 00:53:03 -07:00 committed by MatthieuBarbu
parent ad518f41f6
commit b6316020f7
50 changed files with 98 additions and 98 deletions

View File

@ -190,7 +190,7 @@ Debian:
Apache modules Apache modules
-------------- --------------
To load additional modules, in most distributions you have to un-comment the To load additional modules, in most distributions you have to uncomment the
lines with the corresponding LoadModule_ directive, except in :ref:`Debian's lines with the corresponding LoadModule_ directive, except in :ref:`Debian's
Apache layout`. Apache layout`.

View File

@ -87,8 +87,8 @@ For a more detailed description, see :ref:`settings engine` in the :ref:`settin
Overrides Overrides
--------- ---------
A few of the options have default values in the namespace of engine's python A few of the options have default values in the namespace of the engine's python
modul, but are often overwritten by the settings. If ``None`` is assigned to an module, but are often overwritten by the settings. If ``None`` is assigned to an
option in the engine file, it has to be redefined in the settings, otherwise option in the engine file, it has to be redefined in the settings, otherwise
SearXNG will not start with that engine (global names with a leading underline can SearXNG will not start with that engine (global names with a leading underline can
be ``None``). be ``None``).

View File

@ -259,7 +259,7 @@ modify (:ref:`make themes`)::
``make format.python`` ``make format.python``
====================== ======================
Format Python sourcee code using `Black code style`_. See ``$BLACK_OPTIONS`` Format Python source code using `Black code style`_. See ``$BLACK_OPTIONS``
and ``$BLACK_TARGETS`` in :origin:`Makefile`. and ``$BLACK_TARGETS`` in :origin:`Makefile`.
.. attention:: .. attention::

View File

@ -235,7 +235,7 @@ To refer anchors use the `ref role`_ markup:
.. admonition:: ``:ref:`` role .. admonition:: ``:ref:`` role
:class: rst-example :class: rst-example
Visist chapter :ref:`reST anchor`. Or set hyperlink text manually :ref:`foo Visit chapter :ref:`reST anchor`. Or set hyperlink text manually :ref:`foo
bar <reST anchor>`. bar <reST anchor>`.
.. _reST ordinary ref: .. _reST ordinary ref:

View File

@ -188,7 +188,7 @@ output of::
Since the path ``/share/SearXNG`` of the HOST system is wrapped into the Since the path ``/share/SearXNG`` of the HOST system is wrapped into the
container under the same name, the shown ``Makefile`` (inode ``47712402``) in container under the same name, the shown ``Makefile`` (inode ``47712402``) in
the ouput is always the identical ``/share/SearXNG/Makefile`` from the HOST the output is always the identical ``/share/SearXNG/Makefile`` from the HOST
system. In the example shown above the owner of the path in the container is system. In the example shown above the owner of the path in the container is
the ``root`` user of the container (and the timezone in the container is the ``root`` user of the container (and the timezone in the container is
different to HOST system). different to HOST system).

View File

@ -32,7 +32,7 @@ To intercept bots that get their IPs from a range of IPs, there is a
for a longer time. IPs stored in this sliding window have a maximum of for a longer time. IPs stored in this sliding window have a maximum of
:py:obj:`SUSPICIOUS_IP_MAX` accesses before they are blocked. As soon as the IP :py:obj:`SUSPICIOUS_IP_MAX` accesses before they are blocked. As soon as the IP
makes a request that is not suspicious, the sliding window for this IP is makes a request that is not suspicious, the sliding window for this IP is
droped. dropped.
.. _X-Forwarded-For: .. _X-Forwarded-For:
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For

View File

@ -71,7 +71,7 @@ LIMITER_CFG_SCHEMA = Path(__file__).parent / "limiter.toml"
"""Base configuration (schema) of the botdetection.""" """Base configuration (schema) of the botdetection."""
LIMITER_CFG = Path('/etc/searxng/limiter.toml') LIMITER_CFG = Path('/etc/searxng/limiter.toml')
"""Lokal Limiter configuration.""" """Local Limiter configuration."""
CFG_DEPRECATED = { CFG_DEPRECATED = {
# "dummy.old.foo": "config 'dummy.old.foo' exists only for tests. Don't use it in your real project config." # "dummy.old.foo": "config 'dummy.old.foo' exists only for tests. Don't use it in your real project config."

View File

@ -119,7 +119,7 @@ class Engine: # pylint: disable=too-few-public-methods
"""Remove the engine from the settings (*disabled & removed*).""" """Remove the engine from the settings (*disabled & removed*)."""
about: dict about: dict
"""Additional fileds describing the engine. """Additional fields describing the engine.
.. code:: yaml .. code:: yaml

View File

@ -92,7 +92,7 @@ def response(resp):
def fetch_traits(engine_traits: EngineTraits): def fetch_traits(engine_traits: EngineTraits):
"""Fetch languages from Archlinix-Wiki. The location of the Wiki address of a """Fetch languages from Archlinux-Wiki. The location of the Wiki address of a
language is mapped in a :py:obj:`custom field language is mapped in a :py:obj:`custom field
<searx.enginelib.traits.EngineTraits.custom>` (``wiki_netloc``). Depending <searx.enginelib.traits.EngineTraits.custom>` (``wiki_netloc``). Depending
on the location, the ``title`` argument in the request is translated. on the location, the ``title`` argument in the request is translated.
@ -128,7 +128,7 @@ def fetch_traits(engine_traits: EngineTraits):
resp = get('https://wiki.archlinux.org/') resp = get('https://wiki.archlinux.org/')
if not resp.ok: # type: ignore if not resp.ok: # type: ignore
print("ERROR: response from wiki.archlinix.org is not OK.") print("ERROR: response from wiki.archlinux.org is not OK.")
dom = lxml.html.fromstring(resp.text) # type: ignore dom = lxml.html.fromstring(resp.text) # type: ignore
for a in eval_xpath_list(dom, "//a[@class='interlanguage-link-target']"): for a in eval_xpath_list(dom, "//a[@class='interlanguage-link-target']"):

View File

@ -138,7 +138,7 @@ def fetch_traits(engine_traits: EngineTraits):
The :py:obj:`description <searx.engines.bing_news.bing_traits_url>` of the The :py:obj:`description <searx.engines.bing_news.bing_traits_url>` of the
first table says *"query parameter when calling the Video Search API."* first table says *"query parameter when calling the Video Search API."*
.. thats why I use the 4. table "News Category API markets" for the .. that's why I use the 4. table "News Category API markets" for the
``xpath_market_codes``. ``xpath_market_codes``.
""" """

View File

@ -37,7 +37,7 @@ Brave regions
============= =============
Brave uses two-digit tags for the regions like ``ca`` while SearXNG deals with Brave uses two-digit tags for the regions like ``ca`` while SearXNG deals with
locales. To get a mapping, all *officatl de-facto* languages of the Brave locales. To get a mapping, all *officiat de-facto* languages of the Brave
region are mapped to regions in SearXNG (see :py:obj:`babel region are mapped to regions in SearXNG (see :py:obj:`babel
<babel.languages.get_official_languages>`): <babel.languages.get_official_languages>`):
@ -63,10 +63,10 @@ region are mapped to regions in SearXNG (see :py:obj:`babel
Brave languages Brave languages
=============== ===============
Brave's language support is limited to the UI (menues, area local notations, Brave's language support is limited to the UI (menus, area local notations,
etc). Brave's index only seems to support a locale, but it does not seem to etc). Brave's index only seems to support a locale, but it does not seem to
support any languages in its index. The choice of available languages is very support any languages in its index. The choice of available languages is very
small (and its not clear to me where the differencee in UI is when switching small (and its not clear to me where the difference in UI is when switching
from en-us to en-ca or en-gb). from en-us to en-ca or en-gb).
In the :py:obj:`EngineTraits object <searx.enginelib.traits.EngineTraits>` the In the :py:obj:`EngineTraits object <searx.enginelib.traits.EngineTraits>` the
@ -264,7 +264,7 @@ def _parse_search(resp):
) )
if video_tag is not None: if video_tag is not None:
# In my tests a video tag in the WEB search was mostoften not a # In my tests a video tag in the WEB search was most often not a
# video, except the ones from youtube .. # video, except the ones from youtube ..
iframe_src = _get_iframe_src(url) iframe_src = _get_iframe_src(url)
@ -405,7 +405,7 @@ def fetch_traits(engine_traits: EngineTraits):
# country_name = extract_text(flag.xpath('./following-sibling::*')[0]) # country_name = extract_text(flag.xpath('./following-sibling::*')[0])
country_tag = re.search(r'flag-([^\s]*)\s', flag.xpath('./@class')[0]).group(1) # type: ignore country_tag = re.search(r'flag-([^\s]*)\s', flag.xpath('./@class')[0]).group(1) # type: ignore
# add offical languages of the country .. # add official languages of the country ..
for lang_tag in babel.languages.get_official_languages(country_tag, de_facto=True): for lang_tag in babel.languages.get_official_languages(country_tag, de_facto=True):
lang_tag = lang_map.get(lang_tag, lang_tag) lang_tag = lang_map.get(lang_tag, lang_tag)
sxng_tag = region_tag(babel.Locale.parse('%s_%s' % (lang_tag, country_tag.upper()))) sxng_tag = region_tag(babel.Locale.parse('%s_%s' % (lang_tag, country_tag.upper())))

View File

@ -67,11 +67,11 @@ or ``time``.
.. hint:: .. hint::
When *time_range* is activate, the results always orderd by ``time``. When *time_range* is activate, the results always ordered by ``time``.
""" """
bt4g_category = 'all' bt4g_category = 'all'
"""BT$G offers categoies: ``all`` (default), ``audio``, ``movie``, ``doc``, """BT$G offers categories: ``all`` (default), ``audio``, ``movie``, ``doc``,
``app`` and `` other``. ``app`` and `` other``.
""" """

View File

@ -105,7 +105,7 @@ def get_vqd(query):
def get_ddg_lang(eng_traits: EngineTraits, sxng_locale, default='en_US'): def get_ddg_lang(eng_traits: EngineTraits, sxng_locale, default='en_US'):
"""Get DuckDuckGo's language identifier from SearXNG's locale. """Get DuckDuckGo's language identifier from SearXNG's locale.
DuckDuckGo defines its lanaguages by region codes (see DuckDuckGo defines its languages by region codes (see
:py:obj:`fetch_traits`). :py:obj:`fetch_traits`).
To get region and language of a DDG service use: To get region and language of a DDG service use:
@ -338,7 +338,7 @@ def fetch_traits(engine_traits: EngineTraits):
``Accept-Language`` HTTP header. The value in ``engine_traits.all_locale`` ``Accept-Language`` HTTP header. The value in ``engine_traits.all_locale``
is ``wt-wt`` (the region). is ``wt-wt`` (the region).
Beside regions DuckDuckGo also defines its lanaguages by region codes. By Beside regions DuckDuckGo also defines its languages by region codes. By
example these are the english languages in DuckDuckGo: example these are the english languages in DuckDuckGo:
- en_US - en_US

View File

@ -22,7 +22,7 @@ import babel.core
import babel.languages import babel.languages
from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex from searx.utils import extract_text, eval_xpath, eval_xpath_list, eval_xpath_getindex
from searx.locales import language_tag, region_tag, get_offical_locales from searx.locales import language_tag, region_tag, get_official_locales
from searx.network import get # see https://github.com/searxng/searxng/issues/762 from searx.network import get # see https://github.com/searxng/searxng/issues/762
from searx.exceptions import SearxEngineCaptchaException from searx.exceptions import SearxEngineCaptchaException
from searx.enginelib.traits import EngineTraits from searx.enginelib.traits import EngineTraits
@ -184,8 +184,8 @@ def get_google_info(params, eng_traits):
# #
# To select 'all' languages an empty 'lr' value is used. # To select 'all' languages an empty 'lr' value is used.
# #
# Different to other google services, Google Schloar supports to select more # Different to other google services, Google Scholar supports to select more
# than one language. The languages are seperated by a pipe '|' (logical OR). # than one language. The languages are separated by a pipe '|' (logical OR).
# By example: &lr=lang_zh-TW%7Clang_de selects articles written in # By example: &lr=lang_zh-TW%7Clang_de selects articles written in
# traditional chinese OR german language. # traditional chinese OR german language.
@ -204,7 +204,7 @@ def get_google_info(params, eng_traits):
if len(sxng_locale.split('-')) > 1: if len(sxng_locale.split('-')) > 1:
ret_val['params']['cr'] = 'country' + country ret_val['params']['cr'] = 'country' + country
# gl parameter: (mandatory by Geeogle News) # gl parameter: (mandatory by Google News)
# The gl parameter value is a two-letter country code. For WebSearch # The gl parameter value is a two-letter country code. For WebSearch
# results, the gl parameter boosts search results whose country of origin # results, the gl parameter boosts search results whose country of origin
# matches the parameter value. See the Country Codes section for a list of # matches the parameter value. See the Country Codes section for a list of
@ -465,7 +465,7 @@ def fetch_traits(engine_traits: EngineTraits, add_domains: bool = True):
engine_traits.all_locale = 'ZZ' engine_traits.all_locale = 'ZZ'
continue continue
sxng_locales = get_offical_locales(eng_country, engine_traits.languages.keys(), regional=True) sxng_locales = get_official_locales(eng_country, engine_traits.languages.keys(), regional=True)
if not sxng_locales: if not sxng_locales:
print("ERROR: can't map from google country %s (%s) to a babel region." % (x.get('data-name'), eng_country)) print("ERROR: can't map from google country %s (%s) to a babel region." % (x.get('data-name'), eng_country))

View File

@ -72,7 +72,7 @@ time_range_support = False
# Google-News results are always *SafeSearch*. Option 'safesearch' is set to # Google-News results are always *SafeSearch*. Option 'safesearch' is set to
# False here, otherwise checker will report safesearch-errors:: # False here, otherwise checker will report safesearch-errors::
# #
# safesearch : results are identitical for safesearch=0 and safesearch=2 # safesearch : results are identical for safesearch=0 and safesearch=2
safesearch = True safesearch = True
# send_accept_language_header = True # send_accept_language_header = True
@ -155,7 +155,7 @@ def response(resp):
title = extract_text(eval_xpath(result, './article/h3[1]')) title = extract_text(eval_xpath(result, './article/h3[1]'))
# The pub_date is mostly a string like 'yesertday', not a real # The pub_date is mostly a string like 'yesterday', not a real
# timezone date or time. Therefore we can't use publishedDate. # timezone date or time. Therefore we can't use publishedDate.
pub_date = extract_text(eval_xpath(result, './article//time')) pub_date = extract_text(eval_xpath(result, './article//time'))
pub_origin = extract_text(eval_xpath(result, './article//a[@data-n-tid]')) pub_origin = extract_text(eval_xpath(result, './article//a[@data-n-tid]'))

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Odysee_ is a decentralised video hosting platform. """Odysee_ is a decentralized video hosting platform.
.. _Odysee: https://github.com/OdyseeTeam/odysee-frontend .. _Odysee: https://github.com/OdyseeTeam/odysee-frontend
""" """

View File

@ -162,7 +162,7 @@ def response(resp):
} }
) )
# simplify the code below: make sure extratags is a dictionnary # simplify the code below: make sure extratags is a dictionary
for result in nominatim_json: for result in nominatim_json:
if not isinstance(result.get('extratags'), dict): if not isinstance(result.get('extratags'), dict):
result["extratags"] = {} result["extratags"] = {}
@ -445,7 +445,7 @@ def get_key_label(key_name, lang):
if key_name.startswith('currency:'): if key_name.startswith('currency:'):
# currency:EUR --> get the name from the CURRENCIES variable # currency:EUR --> get the name from the CURRENCIES variable
# see https://wiki.openstreetmap.org/wiki/Key%3Acurrency # see https://wiki.openstreetmap.org/wiki/Key%3Acurrency
# and for exampe https://taginfo.openstreetmap.org/keys/currency:EUR#values # and for example https://taginfo.openstreetmap.org/keys/currency:EUR#values
# but there is also currency=EUR (currently not handled) # but there is also currency=EUR (currently not handled)
# https://taginfo.openstreetmap.org/keys/currency#values # https://taginfo.openstreetmap.org/keys/currency#values
currency = key_name.split(':') currency = key_name.split(':')

View File

@ -72,7 +72,7 @@ paging = True
backend_url: list | str = "https://pipedapi.kavin.rocks" backend_url: list | str = "https://pipedapi.kavin.rocks"
"""Piped-Backend_: The core component behind Piped. The value is an URL or a """Piped-Backend_: The core component behind Piped. The value is an URL or a
list of URLs. In the latter case instance will be selected randomly. For a list of URLs. In the latter case instance will be selected randomly. For a
complete list of offical instances see Piped-Instances (`JSON complete list of official instances see Piped-Instances (`JSON
<https://piped-instances.kavin.rocks/>`__) <https://piped-instances.kavin.rocks/>`__)
.. _Piped-Instances: https://github.com/TeamPiped/Piped/wiki/Instances .. _Piped-Instances: https://github.com/TeamPiped/Piped/wiki/Instances

View File

@ -76,7 +76,7 @@ about = {
categories = [] categories = []
paging = True paging = True
qwant_categ = None qwant_categ = None
"""One of ``web``, ``news``, ``images`` or ``videos``""" """One of ``web-lite`` (or ``web``), ``news``, ``images`` or ``videos``"""
safesearch = True safesearch = True
# safe_search_map = {0: '&safesearch=0', 1: '&safesearch=1', 2: '&safesearch=2'} # safe_search_map = {0: '&safesearch=0', 1: '&safesearch=1', 2: '&safesearch=2'}

View File

@ -10,7 +10,7 @@ Example
To demonstrate the power of database engines, here is a more complex example To demonstrate the power of database engines, here is a more complex example
which reads from a MediathekView_ (DE) movie database. For this example of the which reads from a MediathekView_ (DE) movie database. For this example of the
SQlite engine download the database: SQLite engine download the database:
- https://liste.mediathekview.de/filmliste-v2.db.bz2 - https://liste.mediathekview.de/filmliste-v2.db.bz2

View File

@ -23,7 +23,7 @@ The engine has the following settings:
Prowlarr-categories_ or Jackett-categories_ for more information. Prowlarr-categories_ or Jackett-categories_ for more information.
``show_torrent_files``: ``show_torrent_files``:
Whether to show the torrent file in the search results. Be carful as using Whether to show the torrent file in the search results. Be careful as using
this with Prowlarr_ or Jackett_ leaks the API key. This should be used only this with Prowlarr_ or Jackett_ leaks the API key. This should be used only
if you are querying a Torznab endpoint without authentication or if the if you are querying a Torznab endpoint without authentication or if the
instance is private. Be aware that private trackers may ban you if you share instance is private. Be aware that private trackers may ban you if you share

View File

@ -287,7 +287,7 @@ def get_results(attribute_result, attributes, language):
elif attribute_type == WDGeoAttribute: elif attribute_type == WDGeoAttribute:
# geocoordinate link # geocoordinate link
# use the area to get the OSM zoom # use the area to get the OSM zoom
# Note: ignre the unit (must be km² otherwise the calculation is wrong) # Note: ignore the unit (must be km² otherwise the calculation is wrong)
# Should use normalized value p:P2046/psn:P2046/wikibase:quantityAmount # Should use normalized value p:P2046/psn:P2046/wikibase:quantityAmount
area = attribute_result.get('P2046') area = attribute_result.get('P2046')
osm_zoom = area_to_osm_zoom(area) if area else 19 osm_zoom = area_to_osm_zoom(area) if area else 19

View File

@ -86,7 +86,7 @@ Replacements are:
Search terms from user. Search terms from user.
``{pageno}``: ``{pageno}``:
Page number if engine supports pagging :py:obj:`paging` Page number if engine supports paging :py:obj:`paging`
``{lang}``: ``{lang}``:
ISO 639-1 language code (en, de, fr ..) ISO 639-1 language code (en, de, fr ..)

View File

@ -12,7 +12,7 @@ class SearxException(Exception):
class SearxParameterException(SearxException): class SearxParameterException(SearxException):
"""Raised when query miss a required paramater""" """Raised when query miss a required parameter"""
def __init__(self, name, value): def __init__(self, name, value):
if value == '' or value is None: if value == '' or value is None:

View File

@ -55,7 +55,7 @@ class InfoPage:
@cached_property @cached_property
def content(self): def content(self):
"""Content of the page (rendered in a Jinja conntext)""" """Content of the page (rendered in a Jinja context)"""
ctx = self.get_ctx() ctx = self.get_ctx()
template = jinja2.Environment().from_string(self.raw_content) template = jinja2.Environment().from_string(self.raw_content)
return template.render(**ctx) return template.render(**ctx)
@ -119,7 +119,7 @@ class InfoPageSet: # pylint: disable=too-few-public-methods
): ):
self.page_class = page_class or InfoPage self.page_class = page_class or InfoPage
self.folder: str = info_folder or _INFO_FOLDER self.folder: str = info_folder or _INFO_FOLDER
"""location of the Markdwon files""" """location of the Markdown files"""
self.CACHE: typing.Dict[tuple, typing.Optional[InfoPage]] = {} self.CACHE: typing.Dict[tuple, typing.Optional[InfoPage]] = {}

View File

@ -118,8 +118,8 @@ def _get_locale_descr(locale, language_code):
language_name = locale.get_language_name(language_code).capitalize() language_name = locale.get_language_name(language_code).capitalize()
if language_name and ('a' <= language_name[0] <= 'z'): if language_name and ('a' <= language_name[0] <= 'z'):
language_name = language_name.capitalize() language_name = language_name.capitalize()
terrirtory_name = locale.get_territory_name(language_code) territory_name = locale.get_territory_name(language_code)
return language_name, terrirtory_name return language_name, territory_name
def locales_initialize(directory=None): def locales_initialize(directory=None):
@ -188,7 +188,7 @@ def get_locale(locale_tag: str) -> Optional[babel.Locale]:
return None return None
def get_offical_locales( def get_official_locales(
territory: str, languages=None, regional: bool = False, de_facto: bool = True territory: str, languages=None, regional: bool = False, de_facto: bool = True
) -> Set[babel.Locale]: ) -> Set[babel.Locale]:
"""Returns a list of :py:obj:`babel.Locale` with languages from """Returns a list of :py:obj:`babel.Locale` with languages from
@ -262,20 +262,20 @@ def get_engine_locale(searxng_locale, engine_locales, default=None):
the selected language. the selected language.
B. When user select a language and a territory the results should be B. When user select a language and a territory the results should be
optimized with first priority on terrirtory and second on language. optimized with first priority on territory and second on language.
First approximation rule (*by territory*): First approximation rule (*by territory*):
When the user selects a locale with terrirtory (and a language), the When the user selects a locale with territory (and a language), the
territory has priority over the language. If any of the offical languages territory has priority over the language. If any of the official languages
in the terrirtory is supported by the engine (``engine_locales``) it will in the territory is supported by the engine (``engine_locales``) it will
be used. be used.
Second approximation rule (*by language*): Second approximation rule (*by language*):
If "First approximation rule" brings no result or the user selects only a If "First approximation rule" brings no result or the user selects only a
language without a terrirtory. Check in which territories the language language without a territory. Check in which territories the language
has an offical status and if one of these territories is supported by the has an official status and if one of these territories is supported by the
engine. engine.
""" """
@ -305,7 +305,7 @@ def get_engine_locale(searxng_locale, engine_locales, default=None):
# SearXNG's selected locale is not supported by the engine .. # SearXNG's selected locale is not supported by the engine ..
if locale.territory: if locale.territory:
# Try to narrow by *offical* languages in the territory (??-XX). # Try to narrow by *official* languages in the territory (??-XX).
for official_language in babel.languages.get_official_languages(locale.territory, de_facto=True): for official_language in babel.languages.get_official_languages(locale.territory, de_facto=True):
searxng_locale = official_language + '-' + locale.territory searxng_locale = official_language + '-' + locale.territory
@ -313,11 +313,11 @@ def get_engine_locale(searxng_locale, engine_locales, default=None):
if engine_locale is not None: if engine_locale is not None:
return engine_locale return engine_locale
# Engine does not support one of the offical languages in the territory or # Engine does not support one of the official languages in the territory or
# there is only a language selected without a territory. # there is only a language selected without a territory.
# Now lets have a look if the searxng_lang (the language selected by the # Now lets have a look if the searxng_lang (the language selected by the
# user) is a offical language in other territories. If so, check if # user) is a official language in other territories. If so, check if
# engine does support the searxng_lang in this other territory. # engine does support the searxng_lang in this other territory.
if locale.language: if locale.language:
@ -343,10 +343,10 @@ def get_engine_locale(searxng_locale, engine_locales, default=None):
# second: sort by population_percent and take first match # second: sort by population_percent and take first match
# drawback of "population percent": if there is a terrirtory with a # drawback of "population percent": if there is a territory with a
# small number of people (e.g 100) but the majority speaks the # small number of people (e.g 100) but the majority speaks the
# language, then the percentage migth be 100% (--> 100 people) but in # language, then the percentage might be 100% (--> 100 people) but in
# a different terrirtory with more people (e.g. 10.000) where only 10% # a different territory with more people (e.g. 10.000) where only 10%
# speak the language the total amount of speaker is higher (--> 200 # speak the language the total amount of speaker is higher (--> 200
# people). # people).
# #

View File

@ -152,19 +152,19 @@ def get_reliabilities(engline_name_list, checker_results):
errors = engine_errors.get(engine_name) or [] errors = engine_errors.get(engine_name) or []
if counter('engine', engine_name, 'search', 'count', 'sent') == 0: if counter('engine', engine_name, 'search', 'count', 'sent') == 0:
# no request # no request
reliablity = None reliability = None
elif checker_success and not errors: elif checker_success and not errors:
reliablity = 100 reliability = 100
elif 'simple' in checker_result.get('errors', {}): elif 'simple' in checker_result.get('errors', {}):
# the basic (simple) test doesn't work: the engine is broken accoding to the checker # the basic (simple) test doesn't work: the engine is broken according to the checker
# even if there is no exception # even if there is no exception
reliablity = 0 reliability = 0
else: else:
# pylint: disable=consider-using-generator # pylint: disable=consider-using-generator
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')]) reliability = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
reliabilities[engine_name] = { reliabilities[engine_name] = {
'reliablity': reliablity, 'reliability': reliability,
'errors': errors, 'errors': errors,
'checker': checker_results.get(engine_name, {}).get('errors', {}), 'checker': checker_results.get(engine_name, {}).get('errors', {}),
} }

View File

@ -78,7 +78,7 @@ def _get_timeout(start_time, kwargs):
# 2 minutes timeout for the requests without timeout # 2 minutes timeout for the requests without timeout
timeout = timeout or 120 timeout = timeout or 120
# ajdust actual timeout # adjust actual timeout
timeout += 0.2 # overhead timeout += 0.2 # overhead
if start_time: if start_time:
timeout -= default_timer() - start_time timeout -= default_timer() - start_time

View File

@ -166,7 +166,7 @@ def load_plugin(plugin_module_name, external):
# searx compatibility: plugin.name in settings['enabled_plugins'] # searx compatibility: plugin.name in settings['enabled_plugins']
plugin.default_on = plugin.name in settings["enabled_plugins"] or plugin.id in settings["enabled_plugins"] plugin.default_on = plugin.name in settings["enabled_plugins"] or plugin.id in settings["enabled_plugins"]
# copy ressources if this is an external plugin # copy resources if this is an external plugin
if external: if external:
prepare_package_resources(plugin, plugin_module_name) prepare_package_resources(plugin, plugin_module_name)

View File

@ -77,7 +77,7 @@ def secret_hash(name: str):
"""Creates a hash of the ``name``. """Creates a hash of the ``name``.
Combines argument ``name`` with the ``secret_key`` from :ref:`settings Combines argument ``name`` with the ``secret_key`` from :ref:`settings
server`. This function can be used to get a more anonymised name of a Redis server`. This function can be used to get a more anonymized name of a Redis
KEY. KEY.
:param name: the name to create a secret hash for :param name: the name to create a secret hash for
@ -205,7 +205,7 @@ def incr_sliding_window(client, name: str, duration: int):
minus *duration* time (ZREMRANGEBYSCORE_). minus *duration* time (ZREMRANGEBYSCORE_).
The EXPIRE_ time (the duration of the sliding window) is refreshed on each The EXPIRE_ time (the duration of the sliding window) is refreshed on each
call (incrementation) and if there is no call in this duration, the sorted call (increment) and if there is no call in this duration, the sorted
set expires from the redis DB. set expires from the redis DB.
The return value is the amount of items in the sorted set (ZCOUNT_), what The return value is the amount of items in the sorted set (ZCOUNT_), what

View File

@ -89,7 +89,7 @@ class Search:
# max of all selected engine timeout # max of all selected engine timeout
default_timeout = 0 default_timeout = 0
# start search-reqest for all selected engines # start search-request for all selected engines
for engineref in self.search_query.engineref_list: for engineref in self.search_query.engineref_list:
processor = PROCESSORS[engineref.name] processor = PROCESSORS[engineref.name]

View File

@ -347,7 +347,7 @@ class CheckerTests:
diff2_str = ', '.join(['{}={!r}'.format(k, v2) for (k, (v1, v2)) in diff.items()]) diff2_str = ', '.join(['{}={!r}'.format(k, v2) for (k, (v1, v2)) in diff.items()])
self.test_results.add_error( self.test_results.add_error(
self.test_name, self.test_name,
'results are identitical for {} and {} ({})'.format(diff1_str, diff2_str, common_str), 'results are identical for {} and {} ({})'.format(diff1_str, diff2_str, common_str),
) )

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Implement request processores used by engine-types. """Implement request processors used by engine-types.
""" """
@ -30,7 +30,7 @@ from .abstract import EngineProcessor
logger = logger.getChild('search.processors') logger = logger.getChild('search.processors')
PROCESSORS: Dict[str, EngineProcessor] = {} PROCESSORS: Dict[str, EngineProcessor] = {}
"""Cache request processores, stored by *engine-name* (:py:func:`initialize`) """Cache request processors, stored by *engine-name* (:py:func:`initialize`)
:meta hide-value: :meta hide-value:
""" """

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Abstract base classes for engine request processores. """Abstract base classes for engine request processors.
""" """
@ -58,7 +58,7 @@ class SuspendedStatus:
class EngineProcessor(ABC): class EngineProcessor(ABC):
"""Base classes used for all types of reqest processores.""" """Base classes used for all types of request processors."""
__slots__ = 'engine', 'engine_name', 'lock', 'suspended_status', 'logger' __slots__ = 'engine', 'engine_name', 'lock', 'suspended_status', 'logger'
@ -165,7 +165,7 @@ class EngineProcessor(ABC):
# deprecated / vintage --> use params['searxng_locale'] # deprecated / vintage --> use params['searxng_locale']
# #
# Conditions related to engine's traits are implemented in engine.traits # Conditions related to engine's traits are implemented in engine.traits
# module. Don't do 'locale' decissions here in the abstract layer of the # module. Don't do 'locale' decisions here in the abstract layer of the
# search processor, just pass the value from user's choice unchanged to # search processor, just pass the value from user's choice unchanged to
# the engine request. # the engine request.

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Processores for engine-type: ``offline`` """Processors for engine-type: ``offline``
""" """

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Processores for engine-type: ``online`` """Processors for engine-type: ``online``
""" """
# pylint: disable=use-dict-literal # pylint: disable=use-dict-literal

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Processores for engine-type: ``online_currency`` """Processors for engine-type: ``online_currency``
""" """

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Processores for engine-type: ``online_dictionary`` """Processors for engine-type: ``online_dictionary``
""" """

View File

@ -1,6 +1,6 @@
# SPDX-License-Identifier: AGPL-3.0-or-later # SPDX-License-Identifier: AGPL-3.0-or-later
# lint: pylint # lint: pylint
"""Processores for engine-type: ``online_url_search`` """Processors for engine-type: ``online_url_search``
""" """

View File

@ -47,7 +47,7 @@ def get_user_settings_path() -> Optional[str]:
if 'SEARXNG_SETTINGS_PATH' in environ: if 'SEARXNG_SETTINGS_PATH' in environ:
return existing_filename_or_none(environ['SEARXNG_SETTINGS_PATH']) return existing_filename_or_none(environ['SEARXNG_SETTINGS_PATH'])
# if SEARXNG_DISABLE_ETC_SETTINGS don't look any futher # if SEARXNG_DISABLE_ETC_SETTINGS don't look any further
if environ.get('SEARXNG_DISABLE_ETC_SETTINGS', '').lower() in ('1', 'true'): if environ.get('SEARXNG_DISABLE_ETC_SETTINGS', '').lower() in ('1', 'true'):
return None return None

View File

@ -108,7 +108,7 @@
{%- endmacro -%} {%- endmacro -%}
{%- macro engine_reliability(engine_name) -%} {%- macro engine_reliability(engine_name) -%}
{%- set r = reliabilities.get(engine_name, {}).get('reliablity', None) -%} {%- set r = reliabilities.get(engine_name, {}).get('reliability', None) -%}
{%- set checker_result = reliabilities.get(engine_name, {}).get('checker', []) -%} {%- set checker_result = reliabilities.get(engine_name, {}).get('checker', []) -%}
{%- set errors = reliabilities.get(engine_name, {}).get('errors', []) -%} {%- set errors = reliabilities.get(engine_name, {}).get('errors', []) -%}
{%- if r != None -%} {%- if r != None -%}

View File

@ -82,7 +82,7 @@
</div> </div>
{%- endif -%} {%- endif -%}
</td> </td>
<td class="engine-reliability"> {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }}</td> <td class="engine-reliability"> {{ engine_reliabilities.get(engine_stat.name, {}).get('reliability') }}</td>
</tr> </tr>
{% endfor %} {% endfor %}
</table> </table>

View File

@ -543,7 +543,7 @@ def eval_xpath_list(element: ElementBase, xpath_spec: XPathSpecType, min_len: Op
def eval_xpath_getindex(elements: ElementBase, xpath_spec: XPathSpecType, index: int, default=_NOTSET): def eval_xpath_getindex(elements: ElementBase, xpath_spec: XPathSpecType, index: int, default=_NOTSET):
"""Call eval_xpath_list then get one element using the index parameter. """Call eval_xpath_list then get one element using the index parameter.
If the index does not exist, either aise an exception is default is not set, If the index does not exist, either raise an exception is default is not set,
other return the default value (can be None). other return the default value (can be None).
Args: Args:
@ -628,7 +628,7 @@ def detect_language(text: str, threshold: float = 0.3, only_search_languages: bo
b. Most of SearXNG's engines do not support all the languages from `language b. Most of SearXNG's engines do not support all the languages from `language
identification model`_ and there is also a discrepancy in the ISO-639-3 identification model`_ and there is also a discrepancy in the ISO-639-3
(fastext) and ISO-639-2 (SearXNG)handling. Further more, in SearXNG the (fasttext) and ISO-639-2 (SearXNG)handling. Further more, in SearXNG the
locales like ``zh-TH`` (``zh-CN``) are mapped to ``zh_Hant`` locales like ``zh-TH`` (``zh-CN``) are mapped to ``zh_Hant``
(``zh_Hans``) while the `language identification model`_ reduce both to (``zh_Hans``) while the `language identification model`_ reduce both to
``zh``. ``zh``.
@ -681,7 +681,7 @@ def js_variable_to_python(js_variable):
# here, inside a JS string, we escape the double quote # here, inside a JS string, we escape the double quote
parts[i] = parts[i].replace('"', r'\"') parts[i] = parts[i].replace('"', r'\"')
# deal with delimieters and escape character # deal with delimiters and escape character
if not in_string and p in ('"', "'"): if not in_string and p in ('"', "'"):
# we are not in string # we are not in string
# but p is double or simple quote # but p is double or simple quote
@ -710,7 +710,7 @@ def js_variable_to_python(js_variable):
previous_p = p previous_p = p
# join the string # join the string
s = ''.join(parts) s = ''.join(parts)
# add quote arround the key # add quote around the key
# { a: 12 } # { a: 12 }
# becomes # becomes
# { "a": 12 } # { "a": 12 }

View File

@ -938,19 +938,19 @@ def preferences():
errors = engine_errors.get(e.name) or [] errors = engine_errors.get(e.name) or []
if counter('engine', e.name, 'search', 'count', 'sent') == 0: if counter('engine', e.name, 'search', 'count', 'sent') == 0:
# no request # no request
reliablity = None reliability = None
elif checker_success and not errors: elif checker_success and not errors:
reliablity = 100 reliability = 100
elif 'simple' in checker_result.get('errors', {}): elif 'simple' in checker_result.get('errors', {}):
# the basic (simple) test doesn't work: the engine is broken accoding to the checker # the basic (simple) test doesn't work: the engine is broken according to the checker
# even if there is no exception # even if there is no exception
reliablity = 0 reliability = 0
else: else:
# pylint: disable=consider-using-generator # pylint: disable=consider-using-generator
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')]) reliability = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
reliabilities[e.name] = { reliabilities[e.name] = {
'reliablity': reliablity, 'reliability': reliability,
'errors': [], 'errors': [],
'checker': checker_results.get(e.name, {}).get('errors', {}).keys(), 'checker': checker_results.get(e.name, {}).get('errors', {}).keys(),
} }
@ -1144,7 +1144,7 @@ def stats():
reverse, key_name, default_value = STATS_SORT_PARAMETERS[sort_order] reverse, key_name, default_value = STATS_SORT_PARAMETERS[sort_order]
def get_key(engine_stat): def get_key(engine_stat):
reliability = engine_reliabilities.get(engine_stat['name'], {}).get('reliablity', 0) reliability = engine_reliabilities.get(engine_stat['name'], {}).get('reliability', 0)
reliability_order = 0 if reliability else 1 reliability_order = 0 if reliability else 1
if key_name == 'reliability': if key_name == 'reliability':
key = reliability key = reliability

View File

@ -64,7 +64,7 @@ def _instance_infosetset_ctx(base_url):
with app.test_request_context(base_url=base_url): with app.test_request_context(base_url=base_url):
yield InfoPageSet() yield InfoPageSet()
# The searx.webapp import from above fires some HTTP requests, thats # The searx.webapp import from above fires some HTTP requests, that's
# why we get a RuntimeError:: # why we get a RuntimeError::
# #
# RuntimeError: The connection pool was closed while 1 HTTP \ # RuntimeError: The connection pool was closed while 1 HTTP \

View File

@ -62,7 +62,7 @@ def merge_when_no_leaf(node):
d -> d -> g -> <LEAF_KEY> (ddg) d -> d -> g -> <LEAF_KEY> (ddg)
-> i -> g -> <LEAF_KEY> (dig) -> i -> g -> <LEAF_KEY> (dig)
becomes (3 noodes):: becomes (3 nodes)::
d -> dg -> <LEAF_KEY> d -> dg -> <LEAF_KEY>
-> ig -> <LEAF_KEY> -> ig -> <LEAF_KEY>

View File

@ -4,7 +4,7 @@
"""Fetch OSM keys and tags. """Fetch OSM keys and tags.
To get the i18n names, the scripts uses `Wikidata Query Service`_ instead of for To get the i18n names, the scripts uses `Wikidata Query Service`_ instead of for
example `OSM tags API`_ (sidenote: the actual change log from example `OSM tags API`_ (side note: the actual change log from
map.atownsend.org.uk_ might be useful to normalize OSM tags). map.atownsend.org.uk_ might be useful to normalize OSM tags).
Output file: :origin:`searx/data/osm_keys_tags` (:origin:`CI Update data ... Output file: :origin:`searx/data/osm_keys_tags` (:origin:`CI Update data ...

View File

@ -66,7 +66,7 @@ class TestLocales(SearxTestCase):
# B. When user selects a language and a territory the results should be # B. When user selects a language and a territory the results should be
# optimized with first priority on territory and second on language. # optimized with first priority on territory and second on language.
# Assume we have an engine that supports the follwoing locales: # Assume we have an engine that supports the following locales:
locale_tag_list = ['zh-CN', 'zh-HK', 'nl-BE', 'fr-CA'] locale_tag_list = ['zh-CN', 'zh-HK', 'nl-BE', 'fr-CA']
# Examples (Assumption A.) # Examples (Assumption A.)

View File

@ -215,7 +215,7 @@ class ViewsTestCase(SearxTestCase):
'Search language ignored browser preference.', 'Search language ignored browser preference.',
) )
def test_brower_empty_locale(self): def test_browser_empty_locale(self):
result = self.app.get('/preferences', headers={'Accept-Language': ''}) result = self.app.get('/preferences', headers={'Accept-Language': ''})
self.assertEqual(result.status_code, 200) self.assertEqual(result.status_code, 200)
self.assertIn( self.assertIn(

View File

@ -10,7 +10,7 @@ from os.path import realpath, dirname, join, sep, abspath
repo_root = realpath(dirname(realpath(__file__)) + sep + '..') repo_root = realpath(dirname(realpath(__file__)) + sep + '..')
sys.path.insert(0, repo_root) sys.path.insert(0, repo_root)
# Assure that the settings file from reposetorie's working tree is used to # Assure that the settings file from repository's working tree is used to
# generate the build_env, not from /etc/searxng/settings.yml. # generate the build_env, not from /etc/searxng/settings.yml.
os.environ['SEARXNG_SETTINGS_PATH'] = join(repo_root, 'etc', 'settings.yml') os.environ['SEARXNG_SETTINGS_PATH'] = join(repo_root, 'etc', 'settings.yml')
@ -38,7 +38,7 @@ brand_env = 'utils' + sep + 'brand.env'
# Some defaults in the settings.yml are taken from the environment, # Some defaults in the settings.yml are taken from the environment,
# e.g. SEARXNG_BIND_ADDRESS (:py:obj:`searx.settings_defaults.SHEMA`). When the # e.g. SEARXNG_BIND_ADDRESS (:py:obj:`searx.settings_defaults.SHEMA`). When the
# 'brand.env' file is created these envirnoment variables should be unset first:: # 'brand.env' file is created these environment variables should be unset first::
_unset = object() _unset = object()
for name, option in name_val: for name, option in name_val: