"""Import target for the generated client's `from mizan_rust import ...`. The real module is a compiled PyO3 extension; this one records each call so the driver can read the name and payload the generated method sent, and replies with whatever `reply` currently holds. """ from typing import Any, Callable class PyContextSubscription: def __init__(self, name: str, params: dict[str, Any], callback: Callable[[dict[str, Any]], None]) -> None: self.name = name self.params = params self.callback = callback class PyMizanClient: def __init__(self, base_url: str, *, session: bool, csrf_cookie_name: str, csrf_header_name: str) -> None: self.base_url = base_url self.session = session self.csrf_cookie_name = csrf_cookie_name self.csrf_header_name = csrf_header_name self.calls: list[tuple[str, dict[str, Any]]] = [] self.invalidated: list[tuple[str, dict[str, Any] | None]] = [] self.reply: Any = None def call(self, name: str, args: dict[str, Any]) -> Any: self.calls.append((name, args)) return self.reply def fetch_context(self, name: str, params: dict[str, Any]) -> Any: self.calls.append((name, params)) return self.reply def subscribe_context(self, name: str, params: dict[str, Any], callback: Callable[[dict[str, Any]], None]) -> PyContextSubscription: return PyContextSubscription(name, params, callback) def invalidate(self, context: str) -> None: self.invalidated.append((context, None)) def invalidate_scoped(self, context: str, params: dict[str, Any]) -> None: self.invalidated.append((context, params))