Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Fix issues with typing.overload #571

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

yumasheta
Copy link

This should fix #525 and also the def __init__() overloading which is not explicitly part of that issue.
The fix simply makes use of the existing is_overload property also in the case that definition.is_magic is true. Previously, this was somehow missed in the inlined if-else construct. I expanded that part to more explicit statements and used a new variable.

I also tried #555 and at least added a match for "typing.overload". But I don't know if pydocstyle is able to infer if a decorator is actually a name bound at import by something like: from typing import overload as my_overload.
If not, then I don't see a way to "know" if a given decorator is a typing.overload.

If this is ok, I'd add tests as well.

TODO:

  • Add unit tests and integration tests where applicable.
  • Add a line to the release notes (docs/release_notes.rst) under "Current Development Version".
    Make sure to include the PR number after you open and get one.

@yumasheta
Copy link
Author

I noticed a strange side effect. When using the changes of this PR, D105 is never detected.

@yumasheta
Copy link
Author

Should be fixed now. I missed that the evaluation of the error codes dict is delayed.

@adamjstewart adamjstewart mentioned this pull request Jan 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong "D105: Missing docstring in magic method" for overload function
1 participant