]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Add NOT implementation; update lookup dict
authorjazzthief <mynameisyegor@gmail.com>
Mon, 16 Jan 2023 16:25:00 +0000 (17:25 +0100)
committerjazzthief <mynameisyegor@gmail.com>
Mon, 16 Jan 2023 16:25:00 +0000 (17:25 +0100)
lib/sqlalchemy/sql/default_comparator.py

index 01ca6fb97db7173a4c9bebb145a7678da64ff58e..766d80574e7a34d25c100aca7dd4d68a5fe93216 100644 (file)
@@ -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),