From 00e951fc5045b1e1ba66c6977794e5aad2c3fefa Mon Sep 17 00:00:00 2001 From: Marko Ristin Date: Fri, 15 Sep 2023 10:18:49 +0200 Subject: [PATCH] Upgraded to pylint 2.17.5 We upgraded pylint to the latest version to keep up with its development. Eventually, we want to support Python 3.11, so this upgrade is timely as well. --- icontract/_recompute.py | 2 +- pylint.rc | 2 +- setup.py | 2 +- tests/test_args_and_kwargs_in_contract.py | 1 - tests/test_error.py | 1 - tests/test_for_integrators.py | 2 +- tests/test_inheritance_invariant.py | 2 +- tests/test_inheritance_postcondition.py | 1 - tests/test_inheritance_precondition.py | 1 - tests/test_invariant.py | 2 +- tests/test_postcondition.py | 1 - tests/test_precondition.py | 1 - tests/test_recompute.py | 2 +- tests/test_recursion.py | 1 - tests/test_represent.py | 2 +- tests/test_snapshot.py | 2 +- tests/test_threading.py | 2 +- tests/test_typeguard.py | 1 - tests_3_6/test_represent.py | 2 +- tests_3_8/async/separately_test_concurrent.py | 1 - tests_3_8/async/test_args_and_kwargs_in_contract.py | 1 - tests_3_8/async/test_recursion.py | 1 - tests_3_8/test_error.py | 1 - tests_3_8/test_represent.py | 2 +- 24 files changed, 12 insertions(+), 24 deletions(-) diff --git a/icontract/_recompute.py b/icontract/_recompute.py index f5a5f9d..76d9e20 100644 --- a/icontract/_recompute.py +++ b/icontract/_recompute.py @@ -1096,7 +1096,7 @@ def visit_Lambda(self, node: ast.Lambda) -> Callable[..., Any]: "Please make a feature request on https://github.com/Parquery/icontract" ) - def visit_Return(self, node: ast.Return) -> Any: # pylint: disable=no-self-use + def visit_Return(self, node: ast.Return) -> Any: """Raise an exception that this node is unexpected.""" raise AssertionError( "Unexpected return node during the re-computation: {}".format( diff --git a/pylint.rc b/pylint.rc index 45fe6b5..6ce99e7 100644 --- a/pylint.rc +++ b/pylint.rc @@ -7,5 +7,5 @@ generated-members=bottle\.request\.forms\.decode,bottle\.request\.query\.decode max-line-length=120 [MESSAGES CONTROL] -disable=too-few-public-methods,abstract-class-little-used,len-as-condition,bad-continuation,bad-whitespace,duplicate-code,no-else-raise,too-many-locals,too-many-branches,too-many-lines,too-many-arguments,too-many-statements,too-many-nested-blocks,too-many-function-args,too-many-instance-attributes,too-many-public-methods,protected-access,consider-using-in,no-member,consider-using-f-string,use-dict-literal,redundant-keyword-arg,no-self-use +disable=too-few-public-methods,len-as-condition,duplicate-code,no-else-raise,too-many-locals,too-many-branches,too-many-lines,too-many-arguments,too-many-statements,too-many-nested-blocks,too-many-function-args,too-many-instance-attributes,too-many-public-methods,protected-access,consider-using-in,no-member,consider-using-f-string,use-dict-literal,redundant-keyword-arg diff --git a/setup.py b/setup.py index c9c52c8..6a756db 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ install_requires=install_requires, extras_require={ "dev": [ - "pylint==2.13.9", + "pylint==2.17.5", "tox>=3.0.0", "pydocstyle>=6.1.1,<7", "coverage>=4.5.1,<5", diff --git a/tests/test_args_and_kwargs_in_contract.py b/tests/test_args_and_kwargs_in_contract.py index 39860bb..10a7127 100644 --- a/tests/test_args_and_kwargs_in_contract.py +++ b/tests/test_args_and_kwargs_in_contract.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -# pylint: disable=no-self-use # pylint: disable=invalid-name # pylint: disable=unused-argument # pylint: disable=unnecessary-lambda diff --git a/tests/test_error.py b/tests/test_error.py index 16a7f98..77f25a5 100644 --- a/tests/test_error.py +++ b/tests/test_error.py @@ -1,7 +1,6 @@ # pylint: disable=missing-docstring # pylint: disable=invalid-name # pylint: disable=unused-argument -# pylint: disable=no-self-use # pylint: disable=unused-variable import unittest diff --git a/tests/test_for_integrators.py b/tests/test_for_integrators.py index 1a13932..b607335 100644 --- a/tests/test_for_integrators.py +++ b/tests/test_for_integrators.py @@ -1,6 +1,6 @@ """Test logic that can be potentially used by the integrators such as third-party libraries.""" -# pylint: disable=no-self-use,missing-docstring +# pylint: disable=missing-docstring # pylint: disable=invalid-name,unnecessary-lambda import ast diff --git a/tests/test_inheritance_invariant.py b/tests/test_inheritance_invariant.py index 4730a6a..9672d6c 100644 --- a/tests/test_inheritance_invariant.py +++ b/tests/test_inheritance_invariant.py @@ -27,7 +27,7 @@ class A(icontract.DBC): def __repr__(self) -> str: return "instance of A" - def some_func(self) -> int: # pylint: disable=no-self-use + def some_func(self) -> int: return 1 class B(A): diff --git a/tests/test_inheritance_postcondition.py b/tests/test_inheritance_postcondition.py index 14541f8..24f924a 100644 --- a/tests/test_inheritance_postcondition.py +++ b/tests/test_inheritance_postcondition.py @@ -1,6 +1,5 @@ # pylint: disable=missing-docstring # pylint: disable=invalid-name -# pylint: disable=no-self-use import abc import sys diff --git a/tests/test_inheritance_precondition.py b/tests/test_inheritance_precondition.py index 55c81ab..a358fba 100644 --- a/tests/test_inheritance_precondition.py +++ b/tests/test_inheritance_precondition.py @@ -1,6 +1,5 @@ # pylint: disable=missing-docstring # pylint: disable=invalid-name -# pylint: disable=no-self-use import abc import sys diff --git a/tests/test_invariant.py b/tests/test_invariant.py index 03e4f61..38dd08b 100644 --- a/tests/test_invariant.py +++ b/tests/test_invariant.py @@ -197,7 +197,7 @@ def some_method(self) -> None: inst.some_method() self.assertEqual(10, inst.x) - def test_inv_with_empty_arguments(self) -> None: # pylint: disable=no-self-use + def test_inv_with_empty_arguments(self) -> None: z = 42 @icontract.invariant(lambda: z == 42) diff --git a/tests/test_postcondition.py b/tests/test_postcondition.py index e5166d6..1ab88f7 100644 --- a/tests/test_postcondition.py +++ b/tests/test_postcondition.py @@ -1,7 +1,6 @@ # pylint: disable=missing-docstring # pylint: disable=invalid-name # pylint: disable=unused-argument -# pylint: disable=no-self-use # pylint: disable=unnecessary-lambda import abc diff --git a/tests/test_precondition.py b/tests/test_precondition.py index a0f04f3..1092eb1 100644 --- a/tests/test_precondition.py +++ b/tests/test_precondition.py @@ -1,7 +1,6 @@ # pylint: disable=missing-docstring # pylint: disable=invalid-name # pylint: disable=unused-argument -# pylint: disable=no-self-use # pylint: disable=unnecessary-lambda import functools diff --git a/tests/test_recompute.py b/tests/test_recompute.py index 7e6fc23..32b8aed 100644 --- a/tests/test_recompute.py +++ b/tests/test_recompute.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=missing-docstring,invalid-name,no-self-use +# pylint: disable=missing-docstring,invalid-name # pylint: disable=unused-argument import ast import re diff --git a/tests/test_recursion.py b/tests/test_recursion.py index 8df2b9b..b07470e 100644 --- a/tests/test_recursion.py +++ b/tests/test_recursion.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -# pylint: disable=no-self-use # pylint: disable=unnecessary-lambda import unittest from typing import List diff --git a/tests/test_represent.py b/tests/test_represent.py index e2f3395..ddf29f0 100644 --- a/tests/test_represent.py +++ b/tests/test_represent.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=missing-docstring,invalid-name,no-self-use +# pylint: disable=missing-docstring,invalid-name # pylint: disable=unused-argument # pylint: disable=unnecessary-lambda diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 38ffb8c..fe0f1e4 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -2,7 +2,7 @@ # pylint: disable=invalid-name # pylint: disable=unnecessary-lambda # pylint: disable=unused-argument -# pylint: disable=no-self-use + import textwrap import unittest from typing import List, Optional # pylint: disable=unused-import diff --git a/tests/test_threading.py b/tests/test_threading.py index bdbfcc2..96869d8 100644 --- a/tests/test_threading.py +++ b/tests/test_threading.py @@ -1,4 +1,4 @@ -# pylint: disable=missing-docstring,unnecessary-lambda,no-self-use +# pylint: disable=missing-docstring,unnecessary-lambda import threading import unittest diff --git a/tests/test_typeguard.py b/tests/test_typeguard.py index 14fc947..b6f37f9 100644 --- a/tests/test_typeguard.py +++ b/tests/test_typeguard.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -# pylint: disable=no-self-use # pylint: disable=invalid-name # pylint: disable=unused-argument diff --git a/tests_3_6/test_represent.py b/tests_3_6/test_represent.py index dce4dd9..0e02f06 100644 --- a/tests_3_6/test_represent.py +++ b/tests_3_6/test_represent.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=missing-docstring,invalid-name,no-self-use +# pylint: disable=missing-docstring,invalid-name # pylint: disable=unused-argument import textwrap diff --git a/tests_3_8/async/separately_test_concurrent.py b/tests_3_8/async/separately_test_concurrent.py index cffa9b3..11768a1 100644 --- a/tests_3_8/async/separately_test_concurrent.py +++ b/tests_3_8/async/separately_test_concurrent.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -# pylint: disable=no-self-use # pylint: disable=unnecessary-lambda # pylint: disable=disallowed-name import asyncio diff --git a/tests_3_8/async/test_args_and_kwargs_in_contract.py b/tests_3_8/async/test_args_and_kwargs_in_contract.py index 866846a..83cb2b1 100644 --- a/tests_3_8/async/test_args_and_kwargs_in_contract.py +++ b/tests_3_8/async/test_args_and_kwargs_in_contract.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -# pylint: disable=no-self-use # pylint: disable=invalid-name # pylint: disable=unused-argument # pylint: disable=unnecessary-lambda diff --git a/tests_3_8/async/test_recursion.py b/tests_3_8/async/test_recursion.py index 9a08d6f..0e9e656 100644 --- a/tests_3_8/async/test_recursion.py +++ b/tests_3_8/async/test_recursion.py @@ -1,5 +1,4 @@ # pylint: disable=missing-docstring -# pylint: disable=no-self-use # pylint: disable=unnecessary-lambda import unittest from typing import List diff --git a/tests_3_8/test_error.py b/tests_3_8/test_error.py index 224fa63..eae9e80 100644 --- a/tests_3_8/test_error.py +++ b/tests_3_8/test_error.py @@ -1,7 +1,6 @@ # pylint: disable=missing-docstring # pylint: disable=invalid-name # pylint: disable=unused-argument -# pylint: disable=no-self-use # pylint: disable=unused-variable import textwrap diff --git a/tests_3_8/test_represent.py b/tests_3_8/test_represent.py index f0d7f1e..fb2cc2c 100644 --- a/tests_3_8/test_represent.py +++ b/tests_3_8/test_represent.py @@ -1,5 +1,5 @@ #!/usr/bin/env python3 -# pylint: disable=missing-docstring,invalid-name,no-self-use +# pylint: disable=missing-docstring,invalid-name # pylint: disable=unused-argument import textwrap import unittest