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

Class SoftFileLockProtocolError

src/filelock/_core/_errors.py:84–127  ·  view source on GitHub ↗

Raised when strict soft-lock state cannot be interpreted without risking overlap. :param lock_file: the path of the lock :param claim_name: the name of the claim the state belongs to, or ``None`` when it concerns the lock as a whole :param reason: why the state cannot be interprete

Source from the content-addressed store, hash-verified

82
83
84class SoftFileLockProtocolError(OSError):
85 """
86 Raised when strict soft-lock state cannot be interpreted without risking overlap.
87
88 :param lock_file: the path of the lock
89 :param claim_name: the name of the claim the state belongs to, or ``None`` when it concerns the lock as a whole
90 :param reason: why the state cannot be interpreted
91 """
92
93 def __init__(self, lock_file: str, claim_name: str | None, reason: str) -> None:
94 self._lock_file = lock_file
95 self._claim_name = claim_name
96 self._reason = reason
97 super().__init__(self.__str__())
98
99 @override
100 def __str__(self) -> str:
101 location = self._lock_file if self._claim_name is None else f"{self._lock_file}: claim {self._claim_name!r}"
102 return f"Invalid strict soft-lock state at {location}: {self._reason}"
103
104 @override
105 def __reduce__(
106 self,
107 ) -> tuple[
108 type[SoftFileLockProtocolError],
109 tuple[str, str | None, str],
110 dict[str, object], # simplint: ignore[imprecise-annotation] # pickle state is heterogeneous
111 ]: # pragma: needs hard-link
112 return self.__class__, (self._lock_file, self._claim_name, self._reason), self.__dict__
113
114 @property
115 def lock_file(self) -> str: # pragma: needs hard-link
116 """The requested lock path."""
117 return self._lock_file
118
119 @property
120 def claim_name(self) -> str | None: # pragma: needs hard-link
121 """The claim that caused the error, if scanning identified one."""
122 return self._claim_name
123
124 @property
125 def reason(self) -> str: # pragma: needs hard-link
126 """The protocol validation failure."""
127 return self._reason
128
129
130_MarkerValue = TypeVar("_MarkerValue")

Callers 15

latestMethod · 0.90
_readMethod · 0.90
leaveMethod · 0.90
parse_claimFunction · 0.90
read_existing_claimsFunction · 0.90
_read_claimsFunction · 0.90
_list_claim_namesFunction · 0.90
_refuse_excess_claimsFunction · 0.90
_read_claim_recordsFunction · 0.90
_attempt_claim_readFunction · 0.90
_claim_exists_on_serverFunction · 0.90

Calls

no outgoing calls