21 lines
533 B
Python
21 lines
533 B
Python
"""Graph-of-Contracts registry (lightweight)"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Dict, Any
|
|
|
|
_registry: Dict[str, Dict[str, Any]] = {}
|
|
|
|
|
|
class GraphOfContracts:
|
|
@staticmethod
|
|
def register(contract_id: str, schema: Dict[str, Any]) -> None:
|
|
_registry[contract_id] = schema
|
|
|
|
@staticmethod
|
|
def get_schema(contract_id: str) -> Dict[str, Any]:
|
|
return _registry.get(contract_id, {})
|
|
|
|
@staticmethod
|
|
def all_contracts() -> Dict[str, Dict[str, Any]]:
|
|
return dict(_registry)
|