Skip to content

schema

Classes:

Name Description
LazyValue

A base class for lazy evaluation.

Symbol

A symbol that represents a variable in the lazy evaluation.

LazyOperator

A base class for lazy operators.

LazyValue

Bases: ABC

A base class for lazy evaluation.

Methods:

Name Description
eval

Evaluate the lazy value with the given values.

partial

Partially evaluate the lazy value with the given values.

ready

Check if the lazy value is ready to be evaluated.

keys

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

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.

Methods:

Name Description
eval

Evaluate the lazy value with the given values.

ready

Check if the lazy value is ready to be evaluated.

partial

Partially evaluate the lazy value with the given values.

keys

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

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.

Methods:

Name Description
eval

Evaluate the lazy value with the given values.

ready

Check if the lazy value is ready to be evaluated.

partial

Partially evaluate the lazy value with the given values.

keys

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

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.