Return True if node is to be omitted from test case output.
(node: Expression)
| 39 | |
| 40 | |
| 41 | def ignore_node(node: Expression) -> bool: |
| 42 | """Return True if node is to be omitted from test case output.""" |
| 43 | |
| 44 | # We want to get rid of object() expressions in the typing module stub |
| 45 | # and also TypeVar(...) expressions. Since detecting whether a node comes |
| 46 | # from the typing module is not easy, we just to strip them all away. |
| 47 | if isinstance(node, TypeVarExpr): |
| 48 | return True |
| 49 | if isinstance(node, NameExpr) and node.fullname == "builtins.object": |
| 50 | return True |
| 51 | if isinstance(node, NameExpr) and node.fullname == "builtins.None": |
| 52 | return True |
| 53 | if isinstance(node, CallExpr) and (ignore_node(node.callee) or node.analyzed): |
| 54 | return True |
| 55 | |
| 56 | return False |
| 57 | |
| 58 | |
| 59 | # from testtransform |
searching dependent graphs…