Aluode/PerceptionLabPortable
0
1from __future__ import annotations2 3from typing import Any4 5 6class Timeout(TimeoutError): # noqa: N8187 """Raised when the lock could not be acquired in *timeout* seconds."""8 9 def __init__(self, lock_file: str) -> None:10 super().__init__()11 self._lock_file = lock_file12 13 def __reduce__(self) -> str | tuple[Any, ...]:14 return self.__class__, (self._lock_file,) # Properly pickle the exception15 16 def __str__(self) -> str:17 return f"The file lock '{self._lock_file}' could not be acquired."18 19 def __repr__(self) -> str:20 return f"{self.__class__.__name__}({self.lock_file!r})"21 22 @property23 def lock_file(self) -> str:24 """:return: The path of the file lock."""25 return self._lock_file26 27 28__all__ = [29 "Timeout",30]31 