FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

bpo-46752: Uniform TaskGroup.__repr__ by asvetlov · Pull Request #31409 · python/cpython · GitHub

/ cpython Public
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .py  (1) All 1 file type selected
Viewed files
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Unified
Split
Hide whitespace
Diff view
Unified
Split
Hide whitespace
18 changes: 10 additions & 8 deletions Lib/asyncio/taskgroups.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from . import exceptions
from . import tasks


class TaskGroup:

def __init__(self):
Expand All @@ -25,19 +26,20 @@ def __init__(self):
self._on_completed_fut = None

def __repr__(self):
msg = f'<TaskGroup'
info = ['']
if self._tasks:
msg += f' tasks:{len(self._tasks)}'
info.append(f'tasks={len(self._tasks)}')
if self._unfinished_tasks:
msg += f' unfinished:{self._unfinished_tasks}'
info.append(f'unfinished={self._unfinished_tasks}')
if self._errors:
msg += f' errors:{len(self._errors)}'
info.append(f'errors={len(self._errors)}')
if self._aborting:
msg += ' cancelling'
info.append('cancelling')
elif self._entered:
msg += ' entered'
msg += '>'
return msg
info.append('entered')

info_str = ' '.join(info)
return f'<TaskGroup{info_str}>'

async def __aenter__(self):
if self._entered:
Expand Down

Back | FazBrowse Home | New Git URL