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

Function _change_singleton_option

tests/test_subclass_options.py:294–306  ·  view source on GitHub ↗
(
    option: Literal["hook", "policy"],
    lock_path: str,
    hook: Callable[[int], None],
)

Source from the content-addressed store, hash-verified

292
293
294def _change_singleton_option(
295 option: Literal["hook", "policy"],
296 lock_path: str,
297 hook: Callable[[int], None],
298) -> BaseFileLock:
299 if option == "hook":
300 return _ForwardingFileLock(lock_path, is_singleton=True, on_acquired=list[int]().append)
301 return _ForwardingFileLock(
302 lock_path,
303 is_singleton=True,
304 context_error_policy="group",
305 on_acquired=hook,
306 )
307
308
309def _dynamic_constructor() -> type[BaseFileLock]:

Calls 1

_ForwardingFileLockClass · 0.85

Tested by

no test coverage detected