-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-102560 Add docstrings to asyncio.TaskGroup #102565
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
gh-102560 Add docstrings to asyncio.TaskGroup #102565
Conversation
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 fix the trailing whitespace issues that the Azure Pipelines CI check is complaining about
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
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.
I desperate wish for something half the size.
Lib/asyncio/taskgroups.py
Outdated
@@ -135,6 +158,10 @@ async def __aexit__(self, et, exc, tb): | |||
self._errors = None | |||
|
|||
def create_task(self, coro, *, name=None, context=None): | |||
"""Create a new task in this group and return it. | |||
|
|||
Matches the call signature of asyncio.create_task. |
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.
Why not just
Matches the call signature of asyncio.create_task. | |
Similar to `asyncio.create_task`. |
The part about Exceptions seems a bit long winded. Maybe just:
As a replacement? |
@JosephSBoyle Can you please respond to the review comments? (PS. There's no need to merge main, even if GitHub recommends it, unless it says there's also a merge conflict.) |
Thanks for the comments! @AlexWaygood I believe I've fixed the whitespace issue. Thanks for the tip on merging! 🙇♂️ A thought of my own, maybe we could remove the 'Similar to `asyncio.create_task' line entirely and just have: def create_task(self, coro, *, name=None, context=None):
"""Create a new task in this group and return it.""" I think people intuitively would expect |
I defer to Alex and Guido on this. |
It reads okay to me now, but I'm neither an Thanks for working on this! |
Thanks for your help Alex:) |
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.
I have a slight rephrasing and some whitespace/markup nits, then LGTM.
I can commit those and land this unless you object.
Hi @gvanrossum, feel free to commit the changes you proposed:) |
Thanks! It's a real improvement to have this. |
Thanks @JosephSBoyle for the PR, and @gvanrossum for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11. |
GH-102715 is a backport of this pull request to the 3.11 branch. |
(cherry picked from commit e94edab) Co-authored-by: JosephSBoyle <[email protected]>
(cherry picked from commit e94edab) Co-authored-by: JosephSBoyle <[email protected]>
Happy to help!:) |
If you want another project like this, timeouts.py also needs docstrings. |
Nice, I've opened a PR to add docstrings here: #102811. |
Adds docstrings to the public methods of asyncio.TaskGroup.