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.
-
__dict__
= mappingproxy({'__init__': <function tqdm.__init__>, '__lt__': <function tqdm.__lt__>, 'format_interval': <staticmethod object>, '__exit__': <function tqdm.__exit__>, 'refresh': <function tqdm.refresh>, 'unpause': <function tqdm.unpause>, 'clear': <function tqdm.clear>, '_decr_instances': <classmethod object>, '__weakref__': <attribute '__weakref__' of 'tqdm' objects>, '_get_free_pos': <classmethod object>, '__len__': <function tqdm.__len__>, '__enter__': <function tqdm.__enter__>, 'format_meter': <staticmethod object>, '__eq__': <function tqdm.__eq__>, '__repr__': <function tqdm.__repr__>, '__module__': 'PyFoam.ThirdParty.tqdm.tqdm._tqdm', '__iter__': <function tqdm.__iter__>, '__ge__': <function tqdm.__ge__>, 'status_printer': <staticmethod object>, 'pandas': <classmethod object>, '__del__': <function tqdm.__del__>, 'update': <function tqdm.update>, 'write': <classmethod object>, '__gt__': <function tqdm.__gt__>, 'set_description': <function tqdm.set_description>, '__le__': <function tqdm.__le__>, '__dict__': <attribute '__dict__' of 'tqdm' objects>, '__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 ', 'close': <function tqdm.close>, '__new__': <staticmethod object>, '__hash__': <function tqdm.__hash__>, 'format_sizeof': <staticmethod object>, '__ne__': <function tqdm.__ne__>, 'moveto': <function tqdm.moveto>})¶
-
__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]¶ - iterable : iterable, optional
- Iterable to decorate with a progressbar. Leave blank to manually manage the updates.
- desc : str, optional
- Prefix for the progressbar.
- total : int, 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).
- leave : bool, optional
- If [default: True], keeps all traces of the progressbar upon termination of iteration.
- file : io.TextIOWrapper or io.StringIO, optional
- Specifies where to output the progress messages [default: sys.stderr]. Uses file.write(str) and file.flush() methods.
- ncols : int, 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).
- mininterval : float, optional
- Minimum progress update interval, in seconds [default: 0.1].
- maxinterval : float, optional
- Maximum progress update interval, in seconds [default: 10.0].
- miniters : int, optional
- Minimum progress update interval, in iterations. If specified, will set mininterval to 0.
- ascii : bool, optional
- If unspecified or False, use unicode (smooth blocks) to fill the meter. The fallback is to use ASCII characters 1-9 #.
- disable : bool, optional
- Whether to disable the entire progressbar wrapper [default: False].
- unit : str, optional
- String that will be used to define the unit of each iteration [default: it].
- unit_scale : bool, 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_ncols : bool, optional
- If set, constantly alters ncols to the environment (allowing for window resizes) [default: False].
- smoothing : float, 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_format : str, 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.
- initial : int, optional
- The initial counter value. Useful when restarting a progress bar [default: 0].
- position : int, 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).
- gui : bool, 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.
-
__module__
= 'PyFoam.ThirdParty.tqdm.tqdm._tqdm'¶
-
__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
-
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.
-
classmethod
pandas
(tclass, *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
-
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).
-
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].
-
-
class
PyFoam.ThirdParty.tqdm.tqdm.
tqdm_gui
(*args, **kwargs)[source]¶ Bases:
PyFoam.ThirdParty.tqdm.tqdm._tqdm.tqdm
Experimental GUI version of tqdm!
-
__module__
= 'PyFoam.ThirdParty.tqdm.tqdm._tqdm_gui'¶
-
-
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.
-
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)
-