forked from zaclys/searxng
[fix] prepare for pylint 2.14.0
Remove issue reported by Pylint 2.14.0: - no-self-use: has been moved to optional extension [1] - The refactoring checker now also raises 'consider-using-generator' messages for max(), min() and sum(). [2] .pylintrc: - <option name>-hint has been removed since long, Pylint 2.14.0 raises an error on invalid options - bad-continuation and bad-whitespace have been removed [3] [1] https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/summary.html#removed-checkers [2] https://pylint.pycqa.org/en/latest/whatsnew/2/2.14/full.html#what-s-new-in-pylint-2-14-0 [2] https://pylint.pycqa.org/en/latest/whatsnew/2/2.6/summary.html#summary-release-highlights Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
This commit is contained in:
parent
658e04077b
commit
2de007138c
42
.pylintrc
42
.pylintrc
|
@ -59,8 +59,7 @@ confidence=
|
||||||
# --enable=similarities". If you want to run only the classes checker, but have
|
# --enable=similarities". If you want to run only the classes checker, but have
|
||||||
# no Warning level messages displayed, use"--disable=all --enable=classes
|
# no Warning level messages displayed, use"--disable=all --enable=classes
|
||||||
# --disable=W"
|
# --disable=W"
|
||||||
disable=bad-whitespace,
|
disable=duplicate-code,
|
||||||
duplicate-code,
|
|
||||||
missing-function-docstring,
|
missing-function-docstring,
|
||||||
consider-using-f-string,
|
consider-using-f-string,
|
||||||
|
|
||||||
|
@ -108,39 +107,21 @@ max-nested-blocks=5
|
||||||
|
|
||||||
[BASIC]
|
[BASIC]
|
||||||
|
|
||||||
# List of builtins function names that should not be used, separated by a comma
|
|
||||||
bad-functions=map,filter,apply,input
|
|
||||||
|
|
||||||
# Naming hint for argument names
|
|
||||||
argument-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
|
||||||
|
|
||||||
# Regular expression matching correct argument names
|
# Regular expression matching correct argument names
|
||||||
argument-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
argument-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||||
|
|
||||||
# Naming hint for attribute names
|
|
||||||
attr-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
|
||||||
|
|
||||||
# Regular expression matching correct attribute names
|
# Regular expression matching correct attribute names
|
||||||
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*)|([A-Z0-9_]*))$
|
attr-rgx=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*)|([A-Z0-9_]*))$
|
||||||
|
|
||||||
# Bad variable names which should always be refused, separated by a comma
|
# Bad variable names which should always be refused, separated by a comma
|
||||||
bad-names=foo,bar,baz,toto,tutu,tata
|
bad-names=foo,bar,baz,toto,tutu,tata
|
||||||
|
|
||||||
# Naming hint for class attribute names
|
|
||||||
class-attribute-name-hint=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
|
||||||
|
|
||||||
# Regular expression matching correct class attribute names
|
# Regular expression matching correct class attribute names
|
||||||
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
class-attribute-rgx=([A-Za-z_][A-Za-z0-9_]{2,30}|(__.*__))$
|
||||||
|
|
||||||
# Naming hint for class names
|
|
||||||
class-name-hint=[A-Z_][a-zA-Z0-9]+$
|
|
||||||
|
|
||||||
# Regular expression matching correct class names
|
# Regular expression matching correct class names
|
||||||
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
class-rgx=[A-Z_][a-zA-Z0-9]+$
|
||||||
|
|
||||||
# Naming hint for constant names
|
|
||||||
const-name-hint=(([A-Z_][A-Z0-9_]*)|(__.*__))$
|
|
||||||
|
|
||||||
# Regular expression matching correct constant names
|
# Regular expression matching correct constant names
|
||||||
const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
|
const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
|
||||||
#const-rgx=[f]?[A-Z_][a-zA-Z0-9_]{2,30}$
|
#const-rgx=[f]?[A-Z_][a-zA-Z0-9_]{2,30}$
|
||||||
|
@ -149,9 +130,6 @@ const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
|
||||||
# ones are exempt.
|
# ones are exempt.
|
||||||
docstring-min-length=-1
|
docstring-min-length=-1
|
||||||
|
|
||||||
# Naming hint for function names
|
|
||||||
function-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
|
||||||
|
|
||||||
# Regular expression matching correct function names
|
# Regular expression matching correct function names
|
||||||
function-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
function-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||||
|
|
||||||
|
@ -161,21 +139,12 @@ good-names=i,j,k,ex,Run,_,log,cfg,id
|
||||||
# Include a hint for the correct naming format with invalid-name
|
# Include a hint for the correct naming format with invalid-name
|
||||||
include-naming-hint=no
|
include-naming-hint=no
|
||||||
|
|
||||||
# Naming hint for inline iteration names
|
|
||||||
inlinevar-name-hint=[A-Za-z_][A-Za-z0-9_]*$
|
|
||||||
|
|
||||||
# Regular expression matching correct inline iteration names
|
# Regular expression matching correct inline iteration names
|
||||||
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
inlinevar-rgx=[A-Za-z_][A-Za-z0-9_]*$
|
||||||
|
|
||||||
# Naming hint for method names
|
|
||||||
method-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
|
||||||
|
|
||||||
# Regular expression matching correct method names
|
# Regular expression matching correct method names
|
||||||
method-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
method-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*))$
|
||||||
|
|
||||||
# Naming hint for module names
|
|
||||||
module-name-hint=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
|
||||||
|
|
||||||
# Regular expression matching correct module names
|
# Regular expression matching correct module names
|
||||||
#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-Z0-9]+))$
|
||||||
module-rgx=([a-z_][a-z0-9_]*)$
|
module-rgx=([a-z_][a-z0-9_]*)$
|
||||||
|
@ -192,9 +161,6 @@ no-docstring-rgx=^_
|
||||||
# to this list to register other decorators that produce valid properties.
|
# to this list to register other decorators that produce valid properties.
|
||||||
property-classes=abc.abstractproperty
|
property-classes=abc.abstractproperty
|
||||||
|
|
||||||
# Naming hint for variable names
|
|
||||||
variable-name-hint=(([a-z][a-z0-9_]{2,30})|(_[a-z0-9_]*))$
|
|
||||||
|
|
||||||
# Regular expression matching correct variable names
|
# Regular expression matching correct variable names
|
||||||
variable-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*)|([a-z]))$
|
variable-rgx=(([a-z][a-zA-Z0-9_]{2,30})|(_[a-z0-9_]*)|([a-z]))$
|
||||||
|
|
||||||
|
@ -220,12 +186,6 @@ max-line-length=120
|
||||||
# Maximum number of lines in a module
|
# Maximum number of lines in a module
|
||||||
max-module-lines=2000
|
max-module-lines=2000
|
||||||
|
|
||||||
# List of optional constructs for which whitespace checking is disabled. `dict-
|
|
||||||
# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}.
|
|
||||||
# `trailing-comma` allows a space between comma and closing bracket: (a, ).
|
|
||||||
# `empty-line` allows space-only lines.
|
|
||||||
no-space-check=trailing-comma,dict-separator
|
|
||||||
|
|
||||||
# Allow the body of a class to be on the same line as the declaration if body
|
# Allow the body of a class to be on the same line as the declaration if body
|
||||||
# contains single statement.No config file found, using default configuration
|
# contains single statement.No config file found, using default configuration
|
||||||
|
|
||||||
|
|
|
@ -464,7 +464,6 @@ def get_attributes(language):
|
||||||
|
|
||||||
|
|
||||||
class WDAttribute:
|
class WDAttribute:
|
||||||
# pylint: disable=no-self-use
|
|
||||||
__slots__ = ('name',)
|
__slots__ = ('name',)
|
||||||
|
|
||||||
def __init__(self, name):
|
def __init__(self, name):
|
||||||
|
@ -626,7 +625,6 @@ class WDImageAttribute(WDURLAttribute):
|
||||||
|
|
||||||
|
|
||||||
class WDDateAttribute(WDAttribute):
|
class WDDateAttribute(WDAttribute):
|
||||||
# pylint: disable=no-self-use
|
|
||||||
def get_select(self):
|
def get_select(self):
|
||||||
return '?{name} ?{name}timePrecision ?{name}timeZone ?{name}timeCalendar'.replace('{name}', self.name)
|
return '?{name} ?{name}timePrecision ?{name}timeZone ?{name}timeCalendar'.replace('{name}', self.name)
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class InfoPage:
|
||||||
MarkdownIt("commonmark", {"typographer": True}).enable(["replacements", "smartquotes"]).render(self.content)
|
MarkdownIt("commonmark", {"typographer": True}).enable(["replacements", "smartquotes"]).render(self.content)
|
||||||
)
|
)
|
||||||
|
|
||||||
def get_ctx(self): # pylint: disable=no-self-use
|
def get_ctx(self):
|
||||||
"""Jinja context to render :py:obj:`InfoPage.content`"""
|
"""Jinja context to render :py:obj:`InfoPage.content`"""
|
||||||
|
|
||||||
def _md_link(name, url):
|
def _md_link(name, url):
|
||||||
|
|
|
@ -160,6 +160,7 @@ def get_reliabilities(engline_name_list, checker_results):
|
||||||
# even if there is no exception
|
# even if there is no exception
|
||||||
reliablity = 0
|
reliablity = 0
|
||||||
else:
|
else:
|
||||||
|
# pylint: disable=consider-using-generator
|
||||||
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
|
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
|
||||||
|
|
||||||
reliabilities[engine_name] = {
|
reliabilities[engine_name] = {
|
||||||
|
|
|
@ -13,7 +13,7 @@ from typing import Iterable, Tuple
|
||||||
import httpx
|
import httpx
|
||||||
import anyio
|
import anyio
|
||||||
|
|
||||||
from .network import get_network, initialize, check_network_configuration
|
from .network import get_network, initialize, check_network_configuration # pylint:disable=cyclic-import
|
||||||
from .client import get_loop
|
from .client import get_loop
|
||||||
from .raise_for_httperror import raise_for_httperror
|
from .raise_for_httperror import raise_for_httperror
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,6 @@ class PluginStore:
|
||||||
self.plugins.append(plugin)
|
self.plugins.append(plugin)
|
||||||
|
|
||||||
def call(self, ordered_plugin_list, plugin_type, *args, **kwargs):
|
def call(self, ordered_plugin_list, plugin_type, *args, **kwargs):
|
||||||
# pylint: disable=no-self-use
|
|
||||||
ret = True
|
ret = True
|
||||||
for plugin in ordered_plugin_list:
|
for plugin in ordered_plugin_list:
|
||||||
if hasattr(plugin, plugin_type):
|
if hasattr(plugin, plugin_type):
|
||||||
|
|
|
@ -18,7 +18,7 @@ from flask_babel import gettext
|
||||||
|
|
||||||
name = gettext('Search on category select')
|
name = gettext('Search on category select')
|
||||||
description = gettext(
|
description = gettext(
|
||||||
'Perform search immediately if a category selected. ' 'Disable to select multiple categories. (JavaScript required)'
|
'Perform search immediately if a category selected. Disable to select multiple categories. (JavaScript required)'
|
||||||
)
|
)
|
||||||
default_on = True
|
default_on = True
|
||||||
preference_section = 'ui'
|
preference_section = 'ui'
|
||||||
|
|
|
@ -208,11 +208,9 @@ class BooleanChoices:
|
||||||
self.default_choices = dict(choices)
|
self.default_choices = dict(choices)
|
||||||
|
|
||||||
def transform_form_items(self, items):
|
def transform_form_items(self, items):
|
||||||
# pylint: disable=no-self-use
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def transform_values(self, values):
|
def transform_values(self, values):
|
||||||
# pylint: disable=no-self-use
|
|
||||||
return values
|
return values
|
||||||
|
|
||||||
def parse_cookie(self, data_disabled: str, data_enabled: str):
|
def parse_cookie(self, data_disabled: str, data_enabled: str):
|
||||||
|
|
|
@ -133,7 +133,7 @@ class Search:
|
||||||
|
|
||||||
def search_multiple_requests(self, requests):
|
def search_multiple_requests(self, requests):
|
||||||
# pylint: disable=protected-access
|
# pylint: disable=protected-access
|
||||||
search_id = uuid4().__str__()
|
search_id = str(uuid4())
|
||||||
|
|
||||||
for engine_name, query, request_params in requests:
|
for engine_name, query, request_params in requests:
|
||||||
th = threading.Thread( # pylint: disable=invalid-name
|
th = threading.Thread( # pylint: disable=invalid-name
|
||||||
|
|
|
@ -170,5 +170,5 @@ class EngineProcessor(ABC):
|
||||||
tests.update(self.get_default_tests())
|
tests.update(self.get_default_tests())
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
def get_default_tests(self): # pylint: disable=no-self-use
|
def get_default_tests(self):
|
||||||
return {}
|
return {}
|
||||||
|
|
|
@ -464,7 +464,7 @@ def to_string(obj: Any) -> str:
|
||||||
if isinstance(obj, str):
|
if isinstance(obj, str):
|
||||||
return obj
|
return obj
|
||||||
if hasattr(obj, '__str__'):
|
if hasattr(obj, '__str__'):
|
||||||
return obj.__str__()
|
return str(obj)
|
||||||
return repr(obj)
|
return repr(obj)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1048,6 +1048,7 @@ def preferences():
|
||||||
# even if there is no exception
|
# even if there is no exception
|
||||||
reliablity = 0
|
reliablity = 0
|
||||||
else:
|
else:
|
||||||
|
# pylint: disable=consider-using-generator
|
||||||
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
|
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
|
||||||
|
|
||||||
reliabilities[e.name] = {
|
reliabilities[e.name] = {
|
||||||
|
|
Loading…
Reference in New Issue