Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't trigger missing-function-docstring with @typing.overload #3350

Closed
dseomn opened this issue Jan 15, 2020 · 0 comments · Fixed by #3430
Closed

Don't trigger missing-function-docstring with @typing.overload #3350

dseomn opened this issue Jan 15, 2020 · 0 comments · Fixed by #3430
Labels
Enhancement ✨ Improvement to a component

Comments

@dseomn
Copy link

dseomn commented Jan 15, 2020

Is your feature request related to a problem? Please describe

Linting this module gives missing-function-docstring for the two @typing.overload functions:

import typing


@typing.overload
def f(x: str) -> bytes:
    pass


@typing.overload
def f(x: bytes) -> str:
    pass


def f(x):
    """This is a docstring."""
    if isinstance(x, str):
        return x.encode()
    else:
        return x.decode()

Describe the solution you'd like

I think docstrings should only go on the function implementation, not the @typing.overload-decorated stubs, so it would be nice if pylint didn't trigger missing-function-docstring for those.

Additional context

https://www.python.org/dev/peps/pep-0484/#function-method-overloading

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement ✨ Improvement to a component
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants