Skip to content

Commit 095928c

Browse files
committed
Skip if expressions from f-strings for the check_elif checker
Close #2816
1 parent 60f3939 commit 095928c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

ChangeLog

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ Release date: TBA
3737

3838
* Relicense logo material under the CC BY-SA 4.0 license.
3939

40+
* Skip `if` expressions from f-strings for the `check_elif` checker
41+
42+
Close #2816
43+
4044

4145
What's New in Pylint 2.3.0?
4246
===========================

pylint/extensions/check_elif.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ def process_tokens(self, tokens):
4848
def leave_module(self, _):
4949
self._init()
5050

51-
def visit_ifexp(self, _):
51+
def visit_ifexp(self, node):
52+
if isinstance(node.parent, astroid.FormattedValue):
53+
return
5254
self._if_counter += 1
5355

5456
def visit_comprehension(self, node):

0 commit comments

Comments
 (0)