Skip to content

Refactor operator

Chosson Ulysse requested to merge REFACTOR_operator into main

Refactor operators with new type, Enum of nameTuple:

class OperatorType(_Operator, Enum):
    """Enum of operator type."""

    GT = _Operator(python=">", psql=">", name="greater")
    LT = _Operator(python="<", psql="<", name="lesser")
    GE = _Operator(python=">=", psql=">=", name="greater_equal")
    LE = _Operator(python="<=", psql="<=", name="lesser_equal")
    EQ = _Operator(python="==", psql="=", name="equal")
    NE = _Operator(python="!=", psql="<>", name="not_equal")
    ADD = _Operator(python="+", psql="+", name="add")
    SUB = _Operator(python="-", psql="-", name="sub")
    MUL = _Operator(python="*", psql="*", name="mul")
    TRUEDIV = _Operator(python="/", psql="/", name="div")
    MOD = _Operator(python="%", psql="%", name="mod")
    AND = _Operator(python="&", psql="AND", name="and")
    OR = _Operator(python="|", psql="OR", name="or")
    INVERT = _Operator(python="~", psql="NOT", name="not")
    POW = _Operator(python="**", psql="^", name="pow")
    ABS = _Operator(python="abs", psql="@", name="abs")
    SQRT = _Operator(python="sqrt", psql="|/", name="sqrt")
    CBRT = _Operator(python="cbrt", psql="||/", name="cbrt")
    FACTORIAL = _Operator(python="factorial", psql="factorial", name="factorial")
    POS = _Operator(python="+", psql="+", name="pos")
    NEG = _Operator(python="-", psql="-", name="neg")

Merge request reports

Loading