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
resolve_acquire_defaults(
blocking_arg: bool | None,
timeout_arg: float | None,
check_interval_arg: float | None,
default_blocking: bool,
default_timeout: float | None,
default_check_interval: float,
) tuple[bool, float | None, float, float | None][source]#

Resolve acquire() parameter defaults and compute the deadline.

Returns:

(blocking, timeout, check_interval, deadline)

Return type:

tuple