Skip to content

Commit 2b16fcf

Browse files
committed
Resolve pylint too-many-branches
1 parent 85adb50 commit 2b16fcf

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

pylint/checkers/refactoring/recommendation_checker.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -417,9 +417,12 @@ def _detect_replacable_format_call(self, node: nodes.Const) -> None:
417417
keyword = utils.safe_infer(keyword.value)
418418

419419
# If lists of more than one element are being unpacked
420-
if isinstance(keyword, nodes.Dict):
421-
if len(keyword.items) > 1 and len(keyword_args) > 1:
422-
return
420+
if (
421+
isinstance(keyword, nodes.Dict)
422+
and len(keyword.items) > 1
423+
and len(keyword_args) > 1
424+
):
425+
return
423426

424427
# If all tests pass, then raise message
425428
self.add_message(
@@ -447,12 +450,10 @@ def _detect_replacable_format_call(self, node: nodes.Const) -> None:
447450
inferred_right = utils.safe_infer(node.parent.right)
448451

449452
# If dicts or lists of length > 1 are used
450-
if isinstance(inferred_right, nodes.Dict):
451-
if len(inferred_right.items) > 1:
452-
return
453-
elif isinstance(inferred_right, nodes.List):
454-
if len(inferred_right.elts) > 1:
455-
return
453+
if isinstance(inferred_right, nodes.Dict) and len(inferred_right.items) > 1:
454+
return
455+
if isinstance(inferred_right, nodes.List) and len(inferred_right.elts) > 1:
456+
return
456457

457458
# If all tests pass, then raise message
458459
self.add_message(

0 commit comments

Comments
 (0)