(
expr: ColumnElement[Any],
op: OperatorType,
obj: roles.BinaryElementRole[Any],
*,
reverse: bool = False,
result_type: Optional[TypeEngine[_T]] = None,
**kw: Any,
)
| 161 | |
| 162 | |
| 163 | def _binary_operate( |
| 164 | expr: ColumnElement[Any], |
| 165 | op: OperatorType, |
| 166 | obj: roles.BinaryElementRole[Any], |
| 167 | *, |
| 168 | reverse: bool = False, |
| 169 | result_type: Optional[TypeEngine[_T]] = None, |
| 170 | **kw: Any, |
| 171 | ) -> OperatorExpression[_T]: |
| 172 | coerced_obj = coercions.expect( |
| 173 | roles.BinaryElementRole, obj, expr=expr, operator=op |
| 174 | ) |
| 175 | |
| 176 | if reverse: |
| 177 | left, right = coerced_obj, expr |
| 178 | else: |
| 179 | left, right = expr, coerced_obj |
| 180 | |
| 181 | if result_type is None: |
| 182 | op, result_type = left.comparator._adapt_expression( |
| 183 | op, right.comparator |
| 184 | ) |
| 185 | |
| 186 | return OperatorExpression._construct_for_op( |
| 187 | left, right, op, type_=result_type, modifiers=kw |
| 188 | ) |
| 189 | |
| 190 | |
| 191 | def _conjunction_operate( |
no test coverage detected