From b6316020f765dea323bfeec88c4107162fd8440c Mon Sep 17 00:00:00 2001 From: jazzzooo <38244149+jazzzooo@users.noreply.github.com> Date: Fri, 15 Sep 2023 00:53:03 -0700 Subject: [PATCH] [fix] spelling --- docs/admin/installation-apache.rst | 2 +- docs/dev/engines/engine_overview.rst | 4 +-- docs/dev/makefile.rst | 2 +- docs/dev/reST.rst | 2 +- docs/utils/lxc.sh.rst | 2 +- searx/botdetection/ip_limit.py | 2 +- searx/botdetection/limiter.py | 2 +- searx/enginelib/__init__.py | 2 +- searx/engines/archlinux.py | 4 +-- searx/engines/bing_news.py | 2 +- searx/engines/brave.py | 10 +++---- searx/engines/bt4g.py | 4 +-- searx/engines/duckduckgo.py | 4 +-- searx/engines/google.py | 10 +++---- searx/engines/google_news.py | 4 +-- searx/engines/odysee.py | 2 +- searx/engines/openstreetmap.py | 4 +-- searx/engines/piped.py | 2 +- searx/engines/qwant.py | 2 +- searx/engines/sqlite.py | 2 +- searx/engines/torznab.py | 2 +- searx/engines/wikidata.py | 2 +- searx/engines/xpath.py | 2 +- searx/exceptions.py | 2 +- searx/infopage/__init__.py | 4 +-- searx/locales.py | 30 +++++++++---------- searx/metrics/__init__.py | 12 ++++---- searx/network/__init__.py | 2 +- searx/plugins/__init__.py | 2 +- searx/redislib.py | 4 +-- searx/search/__init__.py | 2 +- searx/search/checker/impl.py | 2 +- searx/search/processors/__init__.py | 4 +-- searx/search/processors/abstract.py | 6 ++-- searx/search/processors/offline.py | 2 +- searx/search/processors/online.py | 2 +- searx/search/processors/online_currency.py | 2 +- searx/search/processors/online_dictionary.py | 2 +- searx/search/processors/online_url_search.py | 2 +- searx/settings_loader.py | 2 +- searx/templates/simple/preferences.html | 2 +- searx/templates/simple/stats.html | 2 +- searx/utils.py | 8 ++--- searx/webapp.py | 14 ++++----- searxng_extra/docs_prebuild | 2 +- searxng_extra/update/update_external_bangs.py | 2 +- searxng_extra/update/update_osm_keys_tags.py | 2 +- tests/unit/test_locales.py | 2 +- tests/unit/test_webapp.py | 2 +- utils/build_env.py | 4 +-- 50 files changed, 98 insertions(+), 98 deletions(-) diff --git a/docs/admin/installation-apache.rst b/docs/admin/installation-apache.rst index 9fbb187c5..b0b580607 100644 --- a/docs/admin/installation-apache.rst +++ b/docs/admin/installation-apache.rst @@ -190,7 +190,7 @@ Debian: 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 Apache layout`. diff --git a/docs/dev/engines/engine_overview.rst b/docs/dev/engines/engine_overview.rst index 8052a8bea..00c766f2f 100644 --- a/docs/dev/engines/engine_overview.rst +++ b/docs/dev/engines/engine_overview.rst @@ -87,8 +87,8 @@ For a more detailed description, see :ref:`settings engine` in the :ref:`settin Overrides --------- -A few of the options have default values in the namespace of engine's python -modul, but are often overwritten by the settings. If ``None`` is assigned to an +A few of the options have default values in the namespace of the engine's python +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 SearXNG will not start with that engine (global names with a leading underline can be ``None``). diff --git a/docs/dev/makefile.rst b/docs/dev/makefile.rst index 286055afb..8f29dd252 100644 --- a/docs/dev/makefile.rst +++ b/docs/dev/makefile.rst @@ -259,7 +259,7 @@ modify (:ref:`make themes`):: ``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`. .. attention:: diff --git a/docs/dev/reST.rst b/docs/dev/reST.rst index 47af0b130..ed7ecddde 100644 --- a/docs/dev/reST.rst +++ b/docs/dev/reST.rst @@ -235,7 +235,7 @@ To refer anchors use the `ref role`_ markup: .. admonition:: ``:ref:`` role :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 ordinary ref: diff --git a/docs/utils/lxc.sh.rst b/docs/utils/lxc.sh.rst index 88b0b4a9d..fae302c90 100644 --- a/docs/utils/lxc.sh.rst +++ b/docs/utils/lxc.sh.rst @@ -188,7 +188,7 @@ output of:: Since the path ``/share/SearXNG`` of the HOST system is wrapped into the 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 the ``root`` user of the container (and the timezone in the container is different to HOST system). diff --git a/searx/botdetection/ip_limit.py b/searx/botdetection/ip_limit.py index d0605dcfb..70863265e 100644 --- a/searx/botdetection/ip_limit.py +++ b/searx/botdetection/ip_limit.py @@ -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 :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 -droped. +dropped. .. _X-Forwarded-For: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For diff --git a/searx/botdetection/limiter.py b/searx/botdetection/limiter.py index 366665854..f8509d5a6 100644 --- a/searx/botdetection/limiter.py +++ b/searx/botdetection/limiter.py @@ -71,7 +71,7 @@ LIMITER_CFG_SCHEMA = Path(__file__).parent / "limiter.toml" """Base configuration (schema) of the botdetection.""" LIMITER_CFG = Path('/etc/searxng/limiter.toml') -"""Lokal Limiter configuration.""" +"""Local Limiter configuration.""" CFG_DEPRECATED = { # "dummy.old.foo": "config 'dummy.old.foo' exists only for tests. Don't use it in your real project config." diff --git a/searx/enginelib/__init__.py b/searx/enginelib/__init__.py index 6a0bb67c5..263ebd23c 100644 --- a/searx/enginelib/__init__.py +++ b/searx/enginelib/__init__.py @@ -119,7 +119,7 @@ class Engine: # pylint: disable=too-few-public-methods """Remove the engine from the settings (*disabled & removed*).""" about: dict - """Additional fileds describing the engine. + """Additional fields describing the engine. .. code:: yaml diff --git a/searx/engines/archlinux.py b/searx/engines/archlinux.py index 17bb1b6c5..9d5009ed7 100644 --- a/searx/engines/archlinux.py +++ b/searx/engines/archlinux.py @@ -92,7 +92,7 @@ def response(resp): 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 ` (``wiki_netloc``). Depending 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/') 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 for a in eval_xpath_list(dom, "//a[@class='interlanguage-link-target']"): diff --git a/searx/engines/bing_news.py b/searx/engines/bing_news.py index d8c63857a..18992e2d1 100644 --- a/searx/engines/bing_news.py +++ b/searx/engines/bing_news.py @@ -138,7 +138,7 @@ def fetch_traits(engine_traits: EngineTraits): The :py:obj:`description ` of the 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``. """ diff --git a/searx/engines/brave.py b/searx/engines/brave.py index 7770a2c90..13e262fa3 100644 --- a/searx/engines/brave.py +++ b/searx/engines/brave.py @@ -37,7 +37,7 @@ Brave regions ============= 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 `): @@ -63,10 +63,10 @@ region are mapped to regions in SearXNG (see :py:obj:`babel 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 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). In the :py:obj:`EngineTraits object ` the @@ -264,7 +264,7 @@ def _parse_search(resp): ) 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 .. 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_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): lang_tag = lang_map.get(lang_tag, lang_tag) sxng_tag = region_tag(babel.Locale.parse('%s_%s' % (lang_tag, country_tag.upper()))) diff --git a/searx/engines/bt4g.py b/searx/engines/bt4g.py index 34717aeaf..786aa1920 100644 --- a/searx/engines/bt4g.py +++ b/searx/engines/bt4g.py @@ -67,11 +67,11 @@ or ``time``. .. 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' -"""BT$G offers categoies: ``all`` (default), ``audio``, ``movie``, ``doc``, +"""BT$G offers categories: ``all`` (default), ``audio``, ``movie``, ``doc``, ``app`` and `` other``. """ diff --git a/searx/engines/duckduckgo.py b/searx/engines/duckduckgo.py index edd586f78..ebb4745b9 100644 --- a/searx/engines/duckduckgo.py +++ b/searx/engines/duckduckgo.py @@ -105,7 +105,7 @@ def get_vqd(query): def get_ddg_lang(eng_traits: EngineTraits, sxng_locale, default='en_US'): """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`). 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`` 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: - en_US diff --git a/searx/engines/google.py b/searx/engines/google.py index 377c8db39..51c6acbf2 100644 --- a/searx/engines/google.py +++ b/searx/engines/google.py @@ -22,7 +22,7 @@ import babel.core import babel.languages 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.exceptions import SearxEngineCaptchaException 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. # - # Different to other google services, Google Schloar supports to select more - # than one language. The languages are seperated by a pipe '|' (logical OR). + # Different to other google services, Google Scholar supports to select more + # than one language. The languages are separated by a pipe '|' (logical OR). # By example: &lr=lang_zh-TW%7Clang_de selects articles written in # traditional chinese OR german language. @@ -204,7 +204,7 @@ def get_google_info(params, eng_traits): if len(sxng_locale.split('-')) > 1: 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 # results, the gl parameter boosts search results whose country of origin # 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' 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: print("ERROR: can't map from google country %s (%s) to a babel region." % (x.get('data-name'), eng_country)) diff --git a/searx/engines/google_news.py b/searx/engines/google_news.py index 4b1bffa30..a5ed63bbe 100644 --- a/searx/engines/google_news.py +++ b/searx/engines/google_news.py @@ -72,7 +72,7 @@ time_range_support = False # Google-News results are always *SafeSearch*. Option 'safesearch' is set to # 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 # send_accept_language_header = True @@ -155,7 +155,7 @@ def response(resp): 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. pub_date = extract_text(eval_xpath(result, './article//time')) pub_origin = extract_text(eval_xpath(result, './article//a[@data-n-tid]')) diff --git a/searx/engines/odysee.py b/searx/engines/odysee.py index 89d11d093..3189ab4c6 100644 --- a/searx/engines/odysee.py +++ b/searx/engines/odysee.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""Odysee_ is a decentralised video hosting platform. +"""Odysee_ is a decentralized video hosting platform. .. _Odysee: https://github.com/OdyseeTeam/odysee-frontend """ diff --git a/searx/engines/openstreetmap.py b/searx/engines/openstreetmap.py index 650bfedd1..68ec0549e 100644 --- a/searx/engines/openstreetmap.py +++ b/searx/engines/openstreetmap.py @@ -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: if not isinstance(result.get('extratags'), dict): result["extratags"] = {} @@ -445,7 +445,7 @@ def get_key_label(key_name, lang): if key_name.startswith('currency:'): # currency:EUR --> get the name from the CURRENCIES variable # 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) # https://taginfo.openstreetmap.org/keys/currency#values currency = key_name.split(':') diff --git a/searx/engines/piped.py b/searx/engines/piped.py index 34a5a0a13..a943f7e3a 100644 --- a/searx/engines/piped.py +++ b/searx/engines/piped.py @@ -72,7 +72,7 @@ paging = True backend_url: list | str = "https://pipedapi.kavin.rocks" """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 -complete list of offical instances see Piped-Instances (`JSON +complete list of official instances see Piped-Instances (`JSON `__) .. _Piped-Instances: https://github.com/TeamPiped/Piped/wiki/Instances diff --git a/searx/engines/qwant.py b/searx/engines/qwant.py index e54df5af6..654a76337 100644 --- a/searx/engines/qwant.py +++ b/searx/engines/qwant.py @@ -76,7 +76,7 @@ about = { categories = [] paging = True qwant_categ = None -"""One of ``web``, ``news``, ``images`` or ``videos``""" +"""One of ``web-lite`` (or ``web``), ``news``, ``images`` or ``videos``""" safesearch = True # safe_search_map = {0: '&safesearch=0', 1: '&safesearch=1', 2: '&safesearch=2'} diff --git a/searx/engines/sqlite.py b/searx/engines/sqlite.py index c86df5867..76e83af8a 100644 --- a/searx/engines/sqlite.py +++ b/searx/engines/sqlite.py @@ -10,7 +10,7 @@ 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 -SQlite engine download the database: +SQLite engine download the database: - https://liste.mediathekview.de/filmliste-v2.db.bz2 diff --git a/searx/engines/torznab.py b/searx/engines/torznab.py index 0692d4a7a..101cab9e3 100644 --- a/searx/engines/torznab.py +++ b/searx/engines/torznab.py @@ -23,7 +23,7 @@ The engine has the following settings: Prowlarr-categories_ or Jackett-categories_ for more information. ``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 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 diff --git a/searx/engines/wikidata.py b/searx/engines/wikidata.py index 34d408158..5779daa0b 100644 --- a/searx/engines/wikidata.py +++ b/searx/engines/wikidata.py @@ -287,7 +287,7 @@ def get_results(attribute_result, attributes, language): elif attribute_type == WDGeoAttribute: # geocoordinate link # 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 area = attribute_result.get('P2046') osm_zoom = area_to_osm_zoom(area) if area else 19 diff --git a/searx/engines/xpath.py b/searx/engines/xpath.py index 51ddcda78..442e90595 100644 --- a/searx/engines/xpath.py +++ b/searx/engines/xpath.py @@ -86,7 +86,7 @@ Replacements are: Search terms from user. ``{pageno}``: - Page number if engine supports pagging :py:obj:`paging` + Page number if engine supports paging :py:obj:`paging` ``{lang}``: ISO 639-1 language code (en, de, fr ..) diff --git a/searx/exceptions.py b/searx/exceptions.py index 069be9057..ac8eb6314 100644 --- a/searx/exceptions.py +++ b/searx/exceptions.py @@ -12,7 +12,7 @@ class SearxException(Exception): class SearxParameterException(SearxException): - """Raised when query miss a required paramater""" + """Raised when query miss a required parameter""" def __init__(self, name, value): if value == '' or value is None: diff --git a/searx/infopage/__init__.py b/searx/infopage/__init__.py index 6b8fd9133..8e6da0256 100644 --- a/searx/infopage/__init__.py +++ b/searx/infopage/__init__.py @@ -55,7 +55,7 @@ class InfoPage: @cached_property 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() template = jinja2.Environment().from_string(self.raw_content) return template.render(**ctx) @@ -119,7 +119,7 @@ class InfoPageSet: # pylint: disable=too-few-public-methods ): self.page_class = page_class or InfoPage 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]] = {} diff --git a/searx/locales.py b/searx/locales.py index 12066f3d7..655f365ab 100644 --- a/searx/locales.py +++ b/searx/locales.py @@ -118,8 +118,8 @@ def _get_locale_descr(locale, language_code): language_name = locale.get_language_name(language_code).capitalize() if language_name and ('a' <= language_name[0] <= 'z'): language_name = language_name.capitalize() - terrirtory_name = locale.get_territory_name(language_code) - return language_name, terrirtory_name + territory_name = locale.get_territory_name(language_code) + return language_name, territory_name def locales_initialize(directory=None): @@ -188,7 +188,7 @@ def get_locale(locale_tag: str) -> Optional[babel.Locale]: return None -def get_offical_locales( +def get_official_locales( territory: str, languages=None, regional: bool = False, de_facto: bool = True ) -> Set[babel.Locale]: """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. 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*): - When the user selects a locale with terrirtory (and a language), the - territory has priority over the language. If any of the offical languages - in the terrirtory is supported by the engine (``engine_locales``) it will + When the user selects a locale with territory (and a language), the + territory has priority over the language. If any of the official languages + in the territory is supported by the engine (``engine_locales``) it will be used. Second approximation rule (*by language*): If "First approximation rule" brings no result or the user selects only a - language without a terrirtory. Check in which territories the language - has an offical status and if one of these territories is supported by the + language without a territory. Check in which territories the language + has an official status and if one of these territories is supported by the 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 .. 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): 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: 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. # 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. 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 - # 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 - # language, then the percentage migth be 100% (--> 100 people) but in - # a different terrirtory with more people (e.g. 10.000) where only 10% + # language, then the percentage might be 100% (--> 100 people) but in + # a different territory with more people (e.g. 10.000) where only 10% # speak the language the total amount of speaker is higher (--> 200 # people). # diff --git a/searx/metrics/__init__.py b/searx/metrics/__init__.py index 18d2170df..da33025dc 100644 --- a/searx/metrics/__init__.py +++ b/searx/metrics/__init__.py @@ -152,19 +152,19 @@ def get_reliabilities(engline_name_list, checker_results): errors = engine_errors.get(engine_name) or [] if counter('engine', engine_name, 'search', 'count', 'sent') == 0: # no request - reliablity = None + reliability = None elif checker_success and not errors: - reliablity = 100 + reliability = 100 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 - reliablity = 0 + reliability = 0 else: # 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] = { - 'reliablity': reliablity, + 'reliability': reliability, 'errors': errors, 'checker': checker_results.get(engine_name, {}).get('errors', {}), } diff --git a/searx/network/__init__.py b/searx/network/__init__.py index 8622e9731..67028f5f0 100644 --- a/searx/network/__init__.py +++ b/searx/network/__init__.py @@ -78,7 +78,7 @@ def _get_timeout(start_time, kwargs): # 2 minutes timeout for the requests without timeout timeout = timeout or 120 - # ajdust actual timeout + # adjust actual timeout timeout += 0.2 # overhead if start_time: timeout -= default_timer() - start_time diff --git a/searx/plugins/__init__.py b/searx/plugins/__init__.py index 8ece94358..951ec9de3 100644 --- a/searx/plugins/__init__.py +++ b/searx/plugins/__init__.py @@ -166,7 +166,7 @@ def load_plugin(plugin_module_name, external): # searx compatibility: plugin.name 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: prepare_package_resources(plugin, plugin_module_name) diff --git a/searx/redislib.py b/searx/redislib.py index a90e15bc2..d65212b8c 100644 --- a/searx/redislib.py +++ b/searx/redislib.py @@ -77,7 +77,7 @@ def secret_hash(name: str): """Creates a hash of the ``name``. 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. :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_). 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. The return value is the amount of items in the sorted set (ZCOUNT_), what diff --git a/searx/search/__init__.py b/searx/search/__init__.py index 478424a0f..fcdc1f72f 100644 --- a/searx/search/__init__.py +++ b/searx/search/__init__.py @@ -89,7 +89,7 @@ class Search: # max of all selected engine timeout 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: processor = PROCESSORS[engineref.name] diff --git a/searx/search/checker/impl.py b/searx/search/checker/impl.py index 37f145e1e..087ced5c2 100644 --- a/searx/search/checker/impl.py +++ b/searx/search/checker/impl.py @@ -347,7 +347,7 @@ class CheckerTests: diff2_str = ', '.join(['{}={!r}'.format(k, v2) for (k, (v1, v2)) in diff.items()]) self.test_results.add_error( 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), ) diff --git a/searx/search/processors/__init__.py b/searx/search/processors/__init__.py index 1390de456..6d2f97fbb 100644 --- a/searx/search/processors/__init__.py +++ b/searx/search/processors/__init__.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # 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') 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: """ diff --git a/searx/search/processors/abstract.py b/searx/search/processors/abstract.py index ace730e54..0cabec97a 100644 --- a/searx/search/processors/abstract.py +++ b/searx/search/processors/abstract.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # 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): - """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' @@ -165,7 +165,7 @@ class EngineProcessor(ABC): # deprecated / vintage --> use params['searxng_locale'] # # 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 # the engine request. diff --git a/searx/search/processors/offline.py b/searx/search/processors/offline.py index 13f077cb1..ca5b9f050 100644 --- a/searx/search/processors/offline.py +++ b/searx/search/processors/offline.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""Processores for engine-type: ``offline`` +"""Processors for engine-type: ``offline`` """ diff --git a/searx/search/processors/online.py b/searx/search/processors/online.py index 7b2ec856b..f30206dc8 100644 --- a/searx/search/processors/online.py +++ b/searx/search/processors/online.py @@ -1,7 +1,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""Processores for engine-type: ``online`` +"""Processors for engine-type: ``online`` """ # pylint: disable=use-dict-literal diff --git a/searx/search/processors/online_currency.py b/searx/search/processors/online_currency.py index 7cb4205c9..c02b8eb99 100644 --- a/searx/search/processors/online_currency.py +++ b/searx/search/processors/online_currency.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""Processores for engine-type: ``online_currency`` +"""Processors for engine-type: ``online_currency`` """ diff --git a/searx/search/processors/online_dictionary.py b/searx/search/processors/online_dictionary.py index 6145a47d1..92a688fab 100644 --- a/searx/search/processors/online_dictionary.py +++ b/searx/search/processors/online_dictionary.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""Processores for engine-type: ``online_dictionary`` +"""Processors for engine-type: ``online_dictionary`` """ diff --git a/searx/search/processors/online_url_search.py b/searx/search/processors/online_url_search.py index a1dd6a018..9c8890767 100644 --- a/searx/search/processors/online_url_search.py +++ b/searx/search/processors/online_url_search.py @@ -1,6 +1,6 @@ # SPDX-License-Identifier: AGPL-3.0-or-later # lint: pylint -"""Processores for engine-type: ``online_url_search`` +"""Processors for engine-type: ``online_url_search`` """ diff --git a/searx/settings_loader.py b/searx/settings_loader.py index 7d481dcea..6983c3ab0 100644 --- a/searx/settings_loader.py +++ b/searx/settings_loader.py @@ -47,7 +47,7 @@ def get_user_settings_path() -> Optional[str]: if 'SEARXNG_SETTINGS_PATH' in environ: 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'): return None diff --git a/searx/templates/simple/preferences.html b/searx/templates/simple/preferences.html index 98d082198..22979ab05 100644 --- a/searx/templates/simple/preferences.html +++ b/searx/templates/simple/preferences.html @@ -108,7 +108,7 @@ {%- endmacro -%} {%- 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 errors = reliabilities.get(engine_name, {}).get('errors', []) -%} {%- if r != None -%} diff --git a/searx/templates/simple/stats.html b/searx/templates/simple/stats.html index d2d5ae2b1..9e177143c 100644 --- a/searx/templates/simple/stats.html +++ b/searx/templates/simple/stats.html @@ -82,7 +82,7 @@ {%- endif -%} - {{ engine_reliabilities.get(engine_stat.name, {}).get('reliablity') }} + {{ engine_reliabilities.get(engine_stat.name, {}).get('reliability') }} {% endfor %} diff --git a/searx/utils.py b/searx/utils.py index 458cef7ea..7f6017617 100644 --- a/searx/utils.py +++ b/searx/utils.py @@ -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): """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). 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 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`` (``zh_Hans``) while the `language identification model`_ reduce both to ``zh``. @@ -681,7 +681,7 @@ def js_variable_to_python(js_variable): # here, inside a JS string, we escape the double quote 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 ('"', "'"): # we are not in string # but p is double or simple quote @@ -710,7 +710,7 @@ def js_variable_to_python(js_variable): previous_p = p # join the string s = ''.join(parts) - # add quote arround the key + # add quote around the key # { a: 12 } # becomes # { "a": 12 } diff --git a/searx/webapp.py b/searx/webapp.py index ec4f7627e..aa5e545d5 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -938,19 +938,19 @@ def preferences(): errors = engine_errors.get(e.name) or [] if counter('engine', e.name, 'search', 'count', 'sent') == 0: # no request - reliablity = None + reliability = None elif checker_success and not errors: - reliablity = 100 + reliability = 100 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 - reliablity = 0 + reliability = 0 else: # 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] = { - 'reliablity': reliablity, + 'reliability': reliability, 'errors': [], '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] 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 if key_name == 'reliability': key = reliability diff --git a/searxng_extra/docs_prebuild b/searxng_extra/docs_prebuild index 220bafca9..f19d59800 100755 --- a/searxng_extra/docs_prebuild +++ b/searxng_extra/docs_prebuild @@ -64,7 +64,7 @@ def _instance_infosetset_ctx(base_url): with app.test_request_context(base_url=base_url): 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:: # # RuntimeError: The connection pool was closed while 1 HTTP \ diff --git a/searxng_extra/update/update_external_bangs.py b/searxng_extra/update/update_external_bangs.py index 7b8262653..420393982 100755 --- a/searxng_extra/update/update_external_bangs.py +++ b/searxng_extra/update/update_external_bangs.py @@ -62,7 +62,7 @@ def merge_when_no_leaf(node): d -> d -> g -> (ddg) -> i -> g -> (dig) - becomes (3 noodes):: + becomes (3 nodes):: d -> dg -> -> ig -> diff --git a/searxng_extra/update/update_osm_keys_tags.py b/searxng_extra/update/update_osm_keys_tags.py index 72f3d61c5..75a55145d 100755 --- a/searxng_extra/update/update_osm_keys_tags.py +++ b/searxng_extra/update/update_osm_keys_tags.py @@ -4,7 +4,7 @@ """Fetch OSM keys and tags. 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). Output file: :origin:`searx/data/osm_keys_tags` (:origin:`CI Update data ... diff --git a/tests/unit/test_locales.py b/tests/unit/test_locales.py index 61561c17b..e18353145 100644 --- a/tests/unit/test_locales.py +++ b/tests/unit/test_locales.py @@ -66,7 +66,7 @@ class TestLocales(SearxTestCase): # B. When user selects a language and a territory the results should be # 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'] # Examples (Assumption A.) diff --git a/tests/unit/test_webapp.py b/tests/unit/test_webapp.py index e3ca0e261..9e8bc24ce 100644 --- a/tests/unit/test_webapp.py +++ b/tests/unit/test_webapp.py @@ -215,7 +215,7 @@ class ViewsTestCase(SearxTestCase): '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': ''}) self.assertEqual(result.status_code, 200) self.assertIn( diff --git a/utils/build_env.py b/utils/build_env.py index f5c8ad971..1ef8ab700 100644 --- a/utils/build_env.py +++ b/utils/build_env.py @@ -10,7 +10,7 @@ from os.path import realpath, dirname, join, sep, abspath repo_root = realpath(dirname(realpath(__file__)) + sep + '..') 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. 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, # 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() for name, option in name_val: