(self, n: ast3.BoolOp)
| 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: |
nothing calls this directly
no test coverage detected