MCPcopy
hub / github.com/openai/openai-agents-python / _parse_create_diff

Function _parse_create_diff

src/agents/apply_diff.py:110–123  ·  view source on GitHub ↗
(lines: list[str], newline: str)

Source from the content-addressed store, hash-verified

108
109
110def _parse_create_diff(lines: list[str], newline: str) -> str:
111 parser = ParserState(lines=[*lines, END_PATCH])
112 output: list[str] = []
113
114 while not _is_done(parser, SECTION_TERMINATORS):
115 if parser.index >= len(parser.lines):
116 break
117 line = parser.lines[parser.index]
118 parser.index += 1
119 if not line.startswith("+"):
120 raise ValueError(f"Invalid Add File Line: {line}")
121 output.append(line[1:])
122
123 return newline.join(output)
124
125
126def _parse_update_diff(lines: list[str], input: str) -> ParsedUpdateDiff:

Callers 1

apply_diffFunction · 0.85

Calls 3

ParserStateClass · 0.85
_is_doneFunction · 0.85
appendMethod · 0.80

Tested by

no test coverage detected