_decode(self) -> 'Any' | Decode Var as a python value.
Note that Var with state set cannot be decoded python-side and will be
returned as full_name. |
equals(self, other: 'Var') -> 'bool' | Check if two vars are equal. |
to_string(self) -> 'Var' | Convert a var to a string. |
__hash__(self) -> 'int' | Define a hash function for a var. |
__str__(self) -> 'str' | Wrap the var so it can be used in templates. |
__bool__(self) -> 'bool' | Raise exception if using Var in a boolean context.
Raises:
TypeError: when attempting to bool-ify the Var. |
__iter__(self) -> 'Any' | Raise exception if using Var in an iterable context.
Raises:
TypeError: when attempting to iterate over the Var. |
__format__(self, format_spec: 'str') -> 'str' | Format the var into a Javascript equivalent to an f-string. |
__getitem__(self, i: 'Any') -> 'Var' | Index into a var. |
__getattribute__(self, name: 'str') -> 'Var' | Get a var attribute. |
operation(self, op: 'str' = '', other: 'Var | None' = None, type_: 'Type | None' = None, flip: 'bool' = False, fn: 'str | None' = None, invoke_fn: 'bool' = False) -> 'Var' | Perform an operation on a var. |
is_valid_operation(operand1_type: 'Type', operand2_type: 'Type', operator: 'str') -> 'bool' | Check if an operation between two operands is valid. |
compare(self, op: 'str', other: 'Var') -> 'Var' | Compare two vars with inequalities. |
__invert__(self) -> 'Var' | Invert a var. |
__neg__(self) -> 'Var' | Negate a var. |
__abs__(self) -> 'Var' | Get the absolute value of a var. |
length(self) -> 'Var' | Get the length of a list var. |
__eq__(self, other: 'Var') -> 'Var' | Perform an equality comparison. |
__ne__(self, other: 'Var') -> 'Var' | Perform an inequality comparison. |
__gt__(self, other: 'Var') -> 'Var' | Perform a greater than comparison. |
__ge__(self, other: 'Var') -> 'Var' | Perform a greater than or equal to comparison. |
__lt__(self, other: 'Var') -> 'Var' | Perform a less than comparison. |
__le__(self, other: 'Var') -> 'Var' | Perform a less than or equal to comparison. |
__add__(self, other: 'Var', flip=False) -> 'Var' | Add two vars. |
__radd__(self, other: 'Var') -> 'Var' | Add two vars. |
__sub__(self, other: 'Var') -> 'Var' | Subtract two vars. |
__rsub__(self, other: 'Var') -> 'Var' | Subtract two vars. |
__mul__(self, other: 'Var', flip=True) -> 'Var' | Multiply two vars. |
__rmul__(self, other: 'Var') -> 'Var' | Multiply two vars. |
__pow__(self, other: 'Var') -> 'Var' | Raise a var to a power. |
__rpow__(self, other: 'Var') -> 'Var' | Raise a var to a power. |
__truediv__(self, other: 'Var') -> 'Var' | Divide two vars. |
__rtruediv__(self, other: 'Var') -> 'Var' | Divide two vars. |
__floordiv__(self, other: 'Var') -> 'Var' | Divide two vars. |
__mod__(self, other: 'Var') -> 'Var' | Get the remainder of two vars. |
__rmod__(self, other: 'Var') -> 'Var' | Get the remainder of two vars. |
__and__(self, other: 'Var') -> 'Var' | Perform a logical and. |
__rand__(self, other: 'Var') -> 'Var' | Perform a logical and. |
__or__(self, other: 'Var') -> 'Var' | Perform a logical or. |
__ror__(self, other: 'Var') -> 'Var' | Perform a logical or. |
__contains__(self, _: 'Any') -> 'Var' | Override the 'in' operator to alert the user that it is not supported.
Raises:
TypeError: the operation is not supported |
contains(self, other: 'Any') -> 'Var' | Check if a var contains the object `other`. |
reverse(self) -> 'Var' | Reverse a list var.
Raises:
TypeError: If the var is not a list. |
foreach(self, fn: 'Callable') -> 'Var' | Return a list of components. after doing a foreach on this var. |
to(self, type_: 'Type') -> 'Var' | Convert the type of the var. |
set_state(self, state: 'Type[State]') -> 'Any' | Set the state of the var. |