# file_header_indexes

> **Function** in `deepagents_code`

📖 [View in docs](https://reference.langchain.com/python/deepagents-code/diff_utils/file_header_indexes)

Locate paired file headers immediately preceding a hunk.

A `---`/`+++` pair is only a file header when it appears *outside* a hunk
body — a diff of a file that itself contains such lines would otherwise
have its content mistaken for metadata. That is why this walks the hunks'
declared old/new line budgets instead of just matching on the prefix.

## Signature

```python
file_header_indexes(
    lines: list[str],
) -> set[int]
```

## Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `lines` | `list[str]` | Yes | Unified-diff lines. Handles multi-file diffs, where headers recur between hunks. |

## Returns

`set[int]`

Indexes of file-header lines.

---

[View source on GitHub](https://github.com/langchain-ai/deepagents/blob/4bfa52000ef65ac623d8ada0cb67f67cbdd663ea/libs/code/deepagents_code/diff_utils.py#L121)