stouputils.lock.shared module#

exception LockError[source]#

Bases: RuntimeError

Base lock error.

exception LockTimeoutError[source]#

Bases: TimeoutError, LockError

Raised when a lock could not be acquired within timeout seconds.

resolve_path(path: str) str[source]#

Resolve a lock file path, placing it in the system temporary directory if only a name is given.

Examples

>>> import os, tempfile
>>> p = resolve_path('foo.lock')
>>> os.path.basename(p) == 'foo.lock'
True