PyFoam.ThirdParty.tqdm.tqdm package

Module contents

class PyFoam.ThirdParty.tqdm.tqdm.tqdm(iterable=None, desc=None, total=None, leave=True, file=<_io.TextIOWrapper name='<stderr>' mode='w' encoding='UTF-8'>, ncols=None, mininterval=0.1, maxinterval=10.0, miniters=None, ascii=None, disable=False, unit='it', unit_scale=False, dynamic_ncols=False, smoothing=0.3, bar_format=None, initial=0, position=None, gui=False, **kwargs)[source]

Bases: object

Decorate an iterable object, returning an iterator which acts exactly like the original iterable, but prints a dynamically updating progressbar every time a value is requested.

clear(nomove=False)[source]

Clear current bar display

close()[source]

Cleanup and (if leave=False) close the progressbar.

static format_interval(t)[source]

Formats a number of seconds as a clock time, [H:]MM:SS

t : int
Number of seconds.
out : str
[H:]MM:SS
static format_meter(n, total, elapsed, ncols=None, prefix='', ascii=False, unit='it', unit_scale=False, rate=None, bar_format=None)[source]

Return a string-based progress bar given some parameters

n : int
Number of finished iterations.
total : int
The expected total number of iterations. If meaningless (), only basic progress statistics are displayed (no ETA).
elapsed : float
Number of seconds passed since start.
ncols : int, optional
The width of the entire output message. If specified, dynamically resizes the progress meter to stay within this bound [default: None]. The fallback meter width is 10 for the progress bar + no limit for the iterations counter and statistics. If 0, will not print any meter (only stats).
prefix : str, optional
Prefix message (included in total width) [default: ‘’].
ascii : bool, optional
If not set, use unicode (smooth blocks) to fill the meter [default: False]. The fallback is to use ASCII characters (1-9 #).
unit : str, optional
The iteration unit [default: ‘it’].
unit_scale : bool, optional
If set, the number of iterations will printed with an appropriate SI metric prefix (K = 10^3, M = 10^6, etc.) [default: False].
rate : float, optional
Manual override for iteration rate. If [default: None], uses n/elapsed.
bar_format : str, optional
Specify a custom bar string formatting. May impact performance. [default: ‘{l_bar}{bar}{r_bar}’], where l_bar is ‘{desc}{percentage:3.0f}%|’ and r_bar is ‘| {n_fmt}/{total_fmt} [{elapsed_str}<{remaining_str}, {rate_fmt}]’ Possible vars: bar, n, n_fmt, total, total_fmt, percentage, rate, rate_fmt, elapsed, remaining, l_bar, r_bar, desc.

out : Formatted meter and stats, ready to display.

static format_sizeof(num, suffix='')[source]

Formats a number (greater than unity) with SI Order of Magnitude prefixes.

num : float
Number ( >= 1) to format.
suffix : str, optional
Post-postfix [default: ‘’].
out : str
Number with Order of Magnitude SI unit postfix.
moveto(n)[source]
classmethod pandas(*targs, **tkwargs)[source]
Registers the given tqdm class with
pandas.core. ( frame.DataFrame | series.Series | groupby.DataFrameGroupBy | groupby.SeriesGroupBy ).progress_apply

A new instance will be create every time progress_apply is called, and each instance will automatically close() upon completion.

targs, tkwargs : arguments for the tqdm instance

>>> import pandas as pd
>>> import numpy as np
>>> from tqdm import tqdm, tqdm_gui
>>>
>>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
>>> tqdm.pandas(ncols=50)  # can use tqdm_gui, optional kwargs, etc
>>> # Now you can use `progress_apply` instead of `apply`
>>> df.groupby(0).progress_apply(lambda x: x**2)

https://stackoverflow.com/questions/18603270/ progress-indicator-during-pandas-operations-python

refresh()[source]

Force refresh the display of this bar

set_description(desc=None)[source]

Set/modify description of the progress bar.

static status_printer(file)[source]

Manage the printing and in-place updating of a line of characters. Note that if the string is longer than a line, then in-place updating may not work (it will print a new line at each refresh).

unpause()[source]

Restart tqdm timer from last print time.

update(n=1)[source]

Manually update the progress bar, useful for streams such as reading files. E.g.: >>> t = tqdm(total=filesize) # Initialise >>> for current_buffer in stream: … … … t.update(len(current_buffer)) >>> t.close() The last line is highly recommended, but possibly not necessary if t.update() will be called in such a way that filesize will be exactly reached and printed.

n : int
Increment to add to the internal counter of iterations [default: 1].
classmethod write(s, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, end='\n')[source]

Print a message via tqdm (without overlap with bars)

class PyFoam.ThirdParty.tqdm.tqdm.tqdm_gui(*args, **kwargs)[source]

Bases: PyFoam.ThirdParty.tqdm.tqdm._tqdm.tqdm

Experimental GUI version of tqdm!

close()[source]
update(n=1)[source]
classmethod write(s, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>, end='\n')[source]

Print a message via tqdm_gui (just an alias for print)

PyFoam.ThirdParty.tqdm.tqdm.trange(*args, **kwargs)[source]

A shortcut for tqdm(xrange(*args), **kwargs). On Python3+ range is used instead of xrange.

PyFoam.ThirdParty.tqdm.tqdm.tgrange(*args, **kwargs)[source]

A shortcut for tqdm_gui(xrange(*args), **kwargs). On Python3+ range is used instead of xrange.

PyFoam.ThirdParty.tqdm.tqdm.tqdm_pandas(tclass, *targs, **tkwargs)[source]

Registers the given tqdm instance with pandas.core.groupby.DataFrameGroupBy.progress_apply. It will even close() the tqdm instance upon completion.

tclass : tqdm class you want to use (eg, tqdm, tqdm_notebook, etc) targs and tkwargs : arguments for the tqdm instance

>>> import pandas as pd
>>> import numpy as np
>>> from tqdm import tqdm, tqdm_pandas
>>>
>>> df = pd.DataFrame(np.random.randint(0, 100, (100000, 6)))
>>> tqdm_pandas(tqdm, leave=True)  # can use tqdm_gui, optional kwargs, etc
>>> # Now you can use `progress_apply` instead of `apply`
>>> df.groupby(0).progress_apply(lambda x: x**2)

https://stackoverflow.com/questions/18603270/ progress-indicator-during-pandas-operations-python

PyFoam.ThirdParty.tqdm.tqdm.tqdm_notebook(*args, **kwargs)[source]

See tqdm._tqdm_notebook.tqdm_notebook for full documentation

PyFoam.ThirdParty.tqdm.tqdm.tnrange(*args, **kwargs)[source]

A shortcut for tqdm_notebook(xrange(*args), **kwargs). On Python3+ range is used instead of xrange.

PyFoam.ThirdParty.tqdm.tqdm.main()[source]
exception PyFoam.ThirdParty.tqdm.tqdm.TqdmTypeError[source]

Bases: TypeError

exception PyFoam.ThirdParty.tqdm.tqdm.TqdmKeyError[source]

Bases: KeyError

exception PyFoam.ThirdParty.tqdm.tqdm.TqdmDeprecationWarning(msg, fp_write=None, *a, **k)[source]

Bases: Exception