Skip to content

schema

LazyValue

Bases: ABC

A base class for lazy evaluation.

eval

eval(**values: Any) -> Any

Evaluate the lazy value with the given values.

Parameters:

Name Type Description Default
**values Any

Values to be used for evaluation.

{}

Returns:

Name Type Description
Any Any

The evaluated value.

Raises:

Type Description
ValueError

If the lazy value is not ready to be evaluated.

partial abstractmethod

partial(**values: Any) -> Any

Partially evaluate the lazy value with the given values.

Parameters:

Name Type Description Default
**values Any

Values to be used for evaluation.

{}

Returns:

Name Type Description
Any Any

The partially evaluated value.

ready

ready() -> bool

Check if the lazy value is ready to be evaluated.

keys abstractmethod

keys() -> set[str]

Get the keys that are required to evaluate the lazy value.

Symbol dataclass

Symbol(key: str)

Bases: LazyValue

A symbol that represents a variable in the lazy evaluation.

Such as x, y, z, etc.

eval

eval(**values: Any) -> Any

Evaluate the lazy value with the given values.

Parameters:

Name Type Description Default
**values Any

Values to be used for evaluation.

{}

Returns:

Name Type Description
Any Any

The evaluated value.

Raises:

Type Description
ValueError

If the lazy value is not ready to be evaluated.

ready

ready() -> bool

Check if the lazy value is ready to be evaluated.

partial

partial(**values: Any) -> Any

Partially evaluate the lazy value with the given values.

Parameters:

Name Type Description Default
**values Any

Values to be used for evaluation.

{}

Returns:

Name Type Description
Any Any

The partially evaluated value.

keys

keys() -> set[str]

Get the keys that are required to evaluate the lazy value.

LazyOperator dataclass

LazyOperator(*, left: Any = None, right: Any = None)

Bases: LazyValue

A base class for lazy operators.

Such as Add, Sub, Mul, TrueDiv, Pow, Neg, Pos, Abs, Mod, FloorDiv.

eval

eval(**values: Any) -> Any

Evaluate the lazy value with the given values.

Parameters:

Name Type Description Default
**values Any

Values to be used for evaluation.

{}

Returns:

Name Type Description
Any Any

The evaluated value.

Raises:

Type Description
ValueError

If the lazy value is not ready to be evaluated.

ready

ready() -> bool

Check if the lazy value is ready to be evaluated.

partial

partial(**values: Any) -> Any

Partially evaluate the lazy value with the given values.

Parameters:

Name Type Description Default
**values Any

Values to be used for evaluation.

{}

Returns:

Name Type Description
Any Any

The partially evaluated value.

keys

keys() -> set[str]

Get the keys that are required to evaluate the lazy value.