Skip to content

operators

Classes:

SuppRC module-attribute

SuppRC: TypeAlias = SupportsRichComparison

BaseOperator dataclass

BaseOperator(rpn_name: ExprOp)

Methods:

Attributes:

rpn_name instance-attribute

rpn_name: ExprOp

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

BinaryBaseOperator dataclass

BinaryBaseOperator(rpn_name: ExprOp)

Bases: BaseOperator

Methods:

Attributes:

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar
Source code
68
69
70
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

BinaryBoolOperator dataclass

BinaryBoolOperator(rpn_name: ExprOp, function: Callable[[Any, Any], bool])

Bases: BinaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[Any, Any], bool]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar
Source code
68
69
70
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

BinaryMathOperator dataclass

BinaryMathOperator(rpn_name: ExprOp, function: Callable[[T, T], R])

Bases: Generic[T, R], BinaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[T, T], R]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar
Source code
68
69
70
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

BinaryOperator dataclass

BinaryOperator(rpn_name: ExprOp, function: Callable[[T, R], T | R])

Bases: Generic[T, R], BinaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[T, R], T | R]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar
Source code
68
69
70
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

ExprOperators

Methods:

Attributes:

ABS class-attribute instance-attribute

ABS_PIX class-attribute instance-attribute

ABS_PIX = TernaryPixelAccessOperator[Union[int, 'ExprVar']](ABS_PIX)

ADD class-attribute instance-attribute

AND class-attribute instance-attribute

CLAMP class-attribute instance-attribute

CLAMP = TernaryCompOperator(CLAMP, lambda x, y, z: max(y, min(x, z)))

COS class-attribute instance-attribute

DIV class-attribute instance-attribute

DUP class-attribute instance-attribute

DUPN class-attribute instance-attribute

EQ class-attribute instance-attribute

EXP class-attribute instance-attribute

FLOOR class-attribute instance-attribute

FLOOR = UnaryMathOperator[SupportsFloatOrIndex, int](FLOOR, floor)

GT class-attribute instance-attribute

GTE class-attribute instance-attribute

IF class-attribute instance-attribute

IF = TERN

LOG class-attribute instance-attribute

LT class-attribute instance-attribute

LTE class-attribute instance-attribute

MAX class-attribute instance-attribute

MIN class-attribute instance-attribute

MOD class-attribute instance-attribute

MUL class-attribute instance-attribute

NOT class-attribute instance-attribute

OR class-attribute instance-attribute

POW class-attribute instance-attribute

REL_PIX class-attribute instance-attribute

ROUND class-attribute instance-attribute

ROUND = UnaryMathOperator[SupportsRound[int], int](ROUND, lambda x: round(x))

SIN class-attribute instance-attribute

SQRT class-attribute instance-attribute

SUB class-attribute instance-attribute

SWAP class-attribute instance-attribute

SWAPN class-attribute instance-attribute

TERN class-attribute instance-attribute

TERN = TernaryIfOperator(TERN, lambda x, y, z: x if z else y)

TRUNC class-attribute instance-attribute

TRUNC = UnaryMathOperator[SupportsTrunc, int](TRUNC, trunc)

XOR class-attribute instance-attribute

as_var classmethod

as_var(arg0: ExprOtherT) -> ComputedVar
as_var(arg0: Sequence[ExprOtherT]) -> list[ComputedVar]
Source code
235
236
237
238
239
240
@classmethod
def as_var(cls, arg0: ExprOtherT | Sequence[ExprOtherT]) -> ComputedVar | list[ComputedVar]:
    from .variables import ComputedVar
    if isinstance(arg0, Sequence):
        return cast(list[ComputedVar], list(arg0))
    return cast(ComputedVar, arg0)

TernaryBaseOperator dataclass

TernaryBaseOperator(rpn_name: ExprOp)

Bases: BaseOperator

Methods:

Attributes:

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT, arg2: ExprOtherT) -> ComputedVar
Source code
74
75
76
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT, arg2: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, arg2, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

TernaryCompOperator dataclass

TernaryCompOperator(
    rpn_name: ExprOp, function: Callable[[SuppRC, SuppRC, SuppRC], SuppRC]
)

Bases: TernaryBaseOperator

Methods:

Attributes:

function instance-attribute

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT, arg2: ExprOtherT) -> ComputedVar
Source code
74
75
76
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT, arg2: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, arg2, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

TernaryIfOperator dataclass

TernaryIfOperator(
    rpn_name: ExprOp, function: Callable[[bool, T, R], T | R]
)

Bases: TernaryOperator[ExprOtherT, ExprOtherT]

Methods:

Attributes:

function instance-attribute

function: Callable[[bool, T, R], T | R]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(
    cond: ExprOtherT, if_true: ExprOtherT, if_false: ExprOtherT
) -> ComputedVar
Source code
115
116
def __call__(self, cond: ExprOtherT, if_true: ExprOtherT, if_false: ExprOtherT) -> ComputedVar:
    return super().__call__(cond, if_true, if_false)

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

TernaryOperator dataclass

TernaryOperator(rpn_name: ExprOp, function: Callable[[bool, T, R], T | R])

Bases: Generic[T, R], TernaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[bool, T, R], T | R]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT, arg1: ExprOtherT, arg2: ExprOtherT) -> ComputedVar
Source code
74
75
76
def __call__(self, arg0: ExprOtherT, arg1: ExprOtherT, arg2: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, arg1, arg2, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

TernaryPixelAccessOperator dataclass

TernaryPixelAccessOperator(rpn_name: ExprOp)

Bases: Generic[T], TernaryBaseOperator

Methods:

Attributes:

char instance-attribute

char: str

rpn_name instance-attribute

rpn_name: ExprOp

x instance-attribute

x: T

y instance-attribute

y: T

__call__

__call__(char: str, x: T, y: T) -> ComputedVar
Source code
129
130
131
132
def __call__(self, char: str, x: T, y: T) -> ComputedVar:  # type: ignore
    from .variables import ComputedVar
    self.set_vars(char, x, y)
    return ComputedVar([copy(self)])

set_vars

set_vars(char: str, x: T, y: T) -> None
Source code
134
135
136
137
def set_vars(self, char: str, x: T, y: T) -> None:
    self.char = char
    self.x = x
    self.y = y

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

UnaryBaseOperator dataclass

UnaryBaseOperator(rpn_name: ExprOp)

Bases: BaseOperator

Methods:

Attributes:

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT) -> ComputedVar
Source code
62
63
64
def __call__(self, arg0: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

UnaryBoolOperator dataclass

UnaryBoolOperator(rpn_name: ExprOp, function: Callable[[object], bool])

Bases: UnaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[object], bool]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT) -> ComputedVar
Source code
62
63
64
def __call__(self, arg0: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

UnaryMathOperator dataclass

UnaryMathOperator(rpn_name: ExprOp, function: Callable[[T], R])

Bases: Generic[T, R], UnaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[T], R]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT) -> ComputedVar
Source code
62
63
64
def __call__(self, arg0: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)

UnaryOperator dataclass

UnaryOperator(rpn_name: ExprOp, function: Callable[[T], T])

Bases: Generic[T], UnaryBaseOperator

Methods:

Attributes:

function instance-attribute

function: Callable[[T], T]

rpn_name instance-attribute

rpn_name: ExprOp

__call__

__call__(arg0: ExprOtherT) -> ComputedVar
Source code
62
63
64
def __call__(self, arg0: ExprOtherT) -> ComputedVar:
    from .variables import ComputedVar
    return ComputedVar(_normalize_args(arg0, self))

to_str

to_str(**kwargs: Any) -> str
Source code
54
55
def to_str(self, **kwargs: Any) -> str:
    return str(self)