跳轉至

Core API 參考

boring.core

Core Module for Boring V4.0 (DEPRECATED Compatibility Layer)

⚠️ DEPRECATION NOTICE: This module is deprecated and will be removed in a future release. Please import directly from the appropriate modules:

  • from .circuit import should_halt_execution, reset_circuit_breaker, ...
  • from .logger import log_status, update_status, get_log_tail
  • from .limiter import can_make_call, increment_call_counter, ...

__getattr__(name)

Lazy re-export with deprecation warning.

Source code in src/boring/core/__init__.py
def __getattr__(name: str) -> Any:
    """Lazy re-export with deprecation warning."""
    if name in _RE_EXPORTS:
        warnings.warn(
            f"Importing '{name}' from 'boring.core' is deprecated. "
            f"Please import from 'boring.core{_RE_EXPORTS[name]}' instead.",
            DeprecationWarning,
            stacklevel=2,
        )
        import importlib

        module = importlib.import_module(_RE_EXPORTS[name], __package__)
        return getattr(module, name)

    raise AttributeError(f"module 'boring.core' has no attribute '{name}'")