MCPcopy Create free account
hub / github.com/tox-dev/filelock / SoftFileLockProtocolError

Class SoftFileLockProtocolError

src/filelock/_error.py:35–66  ·  view source on GitHub ↗

Raised when strict soft-lock state cannot be interpreted without risking overlap.

Source from the content-addressed store, hash-verified

33
34
35class SoftFileLockProtocolError(OSError):
36 """Raised when strict soft-lock state cannot be interpreted without risking overlap."""
37
38 def __init__(self, lock_file: str, claim_name: str | None, reason: str) -> None:
39 self._lock_file = lock_file
40 self._claim_name = claim_name
41 self._reason = reason
42 super().__init__(self.__str__())
43
44 def __reduce__(
45 self,
46 ) -> tuple[type[SoftFileLockProtocolError], tuple[str, str | None, str]]: # pragma: needs hard-link
47 return self.__class__, (self._lock_file, self._claim_name, self._reason)
48
49 def __str__(self) -> str:
50 location = self._lock_file if self._claim_name is None else f"{self._lock_file}: claim {self._claim_name!r}"
51 return f"Invalid strict soft-lock state at {location}: {self._reason}"
52
53 @property
54 def lock_file(self) -> str: # pragma: needs hard-link
55 """The requested lock path."""
56 return self._lock_file
57
58 @property
59 def claim_name(self) -> str | None: # pragma: needs hard-link
60 """The claim that caused the error, if scanning identified one."""
61 return self._claim_name
62
63 @property
64 def reason(self) -> str: # pragma: needs hard-link
65 """The protocol validation failure."""
66 return self._reason
67
68
69__all__ = [

Callers 7

_read_claimsFunction · 0.85
_read_claim_recordFunction · 0.85
_attempt_claim_readFunction · 0.85
_parse_claimFunction · 0.85

Calls

no outgoing calls

Tested by 1