def __rsub__( self, other: datetime.timedelta | pd.Timedelta | IntervalValue, ) -> IntervalValue | NotImplemented: """Subtract `other` from this interval.""" import ibis.expr.operations as ops return _binop(ops.IntervalSubtract, other, self)
def __floordiv__( self, other: ir.IntegerValue, ) -> IntervalValue | NotImplemented: """Floor-divide this interval by `other`.""" import ibis.expr.operations as ops return _binop(ops.IntervalFloorDivide, self, other)
def __add__( self, other: datetime.timedelta | pd.Timedelta | IntervalValue, ) -> IntervalValue | NotImplemented: """Add this interval to `other`.""" import ibis.expr.operations as ops return _binop(ops.IntervalAdd, self, other)
def __add__( self, other: datetime.timedelta | pd.Timedelta | IntervalValue, ) -> TimestampValue | NotImplemented: """Add an interval to a timestamp.""" import ibis.expr.operations as ops return _binop(ops.TimestampAdd, self, other)
def __rfloordiv__( self, other: NumericValue, ) -> NumericValue | NotImplemented: """Floor divide `other` by `self`.""" from ibis.expr import operations as ops return _binop(ops.FloorDivide, other, self)
def __mul__( self, other: int | ir.IntegerValue, ) -> IntervalValue | NotImplemented: """Multiply this interval by `other`.""" import ibis.expr.operations as ops return _binop(ops.IntervalMultiply, self, other)
def __rsub__( self, other: TimeValue | IntervalValue, ) -> IntervalValue | TimeValue | NotImplemented: """Subtract a time or an interval from a time expression.""" import ibis.expr.operations as ops import ibis.expr.rules as rlz other = rlz.any(other) if isinstance(other, TimeValue): op = ops.TimeDiff else: op = ops.TimeSub # let the operation validate return _binop(op, other, self)
def __rsub__( self, other: datetime.date | DateValue | datetime.timedelta | pd.Timedelta | IntervalValue, ) -> IntervalValue | DateValue | NotImplemented: """Subtract a date or an interval from a date.""" import ibis.expr.operations as ops import ibis.expr.rules as rlz other = rlz.one_of([rlz.date, rlz.interval], other) if isinstance(other, DateValue): op = ops.DateDiff else: op = ops.DateSub # let the operation validate return _binop(op, other, self)
def __rsub__( self, other: datetime.datetime | pd.Timestamp | TimestampValue | datetime.timedelta | pd.Timedelta | IntervalValue, ) -> IntervalValue | TimestampValue | NotImplemented: """Subtract a timestamp or an interval from a timestamp.""" import ibis.expr.operations as ops import ibis.expr.rules as rlz right = rlz.any(other) if isinstance(right, TimestampValue): op = ops.TimestampDiff else: op = ops.TimestampSub # let the operation validate return _binop(op, other, self)
def __ge__(self, other: Value) -> ir.BooleanValue: import ibis.expr.operations as ops import ibis.expr.rules as rlz return _binop(ops.GreaterEqual, self, rlz.any(other))
def __xor__(self, other: BooleanValue) -> BooleanValue: from ibis.expr import operations as ops from ibis.expr import rules as rlz return _binop(ops.Xor, self, rlz.any(other))
def __rsub__(self, other: NumericValue) -> NumericValue | NotImplemented: """Substract `self` from `other`.""" from ibis.expr import operations as ops return _binop(ops.Subtract, other, self)
def __mul__(self, n: int | ir.IntegerValue) -> StringValue | NotImplemented: import ibis.expr.operations as ops return _binop(ops.Repeat, self, n)
def __rmod__(self, other: NumericValue) -> NumericValue | NotImplemented: """Compute `other` modulo `self`.""" from ibis.expr import operations as ops return _binop(ops.Modulus, other, self)
def __rpow__(self, other: NumericValue) -> NumericValue | NotImplemented: """Raise `other` to the `self`th power.""" from ibis.expr import operations as ops return _binop(ops.Power, other, self)
def __truediv__(self, other): """Divide `self` by `other`.""" from ibis.expr import operations as ops return _binop(ops.Divide, self, other)
def __mul__(self, other: NumericValue) -> NumericValue | NotImplemented: """Multiply `self` and `other`.""" from ibis.expr import operations as ops return _binop(ops.Multiply, self, other)
def __lt__(self, other: Value) -> ir.BooleanValue: import ibis.expr.operations as ops import ibis.expr.rules as rlz return _binop(ops.Less, self, rlz.any(other))
def __add__(self, other: NumericValue) -> NumericValue | NotImplemented: """Add `self` with `other`.""" from ibis.expr import operations as ops return _binop(ops.Add, self, other)