Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/filelock/_error.py: 62%
16 statements
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:08 +0000
« prev ^ index » next coverage.py v7.3.1, created at 2023-09-25 06:08 +0000
1from __future__ import annotations
3from typing import Any
6class Timeout(TimeoutError): # noqa: N818
7 """Raised when the lock could not be acquired in *timeout* seconds."""
9 def __init__(self, lock_file: str) -> None:
10 super().__init__()
11 self._lock_file = lock_file
13 def __reduce__(self) -> str | tuple[Any, ...]:
14 return self.__class__, (self._lock_file,) # Properly pickle the exception
16 def __str__(self) -> str:
17 return f"The file lock '{self._lock_file}' could not be acquired."
19 def __repr__(self) -> str:
20 return f"{self.__class__.__name__}({self.lock_file!r})"
22 @property
23 def lock_file(self) -> str:
24 """:return: The path of the file lock."""
25 return self._lock_file
28__all__ = [
29 "Timeout",
30]