pydocstyle
pydocstyle copied to clipboard
Fix decorator parsing for async functions
This PR addresses an issue with parsing decorators right before async function definitions.
A good example to illustrate the issue is overload.
from typing import overload
@overload
async def func(x: int) -> int:
...
async def func(x: int | str) -> int | str:
"""Do something."""
pass
At the moment, this would emit a D103 error for the first definition.
D103: Missing docstring in public function
That's because, parsing the decorator name wasn't stopped with async and thus overload became overloadasync and didn't match any is_overload checks anymore.