MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / _safe_env

Function _safe_env

deployments/desktop/shared/agents.py:781–801  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

779 if cached is not None and cached[0] == signature[0] and cached[1] == signature[1]:
780 # deepcopy: callers mutate the record (e.g. _source_priority) and
781 # must not corrupt the cached copy.
782 return deepcopy(cached[2])
783
784 try:
785 record = _report_record(path)
786 except OSError:
787 return None
788
789 with _REPORT_RECORD_CACHE_LOCK:
790 _REPORT_RECORD_CACHE[resolved_key] = (signature[0], signature[1], deepcopy(record))
791 return record
792
793
794def invalidate_report_cache(path: Optional[Path] = None) -> None:
795 """Drop cached report records after a write, or all of them when path is None."""
796 with _REPORT_RECORD_CACHE_LOCK:
797 if path is None:
798 _REPORT_RECORD_CACHE.clear()
799 return
800 _REPORT_RECORD_CACHE.pop(str(Path(path).resolve()), None)
801
802
803def _all_report_records() -> List[Dict[str, Any]]:
804 reports_by_key: Dict[str, Dict[str, Any]] = {}

Callers 1

settingsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected