MCPcopy Index your code
hub / github.com/python/cpython / _compute_digest

Method _compute_digest

Tools/jit/_targets.py:68–82  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

66 return nop
67
68 def _compute_digest(self) -> str:
69 hasher = hashlib.sha256()
70 hasher.update(self.triple.encode())
71 hasher.update(self.debug.to_bytes())
72 hasher.update(self.cflags.encode())
73 # These dependencies are also reflected in _JITSources in regen.targets:
74 hasher.update(PYTHON_EXECUTOR_CASES_C_H.read_bytes())
75 hasher.update((self.pyconfig_dir / "pyconfig.h").read_bytes())
76 for dirpath, _, filenames in sorted(os.walk(TOOLS_JIT)):
77 # Exclude cache files from digest computation to ensure reproducible builds.
78 if dirpath.endswith("__pycache__"):
79 continue
80 for filename in sorted(filenames):
81 hasher.update(pathlib.Path(dirpath, filename).read_bytes())
82 return hasher.hexdigest()
83
84 async def _parse(self, path: pathlib.Path) -> _stencils.StencilGroup:
85 group = _stencils.StencilGroup()

Callers 1

buildMethod · 0.95

Calls 6

hexdigestMethod · 0.80
updateMethod · 0.45
encodeMethod · 0.45
read_bytesMethod · 0.45
walkMethod · 0.45
endswithMethod · 0.45

Tested by

no test coverage detected