Coverage for / home / runner / work / bijux-cli / bijux-cli / src / bijux_cli / core / contracts.py: 100%
12 statements
« prev ^ index » next coverage.py v7.13.2, created at 2026-01-26 17:59 +0000
« prev ^ index » next coverage.py v7.13.2, created at 2026-01-26 17:59 +0000
1# SPDX-License-Identifier: Apache-2.0
2# Copyright © 2025 Bijan Mousavi
4"""Core protocol contracts for Bijux CLI."""
6from __future__ import annotations
8from typing import Any, Protocol, Self, runtime_checkable
11@runtime_checkable
12class ExecutionContext(Protocol):
13 """Execution-scoped context carrier."""
15 def set(self, key: str, value: Any) -> None:
16 """Store a value in the context."""
17 ...
19 def get(self, key: str) -> Any:
20 """Retrieve a value from the context."""
21 ...
23 def clear(self) -> None:
24 """Clear all context data."""
25 ...
27 def __enter__(self) -> Self:
28 """Enter the synchronous context manager."""
29 ...
31 def __exit__(self, _exc_type: Any, _exc_value: Any, traceback: Any) -> None:
32 """Exit the synchronous context manager."""
33 ...
35 async def __aenter__(self) -> Self:
36 """Enter the async context manager."""
37 ...
39 async def __aexit__(self, _exc_type: Any, _exc_value: Any, traceback: Any) -> None:
40 """Exit the async context manager."""
41 ...
44__all__ = [
45 "ExecutionContext",
46]