SHA-256 of the concatenated header content. Lets callers skip re-running the snapshot when nothing upstream changed.
(paths: List[str])
| 49 | |
| 50 | |
| 51 | def _header_hash(paths: List[str]) -> str: |
| 52 | """SHA-256 of the concatenated header content. Lets callers skip |
| 53 | re-running the snapshot when nothing upstream changed.""" |
| 54 | h = hashlib.sha256() |
| 55 | for p in sorted(paths): |
| 56 | if not os.path.exists(p): |
| 57 | continue |
| 58 | with open(p, "rb") as f: |
| 59 | h.update(f.read()) |
| 60 | return h.hexdigest() |
| 61 | |
| 62 | |
| 63 | def _strip_doc(raw: str) -> str: |