From c3120f9825558abd6a08a533ea6989ba49ec4967 Mon Sep 17 00:00:00 2001 From: jazzthief Date: Mon, 16 Jan 2023 17:25:00 +0100 Subject: [PATCH] Add NOT implementation; update lookup dict --- lib/sqlalchemy/sql/default_comparator.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/sqlalchemy/sql/default_comparator.py b/lib/sqlalchemy/sql/default_comparator.py index 01ca6fb97d..766d80574e 100644 --- a/lib/sqlalchemy/sql/default_comparator.py +++ b/lib/sqlalchemy/sql/default_comparator.py @@ -273,6 +273,16 @@ def _neg_impl( return UnaryExpression(expr, operator=operators.neg, type_=expr.type) +def _bitwise_not_impl( + expr: ColumnElement[Any], op: OperatorType, **kw: Any +) -> ColumnElement[Any]: + """Binary negation implementation""" + + return UnaryExpression( + expr, operator=operators.bitwise_not_op, type_=expr.type + ) + + def _match_impl( expr: ColumnElement[Any], op: OperatorType, other: Any, **kw: Any ) -> ColumnElement[Any]: @@ -423,6 +433,9 @@ operator_lookup: Dict[ "bitwise_xor_op": (_binary_operate, util.EMPTY_DICT), "bitwise_or_op": (_binary_operate, util.EMPTY_DICT), "bitwise_and_op": (_binary_operate, util.EMPTY_DICT), + "bitwise_not_op": (_bitwise_not_impl, util.EMPTY_DICT), + "bitwise_lshift_op": (_binary_operate, util.EMPTY_DICT), + "bitwise_rshift_op": (_binary_operate, util.EMPTY_DICT), "truediv": (_binary_operate, util.EMPTY_DICT), "floordiv": (_binary_operate, util.EMPTY_DICT), "custom_op": (_custom_op_operate, util.EMPTY_DICT), -- 2.47.3