Buckets:

download
raw
2.77 kB
"""Shim for src.core.shared.interfaces."""
from __future__ import annotations
try:
from src.core.shared.interfaces import * # noqa: F403
from src.core.shared.interfaces import (
AuditService,
CacheClient,
CircuitBreaker,
DatabaseSession,
MessageProcessor,
MetricsCollector,
NotificationService,
PolicyEvaluator,
RetryStrategy,
)
except ImportError:
from typing import Any, Protocol
class CacheClient(Protocol):
async def get(self, key: str) -> str | None: ...
async def set(self, key: str, value: str, ex: int | None = None) -> bool: ...
async def setex(self, key: str, time: int, value: str) -> bool: ...
async def delete(self, key: str) -> bool: ...
async def exists(self, key: str) -> bool: ...
async def expire(self, key: str, time: int) -> bool: ...
class PolicyEvaluator(Protocol):
async def evaluate(
self, policy_path: str, input_data: dict, *, strict: bool = True
) -> dict: ...
async def evaluate_batch(
self, policy_path: str, data: list[dict], *, strict: bool = True
) -> list[dict]: ...
async def get_policy(self, policy_path: str) -> dict | None: ...
async def list_policies(self, path: str | None = None) -> list[str]: ...
class AuditService(Protocol):
async def log_event(self, event: dict) -> str: ...
async def query_events(self, **kw: Any) -> list[dict]: ...
class DatabaseSession(Protocol):
async def execute(self, query: str, **kw: Any) -> Any: ...
async def commit(self) -> None: ...
async def rollback(self) -> None: ...
async def close(self) -> None: ...
class NotificationService(Protocol):
async def send_email(self, **kw: Any) -> bool: ...
async def send_webhook(self, **kw: Any) -> bool: ...
class MessageProcessor(Protocol):
async def process(self, message: dict) -> dict: ...
async def process_batch(self, messages: list[dict]) -> list[dict]: ...
class RetryStrategy(Protocol):
def should_retry(self, attempt: int, error: Exception) -> bool: ...
def get_delay(self, attempt: int) -> float: ...
class CircuitBreaker(Protocol):
def record_success(self) -> None: ...
def record_failure(self) -> None: ...
def allow_request(self) -> bool: ...
def get_state(self) -> str: ...
class MetricsCollector(Protocol):
def increment_counter(self, name: str, value: int = 1, **kw: Any) -> None: ...
def record_timing(self, name: str, value: float, **kw: Any) -> None: ...
def record_gauge(self, name: str, value: float, **kw: Any) -> None: ...

Xet Storage Details

Size:
2.77 kB
·
Xet hash:
7657d40eadc7a59b2a605c20f4fde421991e56af395f8b6f5e3ed678ae50ce59

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.