MCPcopy
hub / github.com/Textualize/rich / make_tasks_table

Method make_tasks_table

rich/progress.py:1562–1593  ·  rich/progress.py::Progress.make_tasks_table

Get a table to render the Progress display. Args: tasks (Iterable[Task]): An iterable of Task instances, one per row of the table. Returns: Table: A table instance.

(self, tasks: Iterable[Task])

Source from the content-addressed store, hash-verified

1560 yield table
1561
1562 def make_tasks_table(self, tasks: Iterable[Task]) -> Table:
1563 class="st">"""Get a table to render the Progress display.
1564
1565 Args:
1566 tasks (Iterable[Task]): An iterable of Task instances, one per row of the table.
1567
1568 Returns:
1569 Table: A table instance.
1570 class="st">"""
1571 table_columns = (
1572 (
1573 Column(no_wrap=True)
1574 if isinstance(_column, str)
1575 else _column.get_table_column().copy()
1576 )
1577 for _column in self.columns
1578 )
1579 table = Table.grid(*table_columns, padding=(0, 1), expand=self.expand)
1580
1581 for task in tasks:
1582 if task.visible:
1583 table.add_row(
1584 *(
1585 (
1586 column.format(task=task)
1587 if isinstance(column, str)
1588 else column(task)
1589 )
1590 for column in self.columns
1591 )
1592 )
1593 return table
1594
1595 def __rich__(self) -> RenderableType:
1596 class="st">""class="st">"Makes the Progress class itself renderable."class="st">""

Callers 1

get_renderablesMethod · 0.95

Calls 5

ColumnClass · 0.85
get_table_columnMethod · 0.80
gridMethod · 0.80
add_rowMethod · 0.80
copyMethod · 0.45

Tested by

no test coverage detected