Check stmt to make sure it is a stripped IfStmt. See also: strip_contents_from_if_stmt
(stmt: Statement)
| 1697 | |
| 1698 | |
| 1699 | def is_stripped_if_stmt(stmt: Statement) -> bool: |
| 1700 | """Check stmt to make sure it is a stripped IfStmt. |
| 1701 | |
| 1702 | See also: strip_contents_from_if_stmt |
| 1703 | """ |
| 1704 | if not isinstance(stmt, IfStmt): |
| 1705 | return False |
| 1706 | |
| 1707 | if not (len(stmt.body) == 1 and len(stmt.body[0].body) == 0): |
| 1708 | # Body not empty |
| 1709 | return False |
| 1710 | |
| 1711 | if not stmt.else_body or len(stmt.else_body.body) == 0: |
| 1712 | # No or empty else_body |
| 1713 | return True |
| 1714 | |
| 1715 | # For elif, IfStmt are stored recursively in else_body |
| 1716 | return is_stripped_if_stmt(stmt.else_body.body[0]) |
| 1717 | |
| 1718 | |
| 1719 | def fail_merge_overload(state: State, node: IfStmt) -> None: |
no test coverage detected
searching dependent graphs…