MCPcopy Create free account
hub / github.com/NVIDIA/SOL-ExecBench / _compute_hash

Method _compute_hash

src/sol_execbench/core/data/solution.py:330–344  ·  view source on GitHub ↗

Compute a deterministic hash of the solution content.

(self)

Source from the content-addressed store, hash-verified

328 object.__setattr__(self, "_hash_cache", self._compute_hash())
329
330 def _compute_hash(self) -> str:
331 """Compute a deterministic hash of the solution content."""
332 h = hashlib.sha1()
333 for s in (
334 self.name,
335 self.definition,
336 *[lang.value for lang in self.spec.languages],
337 self.spec.entry_point,
338 self.spec.binding.value if self.spec.binding else "",
339 *self.spec.dependencies,
340 *(part for src in self.sources for part in (src.path, src.content)),
341 ):
342 h.update(s.encode())
343
344 return h.hexdigest()
345
346 def hash(self) -> str:
347 """Return the memoized deterministic hash of the solution content.

Callers 1

model_post_initMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected