MCPcopy
hub / github.com/python/mypy / ignore_node

Function ignore_node

mypy/test/visitors.py:41–56  ·  view source on GitHub ↗

Return True if node is to be omitted from test case output.

(node: Expression)

Source from the content-addressed store, hash-verified

39
40
41def 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

Callers 2

run_caseMethod · 0.90
visit_assignment_stmtMethod · 0.85

Calls 1

isinstanceFunction · 0.85

Tested by 1

run_caseMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…