MCPcopy
hub / github.com/pingcap/docs-cn / load_variables

Function load_variables

scripts/merge_by_toc.py:34–43  ·  view source on GitHub ↗

Load variables from variables.json file

()

Source from the content-addressed store, hash-verified

32entry_file = "TOC.md"
33
34def load_variables():
35 """Load variables from variables.json file"""
36 current_dir = os.path.dirname(os.path.abspath(__file__))
37 variables_path = os.path.join(current_dir, "../variables.json")
38 try:
39 with open(variables_path, "r", encoding="utf-8") as f:
40 return json.load(f)
41 except Exception as e:
42 print(f"Warning: Could not load variables.json: {e}")
43 return {}
44
45def get_value_by_path(obj, path):
46 """Get value from nested dictionary using dot notation path"""

Callers 1

merge_by_toc.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected