mirror of
https://github.com/searxng/searxng.git
synced 2024-11-22 12:10:11 +01:00
Merge pull request #1569 from dalf/fix-pyright-reported-errors
Fix pyright errors
This commit is contained in:
commit
88733c0ce6
3
manage
3
manage
@ -698,7 +698,8 @@ test.pyright() {
|
|||||||
| grep -v '/engines/.*.py.* - warning: "logger" is not defined'\
|
| grep -v '/engines/.*.py.* - warning: "logger" is not defined'\
|
||||||
| grep -v '/plugins/.*.py.* - error: "logger" is not defined'\
|
| grep -v '/plugins/.*.py.* - error: "logger" is not defined'\
|
||||||
| grep -v '/engines/.*.py.* - warning: "supported_languages" is not defined' \
|
| grep -v '/engines/.*.py.* - warning: "supported_languages" is not defined' \
|
||||||
| grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined'
|
| grep -v '/engines/.*.py.* - warning: "language_aliases" is not defined' \
|
||||||
|
| grep -v '/engines/.*.py.* - warning: "categories" is not defined'
|
||||||
dump_return $?
|
dump_return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,11 @@
|
|||||||
# pylint: disable=C,R
|
# pylint: disable=C,R
|
||||||
|
|
||||||
|
|
||||||
|
__all__ = ('cached_property',)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from functools import cached_property # pylint: disable=unused-import
|
from functools import cached_property # type: ignore
|
||||||
|
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from pymongo import MongoClient # pylint: disable=import-error
|
from pymongo import MongoClient # pyright: ignore # pylint: disable=import-error
|
||||||
|
|
||||||
engine_type = 'offline'
|
engine_type = 'offline'
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
# import error is ignored because the admin has to install mysql manually to use
|
# import error is ignored because the admin has to install mysql manually to use
|
||||||
# the engine
|
# the engine
|
||||||
import mysql.connector # pylint: disable=import-error
|
import mysql.connector # pyright: ignore # pylint: disable=import-error
|
||||||
|
|
||||||
engine_type = 'offline'
|
engine_type = 'offline'
|
||||||
auth_plugin = 'caching_sha2_password'
|
auth_plugin = 'caching_sha2_password'
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
# import error is ignored because the admin has to install mysql manually to use
|
# import error is ignored because the admin has to install mysql manually to use
|
||||||
# the engine
|
# the engine
|
||||||
import psycopg2 # pylint: disable=import-error
|
import psycopg2 # pyright: ignore # pylint: disable=import-error
|
||||||
|
|
||||||
engine_type = 'offline'
|
engine_type = 'offline'
|
||||||
host = "127.0.0.1"
|
host = "127.0.0.1"
|
||||||
|
@ -2,11 +2,12 @@
|
|||||||
# lint: pylint
|
# lint: pylint
|
||||||
# pylint: disable=missing-module-docstring, too-few-public-methods
|
# pylint: disable=missing-module-docstring, too-few-public-methods
|
||||||
|
|
||||||
import typing
|
|
||||||
import threading
|
import threading
|
||||||
from timeit import default_timer
|
from timeit import default_timer
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
import flask
|
||||||
|
|
||||||
from searx import settings
|
from searx import settings
|
||||||
from searx.answerers import ask
|
from searx.answerers import ask
|
||||||
from searx.external_bang import get_bang_url
|
from searx.external_bang import get_bang_url
|
||||||
@ -181,7 +182,7 @@ class SearchWithPlugins(Search):
|
|||||||
|
|
||||||
__slots__ = 'ordered_plugin_list', 'request'
|
__slots__ = 'ordered_plugin_list', 'request'
|
||||||
|
|
||||||
def __init__(self, search_query: SearchQuery, ordered_plugin_list, request: "flask.Request"):
|
def __init__(self, search_query: SearchQuery, ordered_plugin_list, request: flask.Request):
|
||||||
super().__init__(search_query)
|
super().__init__(search_query)
|
||||||
self.ordered_plugin_list = ordered_plugin_list
|
self.ordered_plugin_list = ordered_plugin_list
|
||||||
self.result_container.on_result = self._on_result
|
self.result_container.on_result = self._on_result
|
||||||
|
@ -16,7 +16,7 @@ from searx import logger, settings, searx_debug
|
|||||||
from searx.exceptions import SearxSettingsException
|
from searx.exceptions import SearxSettingsException
|
||||||
from searx.search.processors import PROCESSORS
|
from searx.search.processors import PROCESSORS
|
||||||
from searx.search.checker import Checker
|
from searx.search.checker import Checker
|
||||||
from searx.shared import schedule, storage
|
from searx.shared import schedule, storage # pyright: ignore
|
||||||
|
|
||||||
|
|
||||||
CHECKER_RESULT = 'CHECKER_RESULT'
|
CHECKER_RESULT = 'CHECKER_RESULT'
|
||||||
|
@ -1,11 +1,14 @@
|
|||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
import importlib
|
||||||
|
|
||||||
logger = logging.getLogger('searx.shared')
|
logger = logging.getLogger('searx.shared')
|
||||||
|
|
||||||
|
__all__ = ['SharedDict', 'schedule']
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import uwsgi
|
uwsgi = importlib.import_module('uwsgi')
|
||||||
except:
|
except:
|
||||||
# no uwsgi
|
# no uwsgi
|
||||||
from .shared_simple import SimpleSharedDict as SharedDict, schedule
|
from .shared_simple import SimpleSharedDict as SharedDict, schedule
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
import time
|
import time
|
||||||
from typing import Optional
|
from typing import Optional
|
||||||
import uwsgi # pylint: disable=E0401
|
import uwsgi # pyright: ignore # pylint: disable=E0401
|
||||||
from . import shared_abstract
|
from . import shared_abstract
|
||||||
|
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ def searx_useragent() -> str:
|
|||||||
).strip()
|
).strip()
|
||||||
|
|
||||||
|
|
||||||
def gen_useragent(os_string: str = None) -> str:
|
def gen_useragent(os_string: Optional[str] = None) -> str:
|
||||||
"""Return a random browser User Agent
|
"""Return a random browser User Agent
|
||||||
|
|
||||||
See searx/data/useragents.json
|
See searx/data/useragents.json
|
||||||
@ -570,7 +570,7 @@ def eval_xpath(element: ElementBase, xpath_spec: XPathSpecType):
|
|||||||
raise SearxEngineXPathException(xpath_spec, arg) from e
|
raise SearxEngineXPathException(xpath_spec, arg) from e
|
||||||
|
|
||||||
|
|
||||||
def eval_xpath_list(element: ElementBase, xpath_spec: XPathSpecType, min_len: int = None):
|
def eval_xpath_list(element: ElementBase, xpath_spec: XPathSpecType, min_len: Optional[int] = None):
|
||||||
"""Same as eval_xpath, check if the result is a list
|
"""Same as eval_xpath, check if the result is a list
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -6,6 +6,7 @@ import os
|
|||||||
import shlex
|
import shlex
|
||||||
import subprocess
|
import subprocess
|
||||||
import logging
|
import logging
|
||||||
|
import importlib
|
||||||
|
|
||||||
# fallback values
|
# fallback values
|
||||||
# if there is searx.version_frozen module, and it is not possible to get the git tag
|
# if there is searx.version_frozen module, and it is not possible to get the git tag
|
||||||
@ -73,7 +74,8 @@ def get_git_version():
|
|||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from searx.version_frozen import VERSION_STRING, VERSION_TAG, GIT_URL, GIT_BRANCH
|
vf = importlib.import_module('searx.version_frozen')
|
||||||
|
VERSION_STRING, VERSION_TAG, GIT_URL, GIT_BRANCH = vf.VERSION_STRING, vf.VERSION_TAG, vf.GIT_URL, vf.GIT_BRANCH
|
||||||
except ImportError:
|
except ImportError:
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
|
@ -1303,7 +1303,7 @@ def opensearch():
|
|||||||
def favicon():
|
def favicon():
|
||||||
theme = request.preferences.get_value("theme")
|
theme = request.preferences.get_value("theme")
|
||||||
return send_from_directory(
|
return send_from_directory(
|
||||||
os.path.join(app.root_path, settings['ui']['static_path'], 'themes', theme, 'img'),
|
os.path.join(app.root_path, settings['ui']['static_path'], 'themes', theme, 'img'), # pyright: ignore
|
||||||
'favicon.png',
|
'favicon.png',
|
||||||
mimetype='image/vnd.microsoft.icon',
|
mimetype='image/vnd.microsoft.icon',
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user