Skip to content

Commit 60cd13b

Browse files
committed
review
1 parent a1f69b6 commit 60cd13b

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

Lib/asyncio/tools.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from collections import defaultdict, namedtuple
44
import csv
55
from itertools import count
6-
from enum import Enum
6+
from enum import Enum, StrEnum, auto
77
import sys
88
from _remote_debugging import RemoteUnwinder, FrameInfo
99

@@ -234,18 +234,15 @@ def _get_awaited_by_tasks(pid: int) -> list:
234234
sys.exit(1)
235235

236236

237-
class TaskTableOutputFormat(Enum):
238-
table = "table"
239-
csv = "csv"
240-
bsv = "bsv"
237+
class TaskTableOutputFormat(StrEnum):
238+
table = auto()
239+
csv = auto()
240+
bsv = auto()
241241
# As per the words of the asyncio 🍌SV spec lead:
242242
# > 🍌SV is not just a format. It’s a lifestyle. A philosophy.
243243
# https://www.youtube.com/watch?v=RrsVi1P6n0w
244244

245245

246-
_header = ('tid', 'task id', 'task name', 'coroutine stack', 'awaiter chain', 'awaiter name', 'awaiter id')
247-
248-
249246
def display_awaited_by_tasks_table(
250247
pid: int,
251248
format: TaskTableOutputFormat | str = TaskTableOutputFormat.table
@@ -272,6 +269,7 @@ def _display_awaited_by_tasks_table(table) -> None:
272269

273270

274271
def _display_awaited_by_tasks_csv(table, format: TaskTableOutputFormat) -> None:
272+
_header = ('tid', 'task id', 'task name', 'coroutine stack', 'awaiter chain', 'awaiter name', 'awaiter id')
275273
match format:
276274
case TaskTableOutputFormat.csv:
277275
delimiter = ','

0 commit comments

Comments
 (0)