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

Function try_illegal_transition

tests/test_read_write.py:593–602  ·  view source on GitHub ↗
(lock_file: str, hold_mode: Literal["read", "write"], result: Synchronized[int])

Source from the content-addressed store, hash-verified

591
592
593def try_illegal_transition(lock_file: str, hold_mode: Literal["read", "write"], result: Synchronized[int]) -> None:
594 lock = ReadWriteLock(lock_file)
595 with lock.read_lock() if hold_mode == "read" else lock.write_lock():
596 try:
597 if hold_mode == "read":
598 lock.acquire_write()
599 else:
600 lock.acquire_read()
601 except RuntimeError:
602 result.value = 0
603
604
605def recursive_lock(lock_file: str, mode: Literal["read", "write"], success_flag: Synchronized[int]) -> None:

Callers

nothing calls this directly

Calls 5

read_lockMethod · 0.95
write_lockMethod · 0.95
acquire_writeMethod · 0.95
acquire_readMethod · 0.95
ReadWriteLockClass · 0.90

Tested by

no test coverage detected