(source: str)
| 301 | analysis drivers that want to know exactly what changed. |
| 302 | """ |
| 303 | def _chunk_hashes(source: str) -> Dict[str, str]: |
| 304 | with warnings.catch_warnings(): |
| 305 | warnings.filterwarnings("ignore", category=SyntaxWarning) |
| 306 | try: |
| 307 | tree = ast.parse(source, filename=str(file_path)) |
| 308 | except SyntaxError: |
| 309 | return {} |
| 310 | lines = source.splitlines(keepends=True) |
| 311 | seen: Dict[str, int] = {} |
| 312 | out: Dict[str, str] = {} |
| 313 | for node in tree.body: |
| 314 | cid = _make_chunk_id(node, seen) |
| 315 | out[cid] = hashlib.sha256(_source_slice(lines, node).encode()).hexdigest() |
| 316 | return out |
| 317 | |
| 318 | old_h = _chunk_hashes(old_content) |
| 319 | new_h = _chunk_hashes(new_content) |
nothing calls this directly
no test coverage detected