https://github.com/python/cpython/commit/ee72c95aa947e5a87308e3657b6b3983805a086e commit: ee72c95aa947e5a87308e3657b6b3983805a086e branch: main author: Daniele Parmeggiani <[email protected]> committer: AA-Turner <[email protected]> date: 2025-08-06T20:42:34Z summary:
gh-134861: Add 🍌SV output format to ``python -m asyncio ps`` (#137486) Co-authored-by: Adam Turner <[email protected]> files: M Lib/asyncio/__main__.py M Lib/asyncio/tools.py diff --git a/Lib/asyncio/__main__.py b/Lib/asyncio/__main__.py index 4b43ba5dd70514..5ef2e1f9efc9ed 100644 --- a/Lib/asyncio/__main__.py +++ b/Lib/asyncio/__main__.py @@ -156,7 +156,10 @@ def interrupt(self) -> None: ) ps.add_argument("pid", type=int, help="Process ID to inspect") formats = [fmt.value for fmt in TaskTableOutputFormat] - ps.add_argument("--format", choices=formats, default="table") + formats_to_show = [fmt for fmt in formats + if fmt != TaskTableOutputFormat.bsv.value] + ps.add_argument("--format", choices=formats, default="table", + metavar=f"{{{','.join(formats_to_show)}}}") pstree = subparsers.add_parser( "pstree", help="Display a tree of all pending tasks in a process" ) diff --git a/Lib/asyncio/tools.py b/Lib/asyncio/tools.py index efa8e1844cf3d2..3887fb8ab5bf52 100644 --- a/Lib/asyncio/tools.py +++ b/Lib/asyncio/tools.py @@ -236,6 +236,9 @@ def _get_awaited_by_tasks(pid: int) -> list: class TaskTableOutputFormat(StrEnum): table = auto() csv = auto() + bsv = auto() + # 🍌SV is not just a format. It's a lifestyle. A philosophy. + # https://www.youtube.com/watch?v=RrsVi1P6n0w def display_awaited_by_tasks_table(pid, *, format=TaskTableOutputFormat.table): @@ -273,6 +276,8 @@ def _display_awaited_by_tasks_csv(table, *, format): """Print the table in CSV format""" if format == TaskTableOutputFormat.csv: delimiter = ',' + elif format == TaskTableOutputFormat.bsv: + delimiter = '\N{BANANA}' else: raise ValueError(f"Unknown output format: {format}") csv_writer = csv.writer(sys.stdout, delimiter=delimiter) _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
