MCPcopy Create free account
hub / github.com/OpenBMB/ChatDev / resolve_under_session

Method resolve_under_session

functions/function_calling/file.py:69–80  ·  view source on GitHub ↗
(self, relative_path: str | Path)

Source from the content-addressed store, hash-verified

67 return target
68
69 def resolve_under_session(self, relative_path: str | Path) -> Path:
70 raw = Path(relative_path)
71 candidates = []
72 if raw.is_absolute():
73 candidates.append(raw.resolve())
74 else:
75 candidates.append((self.session_root / raw).resolve())
76 candidates.append(raw.resolve())
77 for target in candidates:
78 if self.session_root in target.parents or target == self.session_root:
79 return target
80 raise ValueError("Path is outside session directory")
81
82 def to_session_relative(self, absolute_path: str | Path | None) -> Optional[str]:
83 if not absolute_path:

Callers 1

read_text_file_snippetFunction · 0.95

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected