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

Method create_file

examples/tools/apply_patch.py:39–46  ·  view source on GitHub ↗
(self, operation: ApplyPatchOperation)

Source from the content-addressed store, hash-verified

37 self._auto_approve = auto_approve or os.environ.get("APPLY_PATCH_AUTO_APPROVE") == "1"
38
39 def create_file(self, operation: ApplyPatchOperation) -> ApplyPatchResult:
40 relative = self._relative_path(operation.path)
41 self._require_approval(operation, relative)
42 target = self._resolve(operation.path, ensure_parent=True)
43 diff = operation.diff or ""
44 content = apply_diff("", diff, mode="create")
45 target.write_text(content, encoding="utf-8")
46 return ApplyPatchResult(output=f"Created {relative}")
47
48 def update_file(self, operation: ApplyPatchOperation) -> ApplyPatchResult:
49 relative = self._relative_path(operation.path)

Callers

nothing calls this directly

Calls 6

_relative_pathMethod · 0.95
_require_approvalMethod · 0.95
_resolveMethod · 0.95
apply_diffFunction · 0.90
ApplyPatchResultClass · 0.90
write_textMethod · 0.80

Tested by

no test coverage detected