Option C Tools
Loading...
Searching...
No Matches
diagnostics.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
# -*- coding: utf-8 -*-
3
# oct/core/diagnostics.py
4
5
"""
6
Purpose
7
-------
8
OI-525 — single source of truth for the ``_dbg()`` import used across OCT
9
modules. The ``oc_diagnostics`` package is an optional runtime dependency;
10
when unavailable (dev-time tooling, partial installs, tests running outside
11
a full environment) ``_dbg()`` becomes a no-op so callers never crash.
12
13
Responsibilities
14
----------------
15
- Expose ``_dbg`` re-bound from ``oc_diagnostics`` when importable.
16
- Fall back to a no-op stub that accepts the same (domain, func, msg, level)
17
positional signature plus any keyword arguments.
18
- Never raise on import.
19
20
Diagnostics
21
-----------
22
Domain: OCT-CORE
23
Levels:
24
(This module does not emit diagnostics; it provides the plumbing.)
25
26
Contracts
27
---------
28
- Every OCT module that needs ``_dbg`` must import from here rather than
29
duplicating the try/except stub.
30
- Signature must match ``oc_diagnostics._dbg`` so swap is transparent.
31
"""
32
33
from
__future__
import
annotations
34
35
try
:
36
from
oc_diagnostics
import
_dbg
# type: ignore[assignment]
37
except
ImportError:
# pragma: no cover - diagnostics optional at dev time
38
def
_dbg
(*args, **kwargs) -> None:
39
return
None
40
41
42
__all__ = [
"_dbg"
]
diagnostics._dbg
None _dbg(*args, **kwargs)
Definition
diagnostics.py:38
oct
core
diagnostics.py
Generated by
1.15.0