y5gfunc.expr.emulator¶
emulator
¶
Classes:
| Name | Description |
|---|---|
ConstantValues |
|
Functions:
| Name | Description |
|---|---|
emulate_expr |
Emulate Akarin.Expr with the given constants, clip values and properties. |
ConstantValues
dataclass
¶
ConstantValues(pi: float = pi, N: Optional[int] = None, X: Optional[int] = None, Y: Optional[int] = None, width: Optional[int] = None, height: Optional[int] = None)
emulate_expr
¶
emulate_expr(expr: str, constants: ConstantValues = ConstantValues(), clip_value: Optional[dict[str, float]] = None, clip_prop: Optional[dict[str, list[tuple[str, float]]]] = None) -> float
Emulate Akarin.Expr with the given constants, clip values and properties.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
|
str
|
The expression to emulate. |
required |
|
ConstantValues
|
An object containing constant values (N, X, Y, width, height, pi). |
ConstantValues()
|
|
Optional[dict[str, float]]
|
The values of the clips. (e.g. {"src0": 1.0, "src1": 2.0}) |
None
|
|
Optional[dict[str, list[tuple[str, float]]]]
|
The properties of the clips. (e.g. {"src0": [("prop1", 1234), ("prop2", 4567.8)], "src1": [("yajyuu_senpai", 114514)]}) |
None
|
Returns:
| Type | Description |
|---|---|
float
|
The result of the expression. |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the expression is invalid or if a clip or property is not found. |