mirror of
https://github.com/gorules/zen.git
synced 2026-10-04 16:02:18 +00:00
* 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>
32 lines
1.1 KiB
Python
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: ...
|