Skip to content

Commit c9a78b8

Browse files
Revert #1984 to see what goes on in primers
1 parent b7cbe79 commit c9a78b8

File tree

2 files changed

+2
-19
lines changed

2 files changed

+2
-19
lines changed

pylint/checkers/refactoring/refactoring_checker.py

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -546,23 +546,6 @@ def _check_simplifiable_if(self, node):
546546
elif isinstance(first_branch, nodes.Assign):
547547
if not isinstance(else_branch, nodes.Assign):
548548
return
549-
550-
# Check if we assign to the same value
551-
first_branch_targets = [
552-
target.name
553-
for target in first_branch.targets
554-
if isinstance(target, nodes.AssignName)
555-
]
556-
else_branch_targets = [
557-
target.name
558-
for target in else_branch.targets
559-
if isinstance(target, nodes.AssignName)
560-
]
561-
if not first_branch_targets or not else_branch_targets:
562-
return
563-
if sorted(first_branch_targets) != sorted(else_branch_targets):
564-
return
565-
566549
first_branch_is_bool = self._is_bool_const(first_branch)
567550
else_branch_is_bool = self._is_bool_const(else_branch)
568551
reduced_to = "'var = bool(test)'"

tests/functional/s/simplifiable/simplifiable_if_statement.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def test_not_simplifiable_9():
128128
fourth = False
129129
fifth = False
130130

131-
if first and second in third:
131+
if first and second in third: # [simplifiable-if-statement]
132132
fourth = True
133133
else:
134134
fifth = True
@@ -139,7 +139,7 @@ def test_not_simplifiable_10():
139139
# Subscripts are not considered
140140
object_type = 'read'
141141
filter_kwargs = {}
142-
if object_type == 'read':
142+
if object_type == 'read': # [simplifiable-if-statement]
143143
filter_kwargs['a'] = True
144144
else:
145145
filter_kwargs['b'] = True

0 commit comments

Comments
 (0)