Buckets:
AnonymousSpottedToad/candidate_bucket / codebase /python /dislovelhl_enhanced-agent-bus /_compat /di_container.py
| """Shim for src.core.shared.di_container.""" | |
| from __future__ import annotations | |
| from typing import Any, TypeVar | |
| try: | |
| from src.core.shared.di_container import * # noqa: F403 | |
| except ImportError: | |
| T = TypeVar("T") | |
| class DIContainer: | |
| """Minimal dependency injection container stub.""" | |
| def __init__(self) -> None: | |
| self._registry: dict[str, Any] = {} | |
| def register(self, key: str | type, instance: Any) -> None: | |
| k = key if isinstance(key, str) else key.__qualname__ | |
| self._registry[k] = instance | |
| def resolve(self, key: str | type) -> Any: | |
| k = key if isinstance(key, str) else key.__qualname__ | |
| return self._registry.get(k) | |
| def has(self, key: str | type) -> bool: | |
| k = key if isinstance(key, str) else key.__qualname__ | |
| return k in self._registry | |
| def clear(self) -> None: | |
| self._registry.clear() | |
| _container: DIContainer | None = None | |
| def get_container() -> DIContainer: | |
| global _container # noqa: PLW0603 | |
| if _container is None: | |
| _container = DIContainer() | |
| return _container | |
Xet Storage Details
- Size:
- 1.17 kB
- Xet hash:
- c059b21e67b9e9299ca7206a115894031c47dcadfc0ced66adb3ce7755bc64c7
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.