sammo.compactbars
#
Provides a way of displaying multiple progress bars in a single line. Works in both interactive and non-interactive environments.
Module Contents#
Classes#
A class that represents a set of progress bars drawn next to each in a single line. |
|
A class that represents an individual progress bar. |
API#
- class sammo.compactbars.CompactProgressBars(width: beartype.typing.Union[int, None] = None, refresh_interval: float = 1 / 50)#
A class that represents a set of progress bars drawn next to each in a single line.
- Parameters:
width β The total width of the progress bar layout in characters.
refresh_interval β The minimum time interval between display refreshes.
Initialization
- get(id: str, total: beartype.typing.Union[int, None] = None, position: beartype.typing.Union[int, None] = None, display_name: beartype.typing.Union[str, None] = None, **kwargs) sammo.compactbars.SubProgressBar #
Gets existing or creates a new progress bar given an id.
- Parameters:
id β The id of the progress bar for later reference.
total β Number of increments.
position β Truncate existing bars beyond index and insert this one at the position.
display_name β The name to display for the progress bar. Defaults to id.
**kwargs β
Additional arguments to pass to the SubProgressbar constructor.
:return New bar if it doesnβt exist, otherwise a reference to the existing one.
- finalize() None #
Finishes the line and moves the cursor to the next line.
- class sammo.compactbars.SubProgressBar(total: int, parent: sammo.compactbars.CompactProgressBars, moving_avg_size: int = 10, width: int = 100, prefix: str = '', show_rate: bool = True, show_time: bool = True, ascii: str = 'auto')#
A class that represents an individual progress bar.
- Parameters:
total β The total number of items to process.
parent β The parent progress bar.
moving_avg_size β The size of the moving average window for calculating the rate.
width β The width of the progress bar in characters.
prefix β The prefix to display before the progress bar.
show_rate β Whether to show the rate of progress.
show_time β Whether to show the elapsed time and ETA.
ascii β Whether to use ASCII (or UTF-8) characters for the progress bar. If βautoβ, uses ASCII if pdb is imported.
Initialization
- phases = None#
- property total#
- property done#
- property elapsed_long#
- property elapsed#
- property phase#
- property barwidth#
- property rate#
- property eta#
- update(*args, **kwargs)#
Increases the number of completed tasks by one for the progress bar.