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

Method visit_BoolOp

mypy/fastparse.py:1476–1488  ·  view source on GitHub ↗
(self, n: ast3.BoolOp)

Source from the content-addressed store, hash-verified

1474
1475 # BoolOp(boolop op, expr* values)
1476 def visit_BoolOp(self, n: ast3.BoolOp) -> OpExpr:
1477 # mypy translates (1 and 2 and 3) as (1 and (2 and 3))
1478 assert len(n.values) >= 2
1479 op_node = n.op
1480 if isinstance(op_node, ast3.And):
1481 op = "and"
1482 elif isinstance(op_node, ast3.Or):
1483 op = "or"
1484 else:
1485 raise RuntimeError("unknown BoolOp " + str(type(n)))
1486
1487 # potentially inefficient!
1488 return self.group(op, self.translate_expr_list(n.values), n)
1489
1490 def group(self, op: str, vals: list[Expression], n: ast3.expr) -> OpExpr:
1491 if len(vals) == 2:

Callers

nothing calls this directly

Calls 7

groupMethod · 0.95
translate_expr_listMethod · 0.95
lenFunction · 0.85
isinstanceFunction · 0.85
RuntimeErrorClass · 0.85
strClass · 0.85
typeClass · 0.85

Tested by

no test coverage detected