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

Class BarColumn

rich/progress.py:646–685  ·  view source on GitHub ↗

Renders a visual progress bar. Args: bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40. style (StyleType, optional): Style for the bar background. Defaults to "bar.back". complete_style (StyleType, optional): Style for the completed

Source from the content-addressed store, hash-verified

644
645
646class BarColumn(ProgressColumn):
647 """Renders a visual progress bar.
648
649 Args:
650 bar_width (Optional[int], optional): Width of bar or None for full width. Defaults to 40.
651 style (StyleType, optional): Style for the bar background. Defaults to "bar.back".
652 complete_style (StyleType, optional): Style for the completed bar. Defaults to "bar.complete".
653 finished_style (StyleType, optional): Style for a finished bar. Defaults to "bar.finished".
654 pulse_style (StyleType, optional): Style for pulsing bars. Defaults to "bar.pulse".
655 """
656
657 def __init__(
658 self,
659 bar_width: Optional[int] = 40,
660 style: StyleType = "bar.back",
661 complete_style: StyleType = "bar.complete",
662 finished_style: StyleType = "bar.finished",
663 pulse_style: StyleType = "bar.pulse",
664 table_column: Optional[Column] = None,
665 ) -> None:
666 self.bar_width = bar_width
667 self.style = style
668 self.complete_style = complete_style
669 self.finished_style = finished_style
670 self.pulse_style = pulse_style
671 super().__init__(table_column=table_column)
672
673 def render(self, task: "Task") -> ProgressBar:
674 """Gets a progress bar widget for a task."""
675 return ProgressBar(
676 total=max(0, task.total) if task.total is not None else None,
677 completed=max(0, task.completed),
678 width=None if self.bar_width is None else max(1, self.bar_width),
679 pulse=not task.started,
680 animation_time=task.get_time(),
681 style=self.style,
682 complete_style=self.complete_style,
683 finished_style=self.finished_style,
684 pulse_style=self.pulse_style,
685 )
686
687
688class TimeElapsedColumn(ProgressColumn):

Callers 12

test_bar_columnsFunction · 0.90
test_expand_barFunction · 0.90
test_columnsFunction · 0.90
live_progress.pyFile · 0.90
fullscreen.pyFile · 0.90
downloader.pyFile · 0.90
trackFunction · 0.85
wrap_fileFunction · 0.85
openFunction · 0.85
get_default_columnsMethod · 0.85

Calls

no outgoing calls

Tested by 4

test_bar_columnsFunction · 0.72
test_expand_barFunction · 0.72
test_columnsFunction · 0.72