| 3491 | ) |
| 3492 | |
| 3493 | def _generate_generic_binary( |
| 3494 | self, |
| 3495 | binary: BinaryExpression[Any], |
| 3496 | opstring: str, |
| 3497 | eager_grouping: bool = False, |
| 3498 | **kw: Any, |
| 3499 | ) -> str: |
| 3500 | _in_operator_expression = kw.get("_in_operator_expression", False) |
| 3501 | |
| 3502 | kw["_in_operator_expression"] = True |
| 3503 | kw["_binary_op"] = binary.operator |
| 3504 | text = ( |
| 3505 | binary.left._compiler_dispatch( |
| 3506 | self, eager_grouping=eager_grouping, **kw |
| 3507 | ) |
| 3508 | + opstring |
| 3509 | + binary.right._compiler_dispatch( |
| 3510 | self, eager_grouping=eager_grouping, **kw |
| 3511 | ) |
| 3512 | ) |
| 3513 | |
| 3514 | if _in_operator_expression and eager_grouping: |
| 3515 | text = "(%s)" % text |
| 3516 | return text |
| 3517 | |
| 3518 | def _generate_generic_unary_operator(self, unary, opstring, **kw): |
| 3519 | return opstring + unary.element._compiler_dispatch(self, **kw) |