class documentation

class ProgressBar:

View In Hierarchy

A sequence-iterating progress bar (like tqdm) that supports both notebooks and console, and prefers notebook over console style in notebooks.

CONSIDER: parameter to force text mode

e.g. usable like:

    data = ['a','b',3]
    for item in ProgressBar(data, 'parsing... '):
        time.sleep(1)

Compared to the similar progress_bar, this one is less typing, but a little more basic, in that...

  • Unlike creating a progress_bar object, you don't get to change its description.
  • Unlike tqdm, we only work with something that has a length and is subscriptable, and has no fallback for...
    • unknown-length iterables (such as generators or enumerate)
    • known-length but unsubscriptable iterators (such as dict_items, and set type - yould need to wrap a list() around it) we could hardcode those to work, though...

Yes, it's silly that we e.g. wrap tqdm in two layers of interfaces to then present a poorer version of what it does in the first place. We should probably try being cleverer.

Also, it seems that the notebook variant can only take ~20K/s updates, so will effectively rate-limit anything that wants to go faster than that;

Method __init__ Undocumented
Method __iter__ Undocumented
Method __len__ Undocumented
Method __next__ Undocumented
Instance Variable is_notebook Undocumented
Instance Variable pb Undocumented
Instance Variable _cur Undocumented
Instance Variable _iterable Undocumented
Instance Variable _len Undocumented
def __init__(self, iterable, description=''):

Undocumented

def __iter__(self):

Undocumented

def __len__(self):

Undocumented

def __next__(self):

Undocumented

is_notebook =

Undocumented

pb =

Undocumented

_cur: int =

Undocumented

_iterable =

Undocumented

_len =

Undocumented