MCPcopy Create free account
hub / github.com/CodeClash-ai/CodeClash / FileLock

Class FileLock

codeclash/analysis/llm_as_judge/utils.py:10–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

8
9
10class FileLock:
11 def __init__(self, lock_path: str | Path):
12 self.lock_path = Path(lock_path)
13 self.lock_file = None
14
15 def __enter__(self):
16 self.lock_file = open(self.lock_path, "w")
17 fcntl.flock(self.lock_file.fileno(), fcntl.LOCK_EX)
18 return self
19
20 def __exit__(self, exc_type, exc_val, exc_tb):
21 if self.lock_file:
22 fcntl.flock(self.lock_file.fileno(), fcntl.LOCK_UN)
23 self.lock_file.close()
24 return False
25
26
27class Instance(BaseModel):

Callers 1

_save_responseMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected