MCPcopy Create free account
hub / github.com/dbt-labs/ade-bench / get_file_content

Function get_file_content

scripts_python/render_file_diffs.py:33–51  ·  view source on GitHub ↗

Get file content from optimized JSON data structure.

(json_data: dict, file_path: str, snapshot_type: str = "after")

Source from the content-addressed store, hash-verified

31
32
33def get_file_content(json_data: dict, file_path: str, snapshot_type: str = "after") -> str:
34 """Get file content from optimized JSON data structure."""
35 if not json_data or "content_manager" not in json_data:
36 return ""
37
38 content_manager = json_data["content_manager"]
39 content_store = content_manager.get("content_store", {})
40
41 # Look through diffs to find the file in the specified snapshot type
42 for diff_data in json_data.get("diffs", []):
43 snapshot_data = diff_data.get(snapshot_type, {})
44 file_hashes = snapshot_data.get("file_hashes", {})
45
46 # Get the content hash for this file from the snapshot
47 content_hash = file_hashes.get(file_path)
48 if content_hash:
49 return content_store.get(content_hash, "")
50
51 return ""
52
53
54def parse_diff_log(log_content: str) -> list[dict]:

Callers 1

generate_htmlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected