-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Add typehints_rtype_after_returns option #487
Conversation
Kevin-Roberts
commented
Sep 20, 2024
- Allow the user to specify the order of the rtype/returns statements.
- Fix an index error exception caused when always_document_param_types is True and typehints_defaults is 'braces-after'.
* Allow the user to specify the order of the rtype/returns statements. * Fix an index error exception caused when always_document_param_types is True and typehints_defaults is 'braces-after'.
So the bug is easy to recreate, just set always_document_param_types=True, typehints_document_rtype=True, typehints_use_rtype=True, typehints_defaults='before-after' (this parameter that ends with *-after is what causes the bug to show up, my fix kind of should fix all index errors via the append() call, may be better ways to fix it) and have a function with a simple docstring with a description and nothing else, for example:
Also, for the added configuration option to swap the order of rtype and returns, I think it helps people maintain compatibility with how they previously wrote their docstrings (with :rtype:) |
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.
Please notify me when the CI passes and you have added tests.
Sounds good.. You see what I am going for though right |
Can you explain why a user would care about this setting? What difference does it make in the rendered output? |
Well so I'm trying to use this plugin for a fairly large project and right now we always have :rtype: after :returns: and I'm trying to avoid having every functions rendered output change (mostly due to automated emails). Then there is also the bug fix when combining current config options which 100% should be fixed. |