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

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

15 statements  

1from __future__ import annotations 

2 

3 

4class Timeout(TimeoutError): # noqa: N818 

5 """Raised when the lock could not be acquired in *timeout* seconds.""" 

6 

7 def __init__(self, lock_file: str) -> None: 

8 super().__init__() 

9 self._lock_file = lock_file 

10 

11 def __reduce__(self) -> tuple[type[Timeout], tuple[str]]: 

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

13 

14 def __str__(self) -> str: 

15 return f"The file lock '{self._lock_file}' could not be acquired." 

16 

17 def __repr__(self) -> str: 

18 return f"{self.__class__.__name__}({self.lock_file!r})" 

19 

20 @property 

21 def lock_file(self) -> str: 

22 """:returns: The path of the file lock.""" 

23 return self._lock_file 

24 

25 

26__all__ = [ 

27 "Timeout", 

28]