[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:
Markus Heiser 2022-06-03 15:41:52 +02:00
parent 658e04077b
commit 2de007138c
12 changed files with 9 additions and 52 deletions

View File

@ -59,8 +59,7 @@ confidence=
# --enable=similarities". If you want to run only the classes checker, but have
# no Warning level messages displayed, use"--disable=all --enable=classes
# --disable=W"
disable=bad-whitespace,
duplicate-code,
disable=duplicate-code,
missing-function-docstring,
consider-using-f-string,
@ -108,39 +107,21 @@ max-nested-blocks=5
[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
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
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-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
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
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
const-rgx=(([a-zA-Z_][a-zA-Z0-9_]*)|(__.*__))$
#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.
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
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-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
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
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
#module-rgx=(([a-z_][a-z0-9_]*)|([A-Z][a-zA-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.
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
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
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
# contains single statement.No config file found, using default configuration

View File

@ -464,7 +464,6 @@ def get_attributes(language):
class WDAttribute:
# pylint: disable=no-self-use
__slots__ = ('name',)
def __init__(self, name):
@ -626,7 +625,6 @@ class WDImageAttribute(WDURLAttribute):
class WDDateAttribute(WDAttribute):
# pylint: disable=no-self-use
def get_select(self):
return '?{name} ?{name}timePrecision ?{name}timeZone ?{name}timeCalendar'.replace('{name}', self.name)

View File

@ -81,7 +81,7 @@ class InfoPage:
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`"""
def _md_link(name, url):

View File

@ -160,6 +160,7 @@ def get_reliabilities(engline_name_list, checker_results):
# even if there is no exception
reliablity = 0
else:
# pylint: disable=consider-using-generator
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
reliabilities[engine_name] = {

View File

@ -13,7 +13,7 @@ from typing import Iterable, Tuple
import httpx
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 .raise_for_httperror import raise_for_httperror

View File

@ -198,7 +198,6 @@ class PluginStore:
self.plugins.append(plugin)
def call(self, ordered_plugin_list, plugin_type, *args, **kwargs):
# pylint: disable=no-self-use
ret = True
for plugin in ordered_plugin_list:
if hasattr(plugin, plugin_type):

View File

@ -18,7 +18,7 @@ from flask_babel import gettext
name = gettext('Search on category select')
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
preference_section = 'ui'

View File

@ -208,11 +208,9 @@ class BooleanChoices:
self.default_choices = dict(choices)
def transform_form_items(self, items):
# pylint: disable=no-self-use
return items
def transform_values(self, values):
# pylint: disable=no-self-use
return values
def parse_cookie(self, data_disabled: str, data_enabled: str):

View File

@ -133,7 +133,7 @@ class Search:
def search_multiple_requests(self, requests):
# pylint: disable=protected-access
search_id = uuid4().__str__()
search_id = str(uuid4())
for engine_name, query, request_params in requests:
th = threading.Thread( # pylint: disable=invalid-name

View File

@ -170,5 +170,5 @@ class EngineProcessor(ABC):
tests.update(self.get_default_tests())
return tests
def get_default_tests(self): # pylint: disable=no-self-use
def get_default_tests(self):
return {}

View File

@ -464,7 +464,7 @@ def to_string(obj: Any) -> str:
if isinstance(obj, str):
return obj
if hasattr(obj, '__str__'):
return obj.__str__()
return str(obj)
return repr(obj)

View File

@ -1048,6 +1048,7 @@ def preferences():
# even if there is no exception
reliablity = 0
else:
# pylint: disable=consider-using-generator
reliablity = 100 - sum([error['percentage'] for error in errors if not error.get('secondary')])
reliabilities[e.name] = {