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

Function _find_context

src/agents/apply_diff.py:281–289  ·  view source on GitHub ↗
(lines: list[str], context: list[str], start: int, eof: bool)

Source from the content-addressed store, hash-verified

279
280
281def _find_context(lines: list[str], context: list[str], start: int, eof: bool) -> ContextMatch:
282 if eof:
283 end_start = max(0, len(lines) - len(context))
284 end_match = _find_context_core(lines, context, end_start)
285 if end_match.new_index != -1:
286 return end_match
287 fallback = _find_context_core(lines, context, start)
288 return ContextMatch(new_index=fallback.new_index, fuzz=fallback.fuzz + 10000)
289 return _find_context_core(lines, context, start)
290
291
292def _find_context_core(lines: list[str], context: list[str], start: int) -> ContextMatch:

Callers 2

_parse_update_diffFunction · 0.85

Calls 2

_find_context_coreFunction · 0.85
ContextMatchClass · 0.85

Tested by 1