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.

__del__()[source]
__dict__ = mappingproxy({'__module__': 'PyFoam.ThirdParty.tqdm.tqdm._tqdm', '__doc__': '\n Decorate an iterable object, returning an iterator which acts exactly\n like the original iterable, but prints a dynamically updating\n progressbar every time a value is requested.\n ', 'format_sizeof': <staticmethod object>, 'format_interval': <staticmethod object>, 'status_printer': <staticmethod object>, 'format_meter': <staticmethod object>, '__new__': <staticmethod object>, '_get_free_pos': <classmethod object>, '_decr_instances': <classmethod object>, 'write': <classmethod object>, 'pandas': <classmethod object>, '__init__': <function tqdm.__init__>, '__len__': <function tqdm.__len__>, '__enter__': <function tqdm.__enter__>, '__exit__': <function tqdm.__exit__>, '__del__': <function tqdm.__del__>, '__repr__': <function tqdm.__repr__>, '__lt__': <function tqdm.__lt__>, '__le__': <function tqdm.__le__>, '__eq__': <function tqdm.__eq__>, '__ne__': <function tqdm.__ne__>, '__gt__': <function tqdm.__gt__>, '__ge__': <function tqdm.__ge__>, '__hash__': <function tqdm.__hash__>, '__iter__': <function tqdm.__iter__>, 'update': <function tqdm.update>, 'close': <function tqdm.close>, 'unpause': <function tqdm.unpause>, 'set_description': <function tqdm.set_description>, 'moveto': <function tqdm.moveto>, 'clear': <function tqdm.clear>, 'refresh': <function tqdm.refresh>, '__dict__': <attribute '__dict__' of 'tqdm' objects>, '__weakref__': <attribute '__weakref__' of 'tqdm' objects>})
__enter__()[source]
__eq__(other)[source]

Return self==value.

__exit__(*exc)[source]
__ge__(other)[source]

Return self>=value.

__gt__(other)[source]

Return self>value.

__hash__()[source]

Return hash(self).

__init__(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]
iterableiterable, optional

Iterable to decorate with a progressbar. Leave blank to manually manage the updates.

descstr, optional

Prefix for the progressbar.

totalint, optional

The number of expected iterations. If unspecified, len(iterable) is used if possible. As a last resort, only basic progress statistics are displayed (no ETA, no progressbar). If gui is True and this parameter needs subsequent updating, specify an initial arbitrary large positive integer, e.g. int(9e9).

leavebool, optional

If [default: True], keeps all traces of the progressbar upon termination of iteration.

fileio.TextIOWrapper or io.StringIO, optional

Specifies where to output the progress messages [default: sys.stderr]. Uses file.write(str) and file.flush() methods.

ncolsint, optional

The width of the entire output message. If specified, dynamically resizes the progressbar to stay within this bound. If unspecified, attempts to use environment width. The fallback is a meter width of 10 and no limit for the counter and statistics. If 0, will not print any meter (only stats).

minintervalfloat, optional

Minimum progress update interval, in seconds [default: 0.1].

maxintervalfloat, optional

Maximum progress update interval, in seconds [default: 10.0].

minitersint, optional

Minimum progress update interval, in iterations. If specified, will set mininterval to 0.

asciibool, optional

If unspecified or False, use unicode (smooth blocks) to fill the meter. The fallback is to use ASCII characters 1-9 #.

disablebool, optional

Whether to disable the entire progressbar wrapper [default: False].

unitstr, optional

String that will be used to define the unit of each iteration [default: it].

unit_scalebool, optional

If set, the number of iterations will be reduced/scaled automatically and a metric prefix following the International System of Units standard will be added (kilo, mega, etc.) [default: False].

dynamic_ncolsbool, optional

If set, constantly alters ncols to the environment (allowing for window resizes) [default: False].

smoothingfloat, optional

Exponential moving average smoothing factor for speed estimates (ignored in GUI mode). Ranges from 0 (average speed) to 1 (current/instantaneous speed) [default: 0.3].

bar_formatstr, optional

Specify a custom bar string formatting. May impact performance. If unspecified, will use ‘{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.

initialint, optional

The initial counter value. Useful when restarting a progress bar [default: 0].

positionint, optional

Specify the line offset to print this bar (starting from 0) Automatic if unspecified. Useful to manage multiple bars at once (eg, from threads).

guibool, optional

WARNING: internal parameter - do not use. Use tqdm_gui(…) instead. If set, will attempt to use matplotlib animations for a graphical output [default: False].

out : decorated iterator.

__iter__()[source]

Backward-compatibility to use: for x in tqdm(iterable)

__le__(other)[source]

Return self<=value.

__len__()[source]
__lt__(other)[source]

Return self<value.

__module__ = 'PyFoam.ThirdParty.tqdm.tqdm._tqdm'
__ne__(other)[source]

Return self!=value.

static __new__(cls, *args, **kwargs)[source]

Create and return a new object. See help(type) for accurate signature.

__repr__()[source]

Return repr(self).

__weakref__

list of weak references to the object (if defined)

classmethod _decr_instances(instance)[source]

Remove from list and reposition other bars so that newer bars won’t overlap previous bars

classmethod _get_free_pos(instance=None)[source]

Skips specified instance

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

tint

Number of seconds.

outstr

[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

nint

Number of finished iterations.

totalint

The expected total number of iterations. If meaningless (), only basic progress statistics are displayed (no ETA).

elapsedfloat

Number of seconds passed since start.

ncolsint, 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).

prefixstr, optional

Prefix message (included in total width) [default: ‘’].

asciibool, optional

If not set, use unicode (smooth blocks) to fill the meter [default: False]. The fallback is to use ASCII characters (1-9 #).

unitstr, optional

The iteration unit [default: ‘it’].

unit_scalebool, optional

If set, the number of iterations will printed with an appropriate SI metric prefix (K = 10^3, M = 10^6, etc.) [default: False].

ratefloat, optional

Manual override for iteration rate. If [default: None], uses n/elapsed.

bar_formatstr, 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.

numfloat

Number ( >= 1) to format.

suffixstr, optional

Post-postfix [default: ‘’].

outstr

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.

nint

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!

__init__(*args, **kwargs)[source]
iterableiterable, optional

Iterable to decorate with a progressbar. Leave blank to manually manage the updates.

descstr, optional

Prefix for the progressbar.

totalint, optional

The number of expected iterations. If unspecified, len(iterable) is used if possible. As a last resort, only basic progress statistics are displayed (no ETA, no progressbar). If gui is True and this parameter needs subsequent updating, specify an initial arbitrary large positive integer, e.g. int(9e9).

leavebool, optional

If [default: True], keeps all traces of the progressbar upon termination of iteration.

fileio.TextIOWrapper or io.StringIO, optional

Specifies where to output the progress messages [default: sys.stderr]. Uses file.write(str) and file.flush() methods.

ncolsint, optional

The width of the entire output message. If specified, dynamically resizes the progressbar to stay within this bound. If unspecified, attempts to use environment width. The fallback is a meter width of 10 and no limit for the counter and statistics. If 0, will not print any meter (only stats).

minintervalfloat, optional

Minimum progress update interval, in seconds [default: 0.1].

maxintervalfloat, optional

Maximum progress update interval, in seconds [default: 10.0].

minitersint, optional

Minimum progress update interval, in iterations. If specified, will set mininterval to 0.

asciibool, optional

If unspecified or False, use unicode (smooth blocks) to fill the meter. The fallback is to use ASCII characters 1-9 #.

disablebool, optional

Whether to disable the entire progressbar wrapper [default: False].

unitstr, optional

String that will be used to define the unit of each iteration [default: it].

unit_scalebool, optional

If set, the number of iterations will be reduced/scaled automatically and a metric prefix following the International System of Units standard will be added (kilo, mega, etc.) [default: False].

dynamic_ncolsbool, optional

If set, constantly alters ncols to the environment (allowing for window resizes) [default: False].

smoothingfloat, optional

Exponential moving average smoothing factor for speed estimates (ignored in GUI mode). Ranges from 0 (average speed) to 1 (current/instantaneous speed) [default: 0.3].

bar_formatstr, optional

Specify a custom bar string formatting. May impact performance. If unspecified, will use ‘{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.

initialint, optional

The initial counter value. Useful when restarting a progress bar [default: 0].

positionint, optional

Specify the line offset to print this bar (starting from 0) Automatic if unspecified. Useful to manage multiple bars at once (eg, from threads).

guibool, optional

WARNING: internal parameter - do not use. Use tqdm_gui(…) instead. If set, will attempt to use matplotlib animations for a graphical output [default: False].

out : decorated iterator.

__iter__()[source]

Backward-compatibility to use: for x in tqdm(iterable)

__module__ = 'PyFoam.ThirdParty.tqdm.tqdm._tqdm_gui'
close()[source]

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

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.

nint

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_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

__module__ = 'PyFoam.ThirdParty.tqdm.tqdm._tqdm'
__weakref__

list of weak references to the object (if defined)

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

Bases: KeyError

__module__ = 'PyFoam.ThirdParty.tqdm.tqdm._tqdm'
__weakref__

list of weak references to the object (if defined)

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

Bases: Exception

__init__(msg, fp_write=None, *a, **k)[source]

Initialize self. See help(type(self)) for accurate signature.

__module__ = 'PyFoam.ThirdParty.tqdm.tqdm._tqdm'
__weakref__

list of weak references to the object (if defined)