Files
zen/bindings/python/zen.pyi
T
iguessitsjeffandjpalmasolutions 15c4384494 feat: Python Stub File (#181)
* adding stub file to python binding

* updating init to return object

* init function should return none

* added async functions, using typeddict class to enforce expected keys, and expression return types to Any

---------

Co-authored-by: jpalmasolutions <jpalmasolutions@gmail.com>
2024-07-09 14:10:39 +02:00

32 lines
1.1 KiB
Python

from typing import Any, Optional, TypedDict
from collections.abc import Awaitable
class EvaluateResponse(TypedDict):
performance: str
result: dict
trace: dict
class ZenEngine:
def __init__(self, maybe_options: Optional[dict] = None) -> None: ...
def evaluate(self, key: str, ctx: dict, opts: Optional[dict] = None) -> EvaluateResponse: ...
def async_evaluate(self,key: str, ctx: dict, opts: Optional[dict] = None) -> Awaitable[EvaluateResponse]: ...
def create_decision(self, content: str) -> ZenDecision: ...
def get_decision(self, key: str) -> ZenDecision: ...
class ZenDecision:
def evaluate(self,ctx: dict, opts: Optional[dict] = None) -> EvaluateResponse: ...
def async_evaluate(self,ctx: dict, opts: Optional[dict] = None) -> Awaitable[EvaluateResponse]: ...
def validate(self) -> None: ...
def evaluate_expression(expression: str, ctx: Optional[dict] = None) -> Any: ...
def evaluate_unary_expression(expression: str, ctx: dict) -> bool: ...
def render_template(template: str, ctx: dict) -> Any: ...