binlock.BinLock

class binlock.BinLock(name: str = DEFAULT_LOCK_NAME)

Bases: object

Represents a bin lock file (.lck)

__init__(name: str = DEFAULT_LOCK_NAME)

Methods

__init__([name])

from_bin(bin_path[, missing_bin_ok])

Get the existing lock for a given bin (.avb) path

from_path(lock_path)

Read from .lck lockfile

hold_bin(bin_path[, missing_bin_ok])

Context manager to hold a lock for a given bin (.avb) path

hold_lock(lock_path)

Context manager to hold a lock at a given path

lock_bin(bin_path[, missing_bin_ok])

Lock a given bin (.avb) with this lock

lock_path_from_bin_path(bin_path[, ...])

Determine the lock path from a given bin path

remove_path(lock_path[, ownership_check])

Remove a lock from at a given .lck path

to_path(lock_path)

Write to .lck lockfile

unlock_bin(bin_path[, missing_bin_ok])

Unlock a given bin (.avb)

Attributes

name

Name of the Avid the lock belongs to

property name: str

Name of the Avid the lock belongs to

lock_bin(bin_path: str, missing_bin_ok: bool = True)

Lock a given bin (.avb) with this lock

unlock_bin(bin_path: str, missing_bin_ok: bool = True)

Unlock a given bin (.avb)

For safety, the name on the bin lock MUST match the name on this BinLock instance

remove_path(lock_path: str, ownership_check: bool = True)

Remove a lock from at a given .lck path

classmethod from_bin(bin_path: str, missing_bin_ok: bool = True) BinLock | None

Get the existing lock for a given bin (.avb) path

Returns None if the bin is not locked

classmethod from_path(lock_path: str) BinLock

Read from .lck lockfile

to_path(lock_path: str)

Write to .lck lockfile

hold_lock(lock_path: str) _BinLockContextManager

Context manager to hold a lock at a given path

hold_bin(bin_path: str, missing_bin_ok: bool = True) _BinLockContextManager

Context manager to hold a lock for a given bin (.avb) path

static lock_path_from_bin_path(bin_path: str, missing_bin_ok: bool = True) str

Determine the lock path from a given bin path