MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / operate

Method operate

lib/sqlalchemy/sql/operators.py:427–453  ·  view source on GitHub ↗

r"""Operate on an argument. This is the lowest level of operation, raises :class:`NotImplementedError` by default. Overriding this on a subclass can allow common behavior to be applied to all operations. For example, overriding :class:`.ColumnOperators`

(
        self, op: OperatorType, *other: Any, **kwargs: Any
    )

Source from the content-addressed store, hash-verified

425 )
426
427 def operate(
428 self, op: OperatorType, *other: Any, **kwargs: Any
429 ) -> Operators:
430 r"""Operate on an argument.
431
432 This is the lowest level of operation, raises
433 :class:`NotImplementedError` by default.
434
435 Overriding this on a subclass can allow common
436 behavior to be applied to all operations.
437 For example, overriding :class:`.ColumnOperators`
438 to apply ``func.lower()`` to the left and right
439 side::
440
441 class MyComparator(ColumnOperators):
442 def operate(self, op, other, **kwargs):
443 return op(func.lower(self), func.lower(other), **kwargs)
444
445 :param op: Operator callable.
446 :param \*other: the 'other' side of the operation. Will
447 be a single scalar for most operations.
448 :param \**kwargs: modifiers. These may be passed by special
449 operators such as :meth:`ColumnOperators.contains`.
450
451
452 """
453 raise NotImplementedError(str(op))
454
455 __sa_operate__ = operate
456

Callers 5

__and__Method · 0.95
__or__Method · 0.95
__invert__Method · 0.95
_null_operateMethod · 0.95
__call__Method · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected