MCPcopy Index your code
hub / github.com/openai/openai-agents-python / _resolve

Method _resolve

examples/tools/apply_patch.py:69–79  ·  view source on GitHub ↗
(self, relative: str, ensure_parent: bool = False)

Source from the content-addressed store, hash-verified

67 return resolved.relative_to(self._root).as_posix()
68
69 def _resolve(self, relative: str, ensure_parent: bool = False) -> Path:
70 candidate = Path(relative)
71 target = candidate if candidate.is_absolute() else (self._root / candidate)
72 target = target.resolve()
73 try:
74 target.relative_to(self._root)
75 except ValueError:
76 raise RuntimeError(f"Operation outside workspace: {relative}") from None
77 if ensure_parent:
78 target.parent.mkdir(parents=True, exist_ok=True)
79 return target
80
81 def _require_approval(self, operation: ApplyPatchOperation, display_path: str) -> None:
82 fingerprint = self._approvals.fingerprint(operation, display_path)

Callers 4

create_fileMethod · 0.95
update_fileMethod · 0.95
delete_fileMethod · 0.95
_relative_pathMethod · 0.95

Calls 2

resolveMethod · 0.45
mkdirMethod · 0.45

Tested by

no test coverage detected