mici.progressbars module#
Progress bar classes for tracking progress of chains.
- class mici.progressbars.DummyProgressBar(sequence, description, position=(0, 1))[source]#
Bases:
ProgressBar
Placeholder progress bar which does not display progress updates.
- Parameters:
sequence (Collection) – Sequence to iterate over. Must be iterable _and_ have a defined length such that len(sequence) is valid.
description (str | None) – Description of task to prefix progress bar with.
position (tuple[int, int]) – Tuple specifying position of progress bar within a sequence with first entry corresponding to zero-indexed position and the second entry the total number of progress bars.
- property sequence: Collection#
Sequence iterated over.
- class mici.progressbars.FileDisplay(position=(0, 1), file=None)[source]#
Bases:
object
Use file which supports ANSI escape sequences as an updatable display.
- Parameters:
position (tuple[int, int]) – Tuple specifying position of display line within a sequence lines with first entry corresponding to zero-indexed line and the second entry the total number of lines.
file (TextIO | None) – File object to write updates to. Must support ANSI escape sequences x1b[A} (cursor up) and \x1b[B (cursor down) for manipulating write position. Defaults to sys.stdout if None.
- CURSOR_DOWN = '\x1b[B'#
ANSI escape sequence to move cursor down one line.
- CURSOR_UP = '\x1b[A'#
ANSI escape sequence to move cursor up one line.
- class mici.progressbars.LabelledSequenceProgressBar(labelled_sequence, description=None, position=(0, 1), displays=None)[source]#
Bases:
ProgressBar
Iterable object for tracking progress of a sequence of labelled tasks.
- Parameters:
labelled_sequence (dict[str, Any]) – Ordered dictionary with string keys corresponding to labels for stages represented by sequence and values the entries in the sequence being iterated over.
description (str | None) – Description of task to prefix progress bar with.
position (tuple[int, int]) – Tuple specifying position of progress bar within a sequence with first entry corresponding to zero-indexed position and the second entry the total number of progress bars.
displays (Collection | None) – List of objects to use to display visual representation(s) of progress bar. Each object much have an update method which will be passed a single argument corresponding to the current progress bar.
- property sequence: Collection#
Sequence iterated over.
- class mici.progressbars.ProgressBar(sequence, description, position=(0, 1))[source]#
Bases:
ABC
Base class defining expected interface for progress bars.
- Parameters:
sequence (Collection) – Sequence to iterate over. Must be iterable _and_ have a defined length such that len(sequence) is valid.
description (str | None) – Description of task to prefix progress bar with.
position (tuple[int, int]) – Tuple specifying position of progress bar within a sequence with first entry corresponding to zero-indexed position and the second entry the total number of progress bars.
- property sequence: Collection#
Sequence iterated over.
- class mici.progressbars.SequenceProgressBar(sequence, description=None, position=(0, 1), displays=None, n_col=10, unit='it', min_refresh_time=0.25)[source]#
Bases:
ProgressBar
Iterable object for tracking progress of an iterative task.
Implements both string and HTML representations to allow richer display in interfaces which support HTML output, for example Jupyter notebooks or interactive terminals.
- Parameters:
sequence (Collection) – Sequence to iterate over. Must be iterable and have a defined length such that len(sequence) is valid.
description (str | None) – Description of task to prefix progress bar with.
position (tuple[int, int]) – Tuple specifying position of progress bar within a sequence with first entry corresponding to zero-indexed position and the second entry the total number of progress bars.
displays (Collection | None) – List of objects to use to display visual representation(s) of progress bar. Each object much have an update method which will be passed a single argument corresponding to the current progress bar.
n_col (int) – Number of columns (characters) to use in string representation of progress bar.
unit (str) – String describing unit of per-iteration tasks.
min_referesh_time – Minimum time in seconds between each refresh of progress bar visual representation.
min_refresh_time (float)
- GLYPHS = ' ▏▎▍▌▋▊▉█'#
Characters used to create string representation of progress bar.
- property sequence: Collection#
Sequence iterated over.