Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

C2901 & C2902: New checks for unnecessary lambda expression usage #6004

Merged
merged 24 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f195459
Lambda expression checker
jpy-git Mar 26, 2022
9dd81ea
Checker ready for review
jpy-git Mar 27, 2022
dc694a1
ignore from existing unit tests
jpy-git Mar 27, 2022
1a56ebf
Uncomment fixed unit test
jpy-git Mar 28, 2022
98c0f47
Update pylint/checkers/lambda_expressions.py
jpy-git Mar 29, 2022
a6f6551
Update pylint/checkers/lambda_expressions.py
jpy-git Mar 29, 2022
85030e3
Include walrus operators in C2901 check
jpy-git Mar 29, 2022
fe552bc
Make walrus operator tests 3.8+ only
jpy-git Mar 29, 2022
da3c80a
Update pylint/checkers/lambda_expressions.py
jpy-git Mar 29, 2022
62b89fb
Update pylint/checkers/lambda_expressions.py
jpy-git Mar 29, 2022
4388bda
Update pylint/checkers/lambda_expressions.py
jpy-git Mar 29, 2022
52d3ade
Update pylint/checkers/lambda_expressions.py
jpy-git Mar 29, 2022
c2fd67f
Update tests/functional/l/lambda_use_before_assign.py
jpy-git Mar 29, 2022
4a80656
Update tests/functional/u/undefined/undefined_variable.py
jpy-git Mar 29, 2022
36560e5
Update tests/functional/u/unnecessary/unnecessary_direct_lambda_call.py
jpy-git Mar 29, 2022
94686ef
Update tests/functional/u/unnecessary/unnecessary_lambda_assignment.py
jpy-git Mar 29, 2022
36b98b9
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Mar 29, 2022
496f479
Review feedback
jpy-git Mar 29, 2022
b7cae61
Regen func test output after review
jpy-git Mar 30, 2022
4bd564c
Add disable in new functional tests
Pierre-Sassoulas May 4, 2022
e7df72d
Remove deprecated implements
Pierre-Sassoulas May 4, 2022
eb68655
Upgrade the message prefix
Pierre-Sassoulas May 4, 2022
adff75c
Disable new tests on PYPY
Pierre-Sassoulas May 4, 2022
c1c46cc
Small formatting and typing changes
DanielNoord May 4, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,13 @@ Release date: TBA

Closes #5670

* ``unnecessary-lambda-assignment``: Lambda expression assigned to a variable.
Define a function using the "def" keyword instead.
``unnecessary-direct-lambda-call``: Lambda expression called directly.
Execute the expression inline instead.

Closes #5976

* ``potential-index-error``: Emitted when the index of a list or tuple exceeds its length.
This checker is currently quite conservative to avoid false positives. We welcome
suggestions for improvements.
Expand Down
1 change: 1 addition & 0 deletions doc/data/messages/u/unnecessary-direct-lambda-call/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
y = (lambda x: x**2 + 2*x + 1)(a) # [unnecessary-direct-lambda-call]
1 change: 1 addition & 0 deletions doc/data/messages/u/unnecessary-direct-lambda-call/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
y = a**2 + 2*a + 1
1 change: 1 addition & 0 deletions doc/data/messages/u/unnecessary-lambda-assignment/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo = lambda x: x**2 + 2*x + 1 # [unnecessary-lambda-assignment]
2 changes: 2 additions & 0 deletions doc/data/messages/u/unnecessary-lambda-assignment/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def foo(x):
return x**2 + 2*x + 1
7 changes: 7 additions & 0 deletions doc/whatsnew/2.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ New checkers

Closes #5936

* ``unnecessary-lambda-assignment``: Lambda expression assigned to a variable.
Define a function using the "def" keyword instead.
``unnecessary-direct-lambda-call``: Lambda expression called directly.
Execute the expression inline instead.

Closes #5976

* ``potential-index-error``: Emitted when the index of a list or tuple exceeds its length.
This checker is currently quite conservative to avoid false positives. We welcome
suggestions for improvements.
Expand Down
93 changes: 93 additions & 0 deletions pylint/checkers/lambda_expressions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Licensed under the GPL: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
# For details: https://github.com/PyCQA/pylint/blob/main/LICENSE
# Copyright (c) https://github.com/PyCQA/pylint/blob/main/CONTRIBUTORS.txt

from __future__ import annotations

from itertools import zip_longest
from typing import TYPE_CHECKING

from astroid import nodes

from pylint.checkers import BaseChecker
from pylint.interfaces import HIGH

if TYPE_CHECKING:
from pylint.lint import PyLinter


class LambdaExpressionChecker(BaseChecker):
"""Check for unnecessary usage of lambda expressions."""

name = "lambda-expressions"
msgs = {
"C3001": (
"Lambda expression assigned to a variable. "
'Define a function using the "def" keyword instead.',
"unnecessary-lambda-assignment",
"Used when a lambda expression is assigned to variable "
'rather than defining a standard function with the "def" keyword.',
),
"C3002": (
"Lambda expression called directly. Execute the expression inline instead.",
"unnecessary-direct-lambda-call",
"Used when a lambda expression is directly called "
"rather than executing its contents inline.",
),
}
options = ()

def visit_assign(self, node: nodes.Assign) -> None:
"""Check if lambda expression is assigned to a variable."""
if isinstance(node.targets[0], nodes.AssignName) and isinstance(
node.value, nodes.Lambda
):
self.add_message(
"unnecessary-lambda-assignment",
node=node.value,
jpy-git marked this conversation as resolved.
Show resolved Hide resolved
confidence=HIGH,
)
elif isinstance(node.targets[0], nodes.Tuple) and isinstance(
node.value, (nodes.Tuple, nodes.List)
):
# Iterate over tuple unpacking assignment elements and
# see if any lambdas are assigned to a variable.
# N.B. We may encounter W0632 (unbalanced-tuple-unpacking)
# and still need to flag the lambdas that are being assigned.
for lhs_elem, rhs_elem in zip_longest(
node.targets[0].elts, node.value.elts
):
if lhs_elem is None or rhs_elem is None:
# unbalanced tuple unpacking. stop checking.
break
if isinstance(lhs_elem, nodes.AssignName) and isinstance(
rhs_elem, nodes.Lambda
):
self.add_message(
"unnecessary-lambda-assignment",
node=rhs_elem,
jpy-git marked this conversation as resolved.
Show resolved Hide resolved
confidence=HIGH,
)

def visit_namedexpr(self, node: nodes.NamedExpr) -> None:
if isinstance(node.target, nodes.AssignName) and isinstance(
node.value, nodes.Lambda
):
self.add_message(
"unnecessary-lambda-assignment",
node=node.value,
jpy-git marked this conversation as resolved.
Show resolved Hide resolved
confidence=HIGH,
)

def visit_call(self, node: nodes.Call) -> None:
"""Check if lambda expression is called directly."""
if isinstance(node.func, nodes.Lambda):
self.add_message(
"unnecessary-direct-lambda-call",
node=node,
jpy-git marked this conversation as resolved.
Show resolved Hide resolved
confidence=HIGH,
)


def register(linter: PyLinter) -> None:
linter.register_checker(LambdaExpressionChecker(linter))
2 changes: 1 addition & 1 deletion tests/functional/a/alternative/alternative_union_syntax.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Test PEP 604 - Alternative Union syntax"""
# pylint: disable=missing-function-docstring,unused-argument,invalid-name,missing-class-docstring
# pylint: disable=inherit-non-class,too-few-public-methods
# pylint: disable=inherit-non-class,too-few-public-methods,unnecessary-direct-lambda-call
import dataclasses
import typing
from dataclasses import dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
For Python 3.7 - 3.9: Everything should fail.
Testing only 3.8/3.9 to support TypedDict.
"""
# pylint: disable=missing-function-docstring,unused-argument,invalid-name,missing-class-docstring,inherit-non-class,too-few-public-methods,line-too-long
# pylint: disable=missing-function-docstring,unused-argument,invalid-name,missing-class-docstring,inherit-non-class,too-few-public-methods,line-too-long,unnecessary-direct-lambda-call
import dataclasses
import typing
from dataclasses import dataclass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
For Python 3.7 - 3.9: Most things should work.
Testing only 3.8/3.9 to support TypedDict.
"""
# pylint: disable=missing-function-docstring,unused-argument,invalid-name,missing-class-docstring,inherit-non-class,too-few-public-methods,line-too-long
# pylint: disable=missing-function-docstring,unused-argument,invalid-name,missing-class-docstring,inherit-non-class,too-few-public-methods,line-too-long,unnecessary-direct-lambda-call
from __future__ import annotations
import dataclasses
import typing
Expand Down
1 change: 1 addition & 0 deletions tests/functional/a/arguments.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# pylint: disable=too-few-public-methods, missing-docstring,import-error,wrong-import-position
# pylint: disable=wrong-import-order, useless-object-inheritance,unnecessary-lambda, consider-using-f-string
# pylint: disable=unnecessary-lambda-assignment

def decorator(fun):
"""Decorator"""
Expand Down
78 changes: 39 additions & 39 deletions tests/functional/a/arguments.txt
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
no-value-for-parameter:46:0:46:16::No value for argument 'first_argument' in function call:UNDEFINED
too-many-function-args:47:0:47:25::Too many positional arguments for function call:UNDEFINED
no-value-for-parameter:49:0:49:25::No value for argument 'third_argument' in function call:UNDEFINED
no-value-for-parameter:51:0:51:17::No value for argument 'first_argument' in function call:UNDEFINED
no-value-for-parameter:51:0:51:17::No value for argument 'second_argument' in function call:UNDEFINED
no-value-for-parameter:51:0:51:17::No value for argument 'third_argument' in function call:UNDEFINED
too-many-function-args:53:0:53:41::Too many positional arguments for function call:UNDEFINED
no-value-for-parameter:58:0:58:21::No value for argument 'first_argument' in function call:UNDEFINED
unexpected-keyword-arg:58:0:58:21::Unexpected keyword argument 'bob' in function call:UNDEFINED
unexpected-keyword-arg:59:0:59:40::Unexpected keyword argument 'coin' in function call:UNDEFINED
redundant-keyword-arg:61:0:61:30::Argument 'one' passed by position and keyword in function call:UNDEFINED
no-value-for-parameter:66:0:66:8::No value for argument 'arg' in lambda call:UNDEFINED
no-value-for-parameter:71:4:71:24:method_tests:No value for argument 'arg' in staticmethod call:UNDEFINED
no-value-for-parameter:72:4:72:29:method_tests:No value for argument 'arg' in staticmethod call:UNDEFINED
no-value-for-parameter:74:4:74:23:method_tests:No value for argument 'arg' in classmethod call:UNDEFINED
no-value-for-parameter:75:4:75:28:method_tests:No value for argument 'arg' in classmethod call:UNDEFINED
no-value-for-parameter:77:4:77:17:method_tests:No value for argument 'arg' in method call:UNDEFINED
no-value-for-parameter:78:4:78:26:method_tests:No value for argument 'arg' in unbound method call:UNDEFINED
no-value-for-parameter:80:4:80:27:method_tests:No value for argument 'arg' in method call:UNDEFINED
no-value-for-parameter:81:4:81:36:method_tests:No value for argument 'arg' in unbound method call:UNDEFINED
no-value-for-parameter:110:8:110:19:TestStaticMethod.func:No value for argument 'first' in staticmethod call:UNDEFINED
too-many-function-args:111:8:111:29:TestStaticMethod.func:Too many positional arguments for staticmethod call:UNDEFINED
too-many-function-args:119:8:119:27:TypeCheckConstructor.test:Too many positional arguments for constructor call:UNDEFINED
no-value-for-parameter:121:8:121:20:TypeCheckConstructor.test:No value for argument 'first' in constructor call:UNDEFINED
no-value-for-parameter:121:8:121:20:TypeCheckConstructor.test:No value for argument 'second' in constructor call:UNDEFINED
no-value-for-parameter:122:8:122:29:TypeCheckConstructor.test:No value for argument 'second' in constructor call:UNDEFINED
unexpected-keyword-arg:122:8:122:29:TypeCheckConstructor.test:Unexpected keyword argument 'lala' in constructor call:UNDEFINED
no-value-for-parameter:133:8:133:18:Test.test:No value for argument 'icon' in method call:UNDEFINED
too-many-function-args:134:8:134:25:Test.test:Too many positional arguments for method call:UNDEFINED
no-value-for-parameter:136:0:136:12::No value for argument 'icon' in method call:UNDEFINED
no-value-for-parameter:163:4:163:29:no_context_but_redefined:No value for argument 'three' in function call:UNDEFINED
no-value-for-parameter:163:4:163:29:no_context_but_redefined:No value for argument 'two' in function call:UNDEFINED
no-value-for-parameter:166:4:166:22:no_context_one_elem:No value for argument 'three' in function call:UNDEFINED
no-value-for-parameter:166:4:166:22:no_context_one_elem:No value for argument 'two' in function call:UNDEFINED
unexpected-keyword-arg:202:23:202:56:namedtuple_replace_issue_1036:Unexpected keyword argument 'd' in method call:UNDEFINED
unexpected-keyword-arg:202:23:202:56:namedtuple_replace_issue_1036:Unexpected keyword argument 'e' in method call:UNDEFINED
no-value-for-parameter:215:0:215:24::No value for argument 'third' in function call:UNDEFINED
no-value-for-parameter:216:0:216:30::No value for argument 'second' in function call:UNDEFINED
unexpected-keyword-arg:217:0:217:43::Unexpected keyword argument 'fourth' in function call:UNDEFINED
no-value-for-parameter:47:0:47:16::No value for argument 'first_argument' in function call:UNDEFINED
too-many-function-args:48:0:48:25::Too many positional arguments for function call:UNDEFINED
no-value-for-parameter:50:0:50:25::No value for argument 'third_argument' in function call:UNDEFINED
no-value-for-parameter:52:0:52:17::No value for argument 'first_argument' in function call:UNDEFINED
no-value-for-parameter:52:0:52:17::No value for argument 'second_argument' in function call:UNDEFINED
no-value-for-parameter:52:0:52:17::No value for argument 'third_argument' in function call:UNDEFINED
too-many-function-args:54:0:54:41::Too many positional arguments for function call:UNDEFINED
no-value-for-parameter:59:0:59:21::No value for argument 'first_argument' in function call:UNDEFINED
unexpected-keyword-arg:59:0:59:21::Unexpected keyword argument 'bob' in function call:UNDEFINED
unexpected-keyword-arg:60:0:60:40::Unexpected keyword argument 'coin' in function call:UNDEFINED
redundant-keyword-arg:62:0:62:30::Argument 'one' passed by position and keyword in function call:UNDEFINED
no-value-for-parameter:67:0:67:8::No value for argument 'arg' in lambda call:UNDEFINED
no-value-for-parameter:72:4:72:24:method_tests:No value for argument 'arg' in staticmethod call:UNDEFINED
no-value-for-parameter:73:4:73:29:method_tests:No value for argument 'arg' in staticmethod call:UNDEFINED
no-value-for-parameter:75:4:75:23:method_tests:No value for argument 'arg' in classmethod call:UNDEFINED
no-value-for-parameter:76:4:76:28:method_tests:No value for argument 'arg' in classmethod call:UNDEFINED
no-value-for-parameter:78:4:78:17:method_tests:No value for argument 'arg' in method call:UNDEFINED
no-value-for-parameter:79:4:79:26:method_tests:No value for argument 'arg' in unbound method call:UNDEFINED
no-value-for-parameter:81:4:81:27:method_tests:No value for argument 'arg' in method call:UNDEFINED
no-value-for-parameter:82:4:82:36:method_tests:No value for argument 'arg' in unbound method call:UNDEFINED
no-value-for-parameter:111:8:111:19:TestStaticMethod.func:No value for argument 'first' in staticmethod call:UNDEFINED
too-many-function-args:112:8:112:29:TestStaticMethod.func:Too many positional arguments for staticmethod call:UNDEFINED
too-many-function-args:120:8:120:27:TypeCheckConstructor.test:Too many positional arguments for constructor call:UNDEFINED
no-value-for-parameter:122:8:122:20:TypeCheckConstructor.test:No value for argument 'first' in constructor call:UNDEFINED
no-value-for-parameter:122:8:122:20:TypeCheckConstructor.test:No value for argument 'second' in constructor call:UNDEFINED
no-value-for-parameter:123:8:123:29:TypeCheckConstructor.test:No value for argument 'second' in constructor call:UNDEFINED
unexpected-keyword-arg:123:8:123:29:TypeCheckConstructor.test:Unexpected keyword argument 'lala' in constructor call:UNDEFINED
no-value-for-parameter:134:8:134:18:Test.test:No value for argument 'icon' in method call:UNDEFINED
too-many-function-args:135:8:135:25:Test.test:Too many positional arguments for method call:UNDEFINED
no-value-for-parameter:137:0:137:12::No value for argument 'icon' in method call:UNDEFINED
no-value-for-parameter:164:4:164:29:no_context_but_redefined:No value for argument 'three' in function call:UNDEFINED
no-value-for-parameter:164:4:164:29:no_context_but_redefined:No value for argument 'two' in function call:UNDEFINED
no-value-for-parameter:167:4:167:22:no_context_one_elem:No value for argument 'three' in function call:UNDEFINED
no-value-for-parameter:167:4:167:22:no_context_one_elem:No value for argument 'two' in function call:UNDEFINED
unexpected-keyword-arg:203:23:203:56:namedtuple_replace_issue_1036:Unexpected keyword argument 'd' in method call:UNDEFINED
unexpected-keyword-arg:203:23:203:56:namedtuple_replace_issue_1036:Unexpected keyword argument 'e' in method call:UNDEFINED
no-value-for-parameter:216:0:216:24::No value for argument 'third' in function call:UNDEFINED
no-value-for-parameter:217:0:217:30::No value for argument 'second' in function call:UNDEFINED
unexpected-keyword-arg:218:0:218:43::Unexpected keyword argument 'fourth' in function call:UNDEFINED
2 changes: 2 additions & 0 deletions tests/functional/a/assignment/assignment_expression.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""Test assignment expressions"""
# pylint: disable=missing-docstring,unused-argument,unused-import,invalid-name
# pylint: disable=blacklisted-name,unused-variable,pointless-statement,unused-variable
# pylint: disable=unnecessary-lambda-assignment

import re

if (a := True):
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/a/assignment/assignment_expression.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
used-before-assignment:21:7:21:12::Using variable 'err_a' before assignment:HIGH
used-before-assignment:22:6:22:11::Using variable 'err_b' before assignment:HIGH
used-before-assignment:24:13:24:18::Using variable 'err_d' before assignment:HIGH
used-before-assignment:23:7:23:12::Using variable 'err_a' before assignment:HIGH
used-before-assignment:24:6:24:11::Using variable 'err_b' before assignment:HIGH
used-before-assignment:26:13:26:18::Using variable 'err_d' before assignment:HIGH
2 changes: 1 addition & 1 deletion tests/functional/c/cellvar_escaping_loop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=unnecessary-comprehension,missing-docstring,too-few-public-methods
# pylint: disable=unnecessary-comprehension,missing-docstring,too-few-public-methods,unnecessary-direct-lambda-call
"""Tests for loopvar-in-closure."""
from __future__ import print_function

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/c/class_scope.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# pylint: disable=too-few-public-methods, useless-object-inheritance
# pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-lambda-assignment
"""check for scope problems"""

__revision__ = None
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/d/decorator_scope.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- pylint: disable=too-few-public-methods, useless-object-inheritance
# -*- pylint: disable=too-few-public-methods, useless-object-inheritance, unnecessary-lambda-assignment
"""Test that decorators sees the class namespace - just like
function default values does but function body doesn't.

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/d/defined_and_used_on_same_line.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Check for definitions and usage happening on the same line."""
#pylint: disable=missing-docstring,multiple-statements,wrong-import-position,unnecessary-comprehension,unspecified-encoding
#pylint: disable=missing-docstring,multiple-statements,wrong-import-position,unnecessary-comprehension,unspecified-encoding,unnecessary-lambda-assignment
from __future__ import print_function
print([index
for index in range(10)])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'py-version' needs to be set to '3.7' or '3.8' and 'runtime-typing=no'.
With 'from __future__ import annotations' present.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unnecessary-direct-lambda-call
from __future__ import annotations

import collections
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'py-version' needs to be set to '3.7' or '3.8' and 'runtime-typing=no'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object,unnecessary-direct-lambda-call
import collections
import collections.abc
import typing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
With 'from __future__ import annotations' present.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long
# pylint: disable=consider-using-alias
# pylint: disable=consider-using-alias,unnecessary-direct-lambda-call
from __future__ import annotations
from dataclasses import dataclass
import typing
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'py-version' needs to be set to >= '3.10'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long
# pylint: disable=deprecated-typing-alias
# pylint: disable=deprecated-typing-alias,unnecessary-direct-lambda-call
from dataclasses import dataclass
import typing
from typing import Dict, List, Optional, Union, TypedDict
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'py-version' needs to be set to >= '3.7' and 'runtime-typing=no'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unnecessary-direct-lambda-call
# pylint: disable=consider-using-alias
from dataclasses import dataclass
import typing
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/ext/typing/typing_deprecated_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

'py-version' needs to be set to >= '3.9'.
"""
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object
# pylint: disable=missing-docstring,invalid-name,unused-argument,line-too-long,unsubscriptable-object,unnecessary-direct-lambda-call
import collections
import collections.abc
import typing
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/g/generic_alias/generic_alias_related.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"""
# flake8: noqa
# pylint: disable=missing-docstring,pointless-statement,expression-not-assigned
# pylint: disable=too-few-public-methods,multiple-statements,line-too-long
# pylint: disable=too-few-public-methods,multiple-statements,line-too-long, unnecessary-lambda-assignment
from abc import ABCMeta, abstractmethod
import typing

Expand Down
2 changes: 1 addition & 1 deletion tests/functional/i/invalid/invalid_bool_returned.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Check invalid value returned by __bool__ """

# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance
# pylint: disable=too-few-public-methods,missing-docstring,no-self-use,import-error, useless-object-inheritance, unnecessary-lambda-assignment
import six

from missing import Missing
Expand Down
Loading