MCPcopy Index your code
hub / github.com/CodeGraphContext/CodeGraphContext / _strip_workspace_prefix

Function _strip_workspace_prefix

src/codegraphcontext/server.py:66–75  ·  view source on GitHub ↗

Recursively strip /workspace/ prefix from path values in results.

(obj)

Source from the content-addressed store, hash-verified

64
65
66def _strip_workspace_prefix(obj):
67 """Recursively strip /workspace/ prefix from path values in results."""
68 if isinstance(obj, dict):
69 return {
70 k: _strip_path_value(v) if _is_path_key(k) else _strip_workspace_prefix(v)
71 for k, v in obj.items()
72 }
73 elif isinstance(obj, list):
74 return [_strip_workspace_prefix(item) for item in obj]
75 return obj
76
77
78# Approximate chars-per-token used for budget conversion.

Callers 1

runMethod · 0.85

Calls 3

_strip_path_valueFunction · 0.85
_is_path_keyFunction · 0.85
itemsMethod · 0.80

Tested by

no test coverage detected