[ty] Correct how we expand tabs in docstrings (#26679)
<!--
Thank you for contributing to Ruff/ty! To help us out with reviewing,
please consider the following:
- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title? (Please prefix
with `[ty]` for ty pull
requests.)
- Does this pull request include references to any relevant issues?
- Does this PR follow our AI policy
(https://github.com/astral-sh/.github/blob/main/AI_POLICY.md)?
-->
## Summary
This corrects how we expand tabs as part of PEP-257 normalization of
docstrings.
Previously, we incorrectly replaced each tab in the docstring with 8
spaces. However, as per [the reference
implementation](https://peps.python.org/pep-0257/#handling-docstring-indentation)
(and the [`str.expandtabs`
docs](https://docs.python.org/3/library/stdtypes.html#str.expandtabs)),
we should instead treat a tab as a directive to advance to the next tab
stop (the next column at a multiple of 8).
This matters for Google-style parameter extraction when a tab follows
spaces. For example, consider an `Args:` section whose first item is
indented with two spaces followed by a tab, while the second uses eight
spaces:
```python
def example(first: str, second: str):
"""Summary.
Args:
\tfirst: First parameter.
second: Second parameter.
"""
```
The previous normalization produced this docstring. Because the
parameter items have different indentation, `second` is treated as
continuation text for `first` rather than as a separate parameter:
```text
Summary.
Args:
first: First parameter.
second: Second parameter.
```
Whereas the correct interpretation according to PEP 257 aligns the
parameter items, allowing documentation to be extracted for both `first`
and `second`:
```text
Summary.
Args:
first: First parameter.
second: Second parameter.
```
## Test Plan
See included tests.
<!-- How was it tested? -->