"""Custom operators for shorthand."""
from typing import Any
from .signature import Signature, op
[docs]
def eq(name: str, other: Any) -> tuple[str, Signature]:
"""Same as using op == other"""
return (name, op == other)
[docs]
def lt(name: str, other: Any) -> tuple[str, Signature]:
"""Same as using op < other"""
return (name, op < other)
[docs]
def le(name: str, other: Any) -> tuple[str, Signature]:
"""Same as using op <= other"""
return (name, op <= other)
[docs]
def gt(name: str, other: Any) -> tuple[str, Signature]:
"""Same as using op > other"""
return (name, op > other)
[docs]
def ge(name: str, other: Any) -> tuple[str, Signature]:
"""Same as using op >= other"""
return (name, op >= other)
[docs]
def ne(name: str, other: Any) -> tuple[str, Signature]:
"""Same as using op != other"""
return (name, op != other)
[docs]
def like(name: str, condition: str) -> tuple[str, Signature]:
"""Like constraint"""
return (name, op.like(condition))
[docs]
def between(name: str, low: int, high: int) -> tuple[str, Signature]:
"""Between constraint"""
return (name, op.between(low, high))
[docs]
def in_(values: list[Any]):
"""In VALUES"""
return this.in_(values)
this = op
__all__ = ["eq", "lt", "le", "gt", "ge", "ne", "like", "between", "this", 'in_']