Skip to content

Commit 80b05d5

Browse files
committed
Apply suggestions from review
1 parent 7cb5eac commit 80b05d5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

mypy/fastparse.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,7 @@ def fix_function_overloads(self, stmts: List[Statement]) -> List[Statement]:
547547
# Add bare IfStmt (without overloads) to ret
548548
# Required for mypy to be able to still check conditions
549549
for if_stmt in skipped_if_stmts:
550-
ASTConverter._strip_contents_from_if_stmt(if_stmt)
550+
self._strip_contents_from_if_stmt(if_stmt)
551551
ret.append(if_stmt)
552552
skipped_if_stmts = []
553553
if len(current_overload) == 1:
@@ -585,7 +585,7 @@ def fix_function_overloads(self, stmts: List[Statement]) -> List[Statement]:
585585
# Add bare IfStmt (without overloads) to ret
586586
# Required for mypy to be able to still check conditions
587587
for if_stmt in skipped_if_stmts:
588-
ASTConverter._strip_contents_from_if_stmt(if_stmt)
588+
self._strip_contents_from_if_stmt(if_stmt)
589589
ret.append(if_stmt)
590590
if len(current_overload) == 1:
591591
ret.append(current_overload[0])
@@ -650,18 +650,17 @@ def _get_executable_if_block_with_overloads(self, stmt: IfStmt) -> Optional[Bloc
650650
return stmt.else_body
651651
return None
652652

653-
@staticmethod
654-
def _strip_contents_from_if_stmt(stmt: IfStmt) -> None:
653+
def _strip_contents_from_if_stmt(self, stmt: IfStmt) -> None:
655654
"""Remove contents from IfStmt.
656655
657656
Needed to still be able to check the conditions after the contents
658-
have been merged with the surrunding function overloads.
657+
have been merged with the surrounding function overloads.
659658
"""
660659
if len(stmt.body) == 1:
661660
stmt.body[0].body = []
662661
if stmt.else_body and len(stmt.else_body.body) == 1:
663662
if isinstance(stmt.else_body.body[0], IfStmt):
664-
ASTConverter._strip_contents_from_if_stmt(stmt.else_body.body[0])
663+
self._strip_contents_from_if_stmt(stmt.else_body.body[0])
665664
else:
666665
stmt.else_body.body = []
667666

0 commit comments

Comments
 (0)