- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Fixed singledispatch documentation #10285
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
Conversation
Could you add a testcase, please? |
Hi @tk0miya. I would be happy to add a test case but would you be able to point me to an example test or template I could follow? |
Please check these files:
They confirms the result of autodoc for singledispatch functions and methods. I think this change should change (add?) something new to these testcases. |
Thanks @tk0miya I have added the test cases. It turned out that with single dispatch if you register the variants as follows everything works fine:
However, if you use type annotations as follows then sphinx would not work:
This pull request now fixes this behaviour and adds a test case for functions registered using type annotations. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your update. I don't know singledispatch now supports type annotated functions and methods.
https://docs.python.org/3/library/functools.html#functools.singledispatch
LGTM!
Merged. Thank you for your contribution! |
Subject: Single dispatch functions were not documented due to minor bug which this pull request fixes
Feature or Bugfix
Purpose
Detail
Here is a minimal example package which shows the error:
bug_example.zip
Here is an old picture of the output:

Here is new picture of the output which is what I think is intended:
