utils module

DMT.core.utils.enumerate_reversed(iterable, start=0, stop=None, step=1)[source]

Generator to go through an iterable from back to front with correct indexes without copy of the iterable.

Source:

Stack Overflow

Parameters:
iterableIterable[_T]
start, stop, stepint, optional

Starting and ending index with step size for the iterable

Yields:
index, value

index always refers to the true index of the iterable, independent of start or stop!

DMT.core.utils.print_progress_bar(current=0, total=100, prefix='progress', suffix='completed', length=100, space=' ', fill='█', show_balance=False, completed=False)[source]

Displays a progress bar in the terminal.