def __lshift__(self, other: Any) -> ColumnElement[Any]: ...
+ @overload
+ def __rlshift__(self: _SQO[int], other: Any) -> ColumnElement[int]: ...
+
+ @overload
+ def __rlshift__(self, other: Any) -> ColumnElement[Any]: ...
+
+ def __rlshift__(self, other: Any) -> ColumnElement[Any]: ...
+
@overload
def __rshift__(self: _SQO[int], other: Any) -> ColumnElement[int]: ...
def __rshift__(self, other: Any) -> ColumnElement[Any]: ...
+ @overload
+ def __rrshift__(self: _SQO[int], other: Any) -> ColumnElement[int]: ...
+
+ @overload
+ def __rrshift__(self, other: Any) -> ColumnElement[Any]: ...
+
+ def __rrshift__(self, other: Any) -> ColumnElement[Any]: ...
+
def __matmul__(self, other: Any) -> ColumnElement[Any]: ...
def __rmatmul__(self, other: Any) -> ColumnElement[Any]: ...
return self.operate(getitem, index)
def __lshift__(self, other: Any) -> ColumnOperators:
- """implement the << operator.
+ """Implement the ``<<`` operator.
Not used by SQLAlchemy core, this is provided
for custom operator systems which want to use
"""
return self.operate(lshift, other)
+ def __rlshift__(self, other: Any) -> ColumnOperators:
+ """Implement the ``<<`` operator.
+
+ Not used by SQLAlchemy core, this is provided
+ for custom operator systems which want to use
+ << as an extension point.
+ """
+ return self.reverse_operate(lshift, other)
+
def __rshift__(self, other: Any) -> ColumnOperators:
- """implement the >> operator.
+ """Implement the ``>>`` operator.
Not used by SQLAlchemy core, this is provided
for custom operator systems which want to use
"""
return self.operate(rshift, other)
+ def __rrshift__(self, other: Any) -> ColumnOperators:
+ """Implement the ``>>`` operator in reverse.
+
+ Not used by SQLAlchemy core, this is provided
+ for custom operator systems which want to use
+ >> as an extension point.
+ """
+ return self.reverse_operate(rshift, other)
+
def __matmul__(self, other: Any) -> ColumnOperators:
"""Implement the ``@`` operator.
self.assert_compile(Column("x", MyType()) << 5, "x -> :x_1")
+ def test_rlshift(self):
+ class MyType(UserDefinedType):
+ cache_ok = True
+
+ class comparator_factory(UserDefinedType.Comparator):
+ def __rlshift__(self, other):
+ return self.op("->")(other)
+
+ self.assert_compile(5 << Column("x", MyType()), "x -> :x_1")
+
def test_rshift(self):
class MyType(UserDefinedType):
cache_ok = True
self.assert_compile(Column("x", MyType()) >> 5, "x -> :x_1")
+ def test_rrshift(self):
+ class MyType(UserDefinedType):
+ cache_ok = True
+
+ class comparator_factory(UserDefinedType.Comparator):
+ def __rrshift__(self, other):
+ return self.op("->")(other)
+
+ self.assert_compile(5 >> Column("x", MyType()), "x -> :x_1")
+
def test_matmul(self):
class MyType(UserDefinedType):
cache_ok = True