(
option: Literal["hook", "policy"],
lock_path: str,
hook: Callable[[int], None],
)
| 292 | |
| 293 | |
| 294 | def _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 | |
| 309 | def _dynamic_constructor() -> type[BaseFileLock]: |
no test coverage detected