Files

23 lines
630 B
Python
Raw Permalink Normal View History

"""育种审计抑制标志(批量导入路径抑制逐行审计,仅汇总记一条)。"""
from contextvars import ContextVar
from typing import Any
_suppress: ContextVar[bool] = ContextVar("bre_audit_suppress", default=False)
def bre_audit_suppressed() -> bool:
return _suppress.get()
class bre_audit_suppress:
"""上下文管理器:with 块内 CRUDBase 写方法跳过逐行审计。"""
def __enter__(self) -> "bre_audit_suppress":
self._token: Any = _suppress.set(True)
return self
def __exit__(self, *exc: Any) -> bool:
_suppress.reset(self._token)
return False