Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/filelock/_error.py: 62%

Shortcuts on this page

r m x   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

16 statements  

1from __future__ import annotations 

2 

3from typing import Any 

4 

5 

6class Timeout(TimeoutError): # noqa: N818 

7 """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_file 

12 

13 def __reduce__(self) -> str | tuple[Any, ...]: 

14 return self.__class__, (self._lock_file,) # Properly pickle the exception 

15 

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 @property 

23 def lock_file(self) -> str: 

24 """:return: The path of the file lock.""" 

25 return self._lock_file 

26 

27 

28__all__ = [ 

29 "Timeout", 

30]