pydocstyle icon indicating copy to clipboard operation
pydocstyle copied to clipboard

Fix decorator parsing for async functions

Open cdce8p opened this issue 4 years ago • 0 comments

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.

cdce8p avatar Feb 16 '22 14:02 cdce8p