MCPcopy Create free account
hub / github.com/tox-dev/filelock / hook

Function hook

tests/core/test_interruption.py:78–89  ·  view source on GitHub ↗
(frame: FrameType, event: str, _arg: Unused)

Source from the content-addressed store, hash-verified

76 entered: Final[set[FrameType]] = set()
77
78 def hook(frame: FrameType, event: str, _arg: Unused) -> None: # pragma: no cover # runs inside the profile hook
79 # Injecting signals inside threading's own context managers can leak their locks.
80 if event != "call" or (callee is not None and frame.f_code is not callee):
81 return
82 holder = frame if callee is None else frame.f_back
83 if (
84 (resumable or frame not in entered)
85 and holder is not None
86 and any(v is lock for v in holder.f_locals.values())
87 ):
88 entered.add(frame)
89 on_call()
90
91 return hook
92

Callers

nothing calls this directly

Calls 1

addMethod · 0.80

Tested by

no test coverage detected