From 3d5dac253f0960be0ee937c50548d890916a3d43 Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Fri, 23 Jun 2023 09:07:38 -0400 Subject: [PATCH 1/3] Changelog cleanups --- doc/whatsnew/2/2.15/index.rst | 3 --- doc/whatsnew/2/2.17/index.rst | 2 +- doc/whatsnew/fragments/8563.bugfix | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/doc/whatsnew/2/2.15/index.rst b/doc/whatsnew/2/2.15/index.rst index 91e70e341c..cbc30a8af4 100644 --- a/doc/whatsnew/2/2.15/index.rst +++ b/doc/whatsnew/2/2.15/index.rst @@ -383,9 +383,6 @@ Release date: 2022-09-07 - Fix false positive for ``too-many-function-args`` when a function call is assigned to a class attribute inside the class where the function is defined. Closes #6592 (`#6592 `_) -- Fix ``used-before-assignment`` for functions/classes defined in type checking guard. - - Closes #7368 (`#7368 `_) - Fix ignored files being linted when passed on stdin. Closes #4354 (`#4354 `_) diff --git a/doc/whatsnew/2/2.17/index.rst b/doc/whatsnew/2/2.17/index.rst index 9c5323b189..d060fffe8d 100644 --- a/doc/whatsnew/2/2.17/index.rst +++ b/doc/whatsnew/2/2.17/index.rst @@ -112,7 +112,7 @@ False Positives Fixed Other Bug Fixes --------------- -- Improve output of ``consider-using-generator`` message for ``min()` calls +- Improve output of ``consider-using-generator`` message for ``min()`` calls with ``default`` keyword. Closes #8563 (`#8563 `_) diff --git a/doc/whatsnew/fragments/8563.bugfix b/doc/whatsnew/fragments/8563.bugfix index 3c9d38b1c5..ed1a7ba006 100644 --- a/doc/whatsnew/fragments/8563.bugfix +++ b/doc/whatsnew/fragments/8563.bugfix @@ -1,3 +1,3 @@ -Improve output of ``consider-using-generator`` message for ``min()` calls with ``default`` keyword. +Improve output of ``consider-using-generator`` message for ``min()`` calls with ``default`` keyword. Closes #8563 From cfd668c1d46f6072cb9746621f2a9bda5082727a Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sat, 1 Jul 2023 11:47:01 -0400 Subject: [PATCH 2/3] Use walrus operator to avoid mypy disable --- pylint/checkers/refactoring/refactoring_checker.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/pylint/checkers/refactoring/refactoring_checker.py b/pylint/checkers/refactoring/refactoring_checker.py index d873e9c60d..e068468267 100644 --- a/pylint/checkers/refactoring/refactoring_checker.py +++ b/pylint/checkers/refactoring/refactoring_checker.py @@ -1133,16 +1133,12 @@ def _check_super_with_arguments(self, node: nodes.Call) -> None: if not isinstance(node.func, nodes.Name) or node.func.name != "super": return - # pylint: disable=too-many-boolean-expressions if ( len(node.args) != 2 - or not isinstance(node.args[1], nodes.Name) + or not all(isinstance(arg, nodes.Name) for arg in node.args) or node.args[1].name != "self" - or not isinstance(node.args[0], nodes.Name) - or not isinstance(node.args[1], nodes.Name) - or node_frame_class(node) is None - # TODO: PY38: Use walrus operator, this will also fix the mypy issue - or node.args[0].name != node_frame_class(node).name # type: ignore[union-attr] + or (frame_class := node_frame_class(node)) is None + or node.args[0].name != frame_class.name ): return From 90459ef2da9f1cfcd44e39fe44a694767c112ffb Mon Sep 17 00:00:00 2001 From: Jacob Walls Date: Sat, 1 Jul 2023 12:15:24 -0400 Subject: [PATCH 3/3] Clean up tests that had min_pyver=3.8 test setting Follow-up to 0754b1deaabe3c699c98fa08ac4f0fac0e867c01. --- .../a/alternative/alternative_union_syntax_error.rc | 1 - .../a/alternative/alternative_union_syntax_py37.rc | 3 --- tests/functional/a/assignment/assignment_expression.rc | 2 -- .../functional/a/attribute_defined_outside_init_py38.rc | 3 --- tests/functional/b/bad_reversed_sequence_py38.rc | 2 -- tests/functional/c/cached_property.rc | 2 -- tests/functional/d/deprecated/deprecated_methods_py38.rc | 1 - .../consider_refactoring_into_while_condition_py38.rc | 2 -- tests/functional/ext/docparams/docparams_py38.rc | 3 --- tests/functional/ext/docparams/missing_param_doc_py38.rc | 3 --- tests/functional/ext/no_self_use/no_self_use.rc | 3 --- .../functional/ext/typing/typing_consider_using_alias.rc | 3 --- .../typing/typing_consider_using_alias_without_future.rc | 3 --- .../functional/ext/typing/typing_consider_using_union.rc | 3 --- .../typing/typing_consider_using_union_without_future.rc | 3 --- .../g/generic_alias/generic_alias_side_effects.rc | 2 -- .../k/keyword_arg_before_vararg_positional_only.rc | 2 -- tests/functional/n/name/name_final.rc | 2 -- tests/functional/n/name/name_final_snake_case.rc | 3 --- tests/functional/n/named_expr_without_context_py38.rc | 2 -- tests/functional/n/no/no_method_argument_py38.rc | 2 -- .../non_ascii_name_assignment_expressions.rc | 2 -- .../non_ascii_name_function_argument_py38.rc | 1 - .../n/non_ascii_name/non_ascii_name_kwargs_py38.rc | 1 - .../non_ascii_name_pos_and_kwonly_function.rc | 2 -- tests/functional/n/none_dunder_protocols_py38.rc | 2 -- tests/functional/o/overridden_final_method_py38.rc | 2 -- tests/functional/p/positional_only_arguments_expected.rc | 2 -- .../p/postponed/postponed_evaluation_pep585.rc | 1 - .../p/postponed/postponed_evaluation_pep585_error.rc | 1 - tests/functional/p/protocol_classes.rc | 2 -- tests/functional/p/protocol_classes_abstract.rc | 2 -- tests/functional/r/redundant_u_string_prefix.rc | 2 -- tests/functional/r/regression/regression_posonly_args.rc | 2 -- tests/functional/r/regression_02/regression_4660.rc | 2 -- .../s/singledispatch/singledispatch_method_py38.rc | 2 -- .../singledispatch/singledispatchmethod_function_py38.rc | 2 -- tests/functional/s/subclassed_final_class_py38.rc | 2 -- tests/functional/s/super/super_init_not_called_py38.rc | 2 -- tests/functional/s/superfluous_parens_walrus_py38.rc | 2 -- tests/functional/t/typedDict.rc | 2 -- .../u/undefined/undefined_loop_variable_py38.rc | 2 -- tests/functional/u/undefined/undefined_variable_py38.rc | 2 -- .../functional/u/undefined/undefined_variable_typing.rc | 4 ---- .../u/unnecessary/unnecessary_lambda_assignment.py | 4 ++++ .../u/unnecessary/unnecessary_lambda_assignment.txt | 1 + .../u/unnecessary/unnecessary_lambda_assignment_py38.py | 4 ---- .../u/unnecessary/unnecessary_lambda_assignment_py38.rc | 2 -- .../u/unnecessary/unnecessary_lambda_assignment_py38.txt | 1 - .../u/unnecessary/unnecessary_list_index_lookup.py | 4 ++++ .../u/unnecessary/unnecessary_list_index_lookup_py38.py | 9 --------- .../u/unnecessary/unnecessary_list_index_lookup_py38.rc | 2 -- tests/functional/u/unspecified_encoding_py38.rc | 2 -- .../u/unused/unused_import_positional_only_py38.rc | 2 -- ...unused_name_in_string_literal_type_annotation_py38.rc | 2 -- tests/functional/u/unused/unused_typing_imports.rc | 3 --- tests/functional/u/unused/unused_variable_py38.rc | 3 --- ...assignment_except_handler_for_try_with_return_py38.rc | 2 -- .../functional/u/used/used_before_assignment_ternary.rc | 2 -- .../u/useless/useless_parent_delegation_py38.rc | 2 -- 60 files changed, 9 insertions(+), 130 deletions(-) delete mode 100644 tests/functional/a/assignment/assignment_expression.rc delete mode 100644 tests/functional/b/bad_reversed_sequence_py38.rc delete mode 100644 tests/functional/c/cached_property.rc delete mode 100644 tests/functional/g/generic_alias/generic_alias_side_effects.rc delete mode 100644 tests/functional/k/keyword_arg_before_vararg_positional_only.rc delete mode 100644 tests/functional/n/name/name_final.rc delete mode 100644 tests/functional/n/named_expr_without_context_py38.rc delete mode 100644 tests/functional/n/no/no_method_argument_py38.rc delete mode 100644 tests/functional/n/non_ascii_name/non_ascii_name_assignment_expressions.rc delete mode 100644 tests/functional/n/non_ascii_name/non_ascii_name_pos_and_kwonly_function.rc delete mode 100644 tests/functional/n/none_dunder_protocols_py38.rc delete mode 100644 tests/functional/o/overridden_final_method_py38.rc delete mode 100644 tests/functional/p/positional_only_arguments_expected.rc delete mode 100644 tests/functional/p/protocol_classes.rc delete mode 100644 tests/functional/p/protocol_classes_abstract.rc delete mode 100644 tests/functional/r/redundant_u_string_prefix.rc delete mode 100644 tests/functional/r/regression/regression_posonly_args.rc delete mode 100644 tests/functional/r/regression_02/regression_4660.rc delete mode 100644 tests/functional/s/singledispatch/singledispatch_method_py38.rc delete mode 100644 tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc delete mode 100644 tests/functional/s/subclassed_final_class_py38.rc delete mode 100644 tests/functional/s/super/super_init_not_called_py38.rc delete mode 100644 tests/functional/s/superfluous_parens_walrus_py38.rc delete mode 100644 tests/functional/t/typedDict.rc delete mode 100644 tests/functional/u/undefined/undefined_loop_variable_py38.rc delete mode 100644 tests/functional/u/undefined/undefined_variable_py38.rc delete mode 100644 tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.py delete mode 100644 tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.rc delete mode 100644 tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.txt delete mode 100644 tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.py delete mode 100644 tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.rc delete mode 100644 tests/functional/u/unspecified_encoding_py38.rc delete mode 100644 tests/functional/u/unused/unused_import_positional_only_py38.rc delete mode 100644 tests/functional/u/unused/unused_name_in_string_literal_type_annotation_py38.rc delete mode 100644 tests/functional/u/unused/unused_typing_imports.rc delete mode 100644 tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.rc delete mode 100644 tests/functional/u/used/used_before_assignment_ternary.rc delete mode 100644 tests/functional/u/useless/useless_parent_delegation_py38.rc diff --git a/tests/functional/a/alternative/alternative_union_syntax_error.rc b/tests/functional/a/alternative/alternative_union_syntax_error.rc index 44063ad8c7..5dc39b1a65 100644 --- a/tests/functional/a/alternative/alternative_union_syntax_error.rc +++ b/tests/functional/a/alternative/alternative_union_syntax_error.rc @@ -2,5 +2,4 @@ py-version=3.8 [testoptions] -min_pyver=3.8 max_pyver=3.10 diff --git a/tests/functional/a/alternative/alternative_union_syntax_py37.rc b/tests/functional/a/alternative/alternative_union_syntax_py37.rc index c4d51566df..6f046622fa 100644 --- a/tests/functional/a/alternative/alternative_union_syntax_py37.rc +++ b/tests/functional/a/alternative/alternative_union_syntax_py37.rc @@ -1,5 +1,2 @@ [main] py-version=3.8 - -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/a/assignment/assignment_expression.rc b/tests/functional/a/assignment/assignment_expression.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/a/assignment/assignment_expression.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/a/attribute_defined_outside_init_py38.rc b/tests/functional/a/attribute_defined_outside_init_py38.rc index 1bfb860e8f..825e13ec0b 100644 --- a/tests/functional/a/attribute_defined_outside_init_py38.rc +++ b/tests/functional/a/attribute_defined_outside_init_py38.rc @@ -1,5 +1,2 @@ [main] load-plugins=pylint.extensions.typing - -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/b/bad_reversed_sequence_py38.rc b/tests/functional/b/bad_reversed_sequence_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/b/bad_reversed_sequence_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/c/cached_property.rc b/tests/functional/c/cached_property.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/c/cached_property.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/d/deprecated/deprecated_methods_py38.rc b/tests/functional/d/deprecated/deprecated_methods_py38.rc index 35b185fdbc..d584aa9595 100644 --- a/tests/functional/d/deprecated/deprecated_methods_py38.rc +++ b/tests/functional/d/deprecated/deprecated_methods_py38.rc @@ -1,3 +1,2 @@ [testoptions] -min_pyver=3.8 max_pyver=3.9 diff --git a/tests/functional/ext/consider_refactoring_into_while_condition/consider_refactoring_into_while_condition_py38.rc b/tests/functional/ext/consider_refactoring_into_while_condition/consider_refactoring_into_while_condition_py38.rc index 8c697ac8e1..7895977367 100644 --- a/tests/functional/ext/consider_refactoring_into_while_condition/consider_refactoring_into_while_condition_py38.rc +++ b/tests/functional/ext/consider_refactoring_into_while_condition/consider_refactoring_into_while_condition_py38.rc @@ -1,4 +1,2 @@ [MAIN] load-plugins=pylint.extensions.consider_refactoring_into_while_condition, -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/ext/docparams/docparams_py38.rc b/tests/functional/ext/docparams/docparams_py38.rc index 8b1c245088..24fa52ef43 100644 --- a/tests/functional/ext/docparams/docparams_py38.rc +++ b/tests/functional/ext/docparams/docparams_py38.rc @@ -6,6 +6,3 @@ accept-no-param-doc = no accept-no-raise-doc = no accept-no-return-doc = no accept-no-yields-doc = no - -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/ext/docparams/missing_param_doc_py38.rc b/tests/functional/ext/docparams/missing_param_doc_py38.rc index 9e58d2f8c7..d4a6dc172f 100644 --- a/tests/functional/ext/docparams/missing_param_doc_py38.rc +++ b/tests/functional/ext/docparams/missing_param_doc_py38.rc @@ -1,9 +1,6 @@ [MASTER] load-plugins=pylint.extensions.docparams, -[testoptions] -min_pyver=3.8 - [PARAMETER_DOCUMENTATION] accept-no-param-doc=no accept-no-raise-doc=no diff --git a/tests/functional/ext/no_self_use/no_self_use.rc b/tests/functional/ext/no_self_use/no_self_use.rc index 4a8b2f571e..d199925bb0 100644 --- a/tests/functional/ext/no_self_use/no_self_use.rc +++ b/tests/functional/ext/no_self_use/no_self_use.rc @@ -1,5 +1,2 @@ [main] load-plugins=pylint.extensions.no_self_use - -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/ext/typing/typing_consider_using_alias.rc b/tests/functional/ext/typing/typing_consider_using_alias.rc index 4e5e75f5d8..6b20e8a90c 100644 --- a/tests/functional/ext/typing/typing_consider_using_alias.rc +++ b/tests/functional/ext/typing/typing_consider_using_alias.rc @@ -2,8 +2,5 @@ py-version=3.8 load-plugins=pylint.extensions.typing -[testoptions] -min_pyver=3.8 - [typing] runtime-typing=no diff --git a/tests/functional/ext/typing/typing_consider_using_alias_without_future.rc b/tests/functional/ext/typing/typing_consider_using_alias_without_future.rc index 4e5e75f5d8..6b20e8a90c 100644 --- a/tests/functional/ext/typing/typing_consider_using_alias_without_future.rc +++ b/tests/functional/ext/typing/typing_consider_using_alias_without_future.rc @@ -2,8 +2,5 @@ py-version=3.8 load-plugins=pylint.extensions.typing -[testoptions] -min_pyver=3.8 - [typing] runtime-typing=no diff --git a/tests/functional/ext/typing/typing_consider_using_union.rc b/tests/functional/ext/typing/typing_consider_using_union.rc index 4e5e75f5d8..6b20e8a90c 100644 --- a/tests/functional/ext/typing/typing_consider_using_union.rc +++ b/tests/functional/ext/typing/typing_consider_using_union.rc @@ -2,8 +2,5 @@ py-version=3.8 load-plugins=pylint.extensions.typing -[testoptions] -min_pyver=3.8 - [typing] runtime-typing=no diff --git a/tests/functional/ext/typing/typing_consider_using_union_without_future.rc b/tests/functional/ext/typing/typing_consider_using_union_without_future.rc index 4e5e75f5d8..6b20e8a90c 100644 --- a/tests/functional/ext/typing/typing_consider_using_union_without_future.rc +++ b/tests/functional/ext/typing/typing_consider_using_union_without_future.rc @@ -2,8 +2,5 @@ py-version=3.8 load-plugins=pylint.extensions.typing -[testoptions] -min_pyver=3.8 - [typing] runtime-typing=no diff --git a/tests/functional/g/generic_alias/generic_alias_side_effects.rc b/tests/functional/g/generic_alias/generic_alias_side_effects.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/g/generic_alias/generic_alias_side_effects.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/k/keyword_arg_before_vararg_positional_only.rc b/tests/functional/k/keyword_arg_before_vararg_positional_only.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/k/keyword_arg_before_vararg_positional_only.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/n/name/name_final.rc b/tests/functional/n/name/name_final.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/n/name/name_final.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/n/name/name_final_snake_case.rc b/tests/functional/n/name/name_final_snake_case.rc index 43700a640e..c2e3c07d5a 100644 --- a/tests/functional/n/name/name_final_snake_case.rc +++ b/tests/functional/n/name/name_final_snake_case.rc @@ -1,6 +1,3 @@ -[testoptions] -min_pyver=3.8 - [BASIC] class-const-naming-style=snake_case const-naming-style=snake_case diff --git a/tests/functional/n/named_expr_without_context_py38.rc b/tests/functional/n/named_expr_without_context_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/n/named_expr_without_context_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/n/no/no_method_argument_py38.rc b/tests/functional/n/no/no_method_argument_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/n/no/no_method_argument_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/n/non_ascii_name/non_ascii_name_assignment_expressions.rc b/tests/functional/n/non_ascii_name/non_ascii_name_assignment_expressions.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/n/non_ascii_name/non_ascii_name_assignment_expressions.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/n/non_ascii_name/non_ascii_name_function_argument_py38.rc b/tests/functional/n/non_ascii_name/non_ascii_name_function_argument_py38.rc index 35b185fdbc..d584aa9595 100644 --- a/tests/functional/n/non_ascii_name/non_ascii_name_function_argument_py38.rc +++ b/tests/functional/n/non_ascii_name/non_ascii_name_function_argument_py38.rc @@ -1,3 +1,2 @@ [testoptions] -min_pyver=3.8 max_pyver=3.9 diff --git a/tests/functional/n/non_ascii_name/non_ascii_name_kwargs_py38.rc b/tests/functional/n/non_ascii_name/non_ascii_name_kwargs_py38.rc index 35b185fdbc..d584aa9595 100644 --- a/tests/functional/n/non_ascii_name/non_ascii_name_kwargs_py38.rc +++ b/tests/functional/n/non_ascii_name/non_ascii_name_kwargs_py38.rc @@ -1,3 +1,2 @@ [testoptions] -min_pyver=3.8 max_pyver=3.9 diff --git a/tests/functional/n/non_ascii_name/non_ascii_name_pos_and_kwonly_function.rc b/tests/functional/n/non_ascii_name/non_ascii_name_pos_and_kwonly_function.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/n/non_ascii_name/non_ascii_name_pos_and_kwonly_function.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/n/none_dunder_protocols_py38.rc b/tests/functional/n/none_dunder_protocols_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/n/none_dunder_protocols_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/o/overridden_final_method_py38.rc b/tests/functional/o/overridden_final_method_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/o/overridden_final_method_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/p/positional_only_arguments_expected.rc b/tests/functional/p/positional_only_arguments_expected.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/p/positional_only_arguments_expected.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/p/postponed/postponed_evaluation_pep585.rc b/tests/functional/p/postponed/postponed_evaluation_pep585.rc index 35b185fdbc..d584aa9595 100644 --- a/tests/functional/p/postponed/postponed_evaluation_pep585.rc +++ b/tests/functional/p/postponed/postponed_evaluation_pep585.rc @@ -1,3 +1,2 @@ [testoptions] -min_pyver=3.8 max_pyver=3.9 diff --git a/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc b/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc index 35b185fdbc..d584aa9595 100644 --- a/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc +++ b/tests/functional/p/postponed/postponed_evaluation_pep585_error.rc @@ -1,3 +1,2 @@ [testoptions] -min_pyver=3.8 max_pyver=3.9 diff --git a/tests/functional/p/protocol_classes.rc b/tests/functional/p/protocol_classes.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/p/protocol_classes.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/p/protocol_classes_abstract.rc b/tests/functional/p/protocol_classes_abstract.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/p/protocol_classes_abstract.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/r/redundant_u_string_prefix.rc b/tests/functional/r/redundant_u_string_prefix.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/r/redundant_u_string_prefix.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/r/regression/regression_posonly_args.rc b/tests/functional/r/regression/regression_posonly_args.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/r/regression/regression_posonly_args.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/r/regression_02/regression_4660.rc b/tests/functional/r/regression_02/regression_4660.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/r/regression_02/regression_4660.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/s/singledispatch/singledispatch_method_py38.rc b/tests/functional/s/singledispatch/singledispatch_method_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/s/singledispatch/singledispatch_method_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc b/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/s/singledispatch/singledispatchmethod_function_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/s/subclassed_final_class_py38.rc b/tests/functional/s/subclassed_final_class_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/s/subclassed_final_class_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/s/super/super_init_not_called_py38.rc b/tests/functional/s/super/super_init_not_called_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/s/super/super_init_not_called_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/s/superfluous_parens_walrus_py38.rc b/tests/functional/s/superfluous_parens_walrus_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/s/superfluous_parens_walrus_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/t/typedDict.rc b/tests/functional/t/typedDict.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/t/typedDict.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/undefined/undefined_loop_variable_py38.rc b/tests/functional/u/undefined/undefined_loop_variable_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/undefined/undefined_loop_variable_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/undefined/undefined_variable_py38.rc b/tests/functional/u/undefined/undefined_variable_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/undefined/undefined_variable_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/undefined/undefined_variable_typing.rc b/tests/functional/u/undefined/undefined_variable_typing.rc index ed878a9ff4..e7e36f2942 100644 --- a/tests/functional/u/undefined/undefined_variable_typing.rc +++ b/tests/functional/u/undefined/undefined_variable_typing.rc @@ -1,6 +1,2 @@ -[testoptions] -# This was added as PyPy is only able to run this on 3.8 and above -min_pyver=3.8 - [VARIABLES] additional-builtins=__additional_builtin__ diff --git a/tests/functional/u/unnecessary/unnecessary_lambda_assignment.py b/tests/functional/u/unnecessary/unnecessary_lambda_assignment.py index ea846147e7..cad5cc4ac4 100644 --- a/tests/functional/u/unnecessary/unnecessary_lambda_assignment.py +++ b/tests/functional/u/unnecessary/unnecessary_lambda_assignment.py @@ -32,3 +32,7 @@ DICT = {1: lambda x: x, 2: lambda x: x + 1} for key, value in DICT.items(): print(value(key)) + +# Flag lambda expression assignments via named expressions as well. +if (e := lambda: 2) and e(): # [unnecessary-lambda-assignment] + pass diff --git a/tests/functional/u/unnecessary/unnecessary_lambda_assignment.txt b/tests/functional/u/unnecessary/unnecessary_lambda_assignment.txt index 0945b7769e..150e738cdf 100644 --- a/tests/functional/u/unnecessary/unnecessary_lambda_assignment.txt +++ b/tests/functional/u/unnecessary/unnecessary_lambda_assignment.txt @@ -12,3 +12,4 @@ unnecessary-lambda-assignment:22:4:22:15::"Lambda expression assigned to unnecessary-lambda-assignment:23:4:23:15::"Lambda expression assigned to a variable. Define a function using the ""def"" keyword instead.":HIGH unnecessary-lambda-assignment:26:10:26:21::"Lambda expression assigned to a variable. Define a function using the ""def"" keyword instead.":HIGH unnecessary-lambda-assignment:26:23:26:34::"Lambda expression assigned to a variable. Define a function using the ""def"" keyword instead.":HIGH +unnecessary-lambda-assignment:37:9:37:18::"Lambda expression assigned to a variable. Define a function using the ""def"" keyword instead.":HIGH diff --git a/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.py b/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.py deleted file mode 100644 index f77b3e6310..0000000000 --- a/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.py +++ /dev/null @@ -1,4 +0,0 @@ -"""Test assignment of lambda expressions to a variable.""" -# Flag lambda expression assignments via named expressions as well. -if (c := lambda: 2) and c(): # [unnecessary-lambda-assignment] - pass diff --git a/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.rc b/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.txt b/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.txt deleted file mode 100644 index 4e16485b38..0000000000 --- a/tests/functional/u/unnecessary/unnecessary_lambda_assignment_py38.txt +++ /dev/null @@ -1 +0,0 @@ -unnecessary-lambda-assignment:3:9:3:18::"Lambda expression assigned to a variable. Define a function using the ""def"" keyword instead.":HIGH diff --git a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py index a30416b444..3201d5407d 100644 --- a/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py +++ b/tests/functional/u/unnecessary/unnecessary_list_index_lookup.py @@ -152,3 +152,7 @@ def _get_extra_attrs(self, extra_columns): nums = list(range(20)) for y, x in enumerate(nums, start=Y_START + 1): pass + +for idx, val in enumerate(my_list): + if (val := 42) and my_list[idx] == 'b': + print(1) diff --git a/tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.py b/tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.py deleted file mode 100644 index b1322e03f0..0000000000 --- a/tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.py +++ /dev/null @@ -1,9 +0,0 @@ -"""Tests for unnecessary-list-index-lookup with assignment expressions.""" - -# pylint: disable=missing-docstring, too-few-public-methods, expression-not-assigned, line-too-long, unused-variable - -my_list = ['a', 'b'] - -for idx, val in enumerate(my_list): - if (val := 42) and my_list[idx] == 'b': - print(1) diff --git a/tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.rc b/tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/unnecessary/unnecessary_list_index_lookup_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/unspecified_encoding_py38.rc b/tests/functional/u/unspecified_encoding_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/unspecified_encoding_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/unused/unused_import_positional_only_py38.rc b/tests/functional/u/unused/unused_import_positional_only_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/unused/unused_import_positional_only_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/unused/unused_name_in_string_literal_type_annotation_py38.rc b/tests/functional/u/unused/unused_name_in_string_literal_type_annotation_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/unused/unused_name_in_string_literal_type_annotation_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/unused/unused_typing_imports.rc b/tests/functional/u/unused/unused_typing_imports.rc deleted file mode 100644 index c53d281326..0000000000 --- a/tests/functional/u/unused/unused_typing_imports.rc +++ /dev/null @@ -1,3 +0,0 @@ -[testoptions] -# This was added as PyPy is only able to run this on 3.8 and above -min_pyver=3.8 diff --git a/tests/functional/u/unused/unused_variable_py38.rc b/tests/functional/u/unused/unused_variable_py38.rc index 25a81a70fa..5dcd4a84c4 100644 --- a/tests/functional/u/unused/unused_variable_py38.rc +++ b/tests/functional/u/unused/unused_variable_py38.rc @@ -1,5 +1,2 @@ -[testoptions] -min_pyver=3.8 - [variables] allow-global-unused-variables=no diff --git a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.rc b/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/use/used_before_assignment_except_handler_for_try_with_return_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/used/used_before_assignment_ternary.rc b/tests/functional/u/used/used_before_assignment_ternary.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/used/used_before_assignment_ternary.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8 diff --git a/tests/functional/u/useless/useless_parent_delegation_py38.rc b/tests/functional/u/useless/useless_parent_delegation_py38.rc deleted file mode 100644 index 85fc502b37..0000000000 --- a/tests/functional/u/useless/useless_parent_delegation_py38.rc +++ /dev/null @@ -1,2 +0,0 @@ -[testoptions] -min_pyver=3.8