/usr/local/lib/python3.6/site-packages/tqdm/__pycache__
NameSizeModeActions
asyncio.cpython-36.pyc32690644editdlrm
auto.cpython-36.pyc12000644editdlrm
autonotebook.cpython-36.pyc9700644editdlrm
cli.cpython-36.pyc91040644editdlrm
dask.cpython-36.pyc20920644editdlrm
gui.cpython-36.pyc46690644editdlrm
keras.cpython-36.pyc49040644editdlrm
notebook.cpython-36.pyc74930644editdlrm
rich.cpython-36.pyc51970644editdlrm
std.cpython-36.pyc457930644editdlrm
tk.cpython-36.pyc62560644editdlrm
utils.cpython-36.pyc117340644editdlrm
version.cpython-36.pyc4760644editdlrm
_dist_ver.cpython-36.pyc1610644editdlrm
_main.cpython-36.pyc4100644editdlrm
_monitor.cpython-36.pyc27900644editdlrm
_tqdm.cpython-36.pyc4050644editdlrm
_tqdm_gui.cpython-36.pyc4180644editdlrm
_tqdm_notebook.cpython-36.pyc4380644editdlrm
_tqdm_pandas.cpython-36.pyc9070644editdlrm
_utils.cpython-36.pyc8660644editdlrm
__init__.cpython-36.pyc15920644editdlrm
__main__.cpython-36.pyc1780644editdlrm
Edit: /usr/local/lib/python3.6/site-packages/tqdm/__pycache__/std.cpython-36.pyc (45793B)
3 Eg@sdZddlmZmZddlZddlmZmZddlm Z ddl m Z m Z ddl m Z ddlmZdd lmZdd lmZd d lmZd d lmZmZmZmZmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$dZ%ddddddddgZ&Gddde'Z(Gddde)Z*Gddde+Z,Gddde,e-Z.Gddde,e/Z0Gddde,e1Z2ddZ3Gdd d e4Z5Gd!d"d"e4Z6Gd#d$d$e4Z7Gd%ddeZ8d&dZ9dS)'z Customisable progressbar decorator for iterators. Includes a default `range` iterator printing to `stderr`. Usage: >>> from tqdm import trange, tqdm >>> for i in trange(10): ... ... )absolute_importdivisionN) OrderedDict defaultdict)contextmanager)datetime timedelta)Number)time)warn)WeakSet)TMonitor)CallbackIOWrapper ComparableDisableOnWriteError FormatReplaceSimpleTextIOWrapper _basestring _is_ascii_range_screen_shape_wrapper_supports_unicode _term_move_up_unich_unicodedisp_len disp_trimz*https://github.com/tqdm/tqdm#contributionstqdmtrange TqdmTypeError TqdmKeyError TqdmWarningTqdmExperimentalWarningTqdmDeprecationWarningTqdmMonitorWarningc@s eZdZdS)r N)__name__ __module__ __qualname__r)r)2/usr/local/lib/python3.6/site-packages/tqdm/std.pyr "sc@s eZdZdS)r!N)r&r'r(r)r)r)r*r!&scs"eZdZdZdfdd ZZS)r"zqbase class for all tqdm warnings. Used for non-external-code-breaking errors, such as garbled printing. NcsJ|dk r.|d|jjdt|jdntt|j|f||dS)N z: ) __class__r&strrstripsuperr"__init__)selfmsgfp_writeak)r,r)r*r0/s&zTqdmWarning.__init__)N)r&r'r(__doc__r0 __classcell__r)r))r,r*r"*sc@seZdZdZdS)r#z(beta feature, unstable API and behaviourN)r&r'r(r6r)r)r)r*r#6sc@s eZdZdS)r$N)r&r'r(r)r)r)r*r$;sc@seZdZdZdS)r%z>tqdm monitor errors which do not affect external functionalityN)r&r'r(r6r)r)r)r*r%@sc Os4yddlm}|||Sttfk r.YnXdS)zthreading RLockr)RLockN) threadingr8 ImportErrorOSError)argskwargsr8r)r)r*TRLockEs   r>c@sVeZdZdZeZddZddZddZdd Z d d Z e d d Z e ddZ dS)TqdmDefaultWriteLocka Provide a default write lock for thread and multiprocessing safety. Works only on platforms supporting `fork` (so Windows is excluded). You must initialise a `tqdm` or `TqdmDefaultWriteLock` instance before forking in order for the write lock to work. On Windows, you need to supply the lock from the parent to the children as an argument to joblib or the parallelism lib you use. cCsRt|}|j}|dk r|j|jdd|j|jgD|_|dk rN|jdS)NcSsg|]}|dk r|qS)Nr)).0Zlkr)r)r* dsz1TqdmDefaultWriteLock.__init__..)typeth_lockacquirecreate_mp_lockmp_locklocksrelease)r1clsZ root_lockr)r)r*r0\szTqdmDefaultWriteLock.__init__cOs x|jD]}|j||qWdS)N)rGrD)r1r4r5lockr)r)r*rDhs zTqdmDefaultWriteLock.acquirecCs&x |jdddD] }|jqWdS)Nr )rGrH)r1rJr)r)r*rHlszTqdmDefaultWriteLock.releasecCs |jdS)N)rD)r1r)r)r* __enter__pszTqdmDefaultWriteLock.__enter__cGs |jdS)N)rH)r1excr)r)r*__exit__sszTqdmDefaultWriteLock.__exit__c CsFt|dsByddlm}||_Wnttfk r@d|_YnXdS)NrFr)r8)hasattrmultiprocessingr8rFr:r;)rIr8r)r)r*rEvs    z#TqdmDefaultWriteLock.create_mp_lockcCs t|dsttdtdddS)NrCz!create_th_lock not needed anymore) stacklevel)rOAssertionErrorr r$)rIr)r)r*create_th_locksz#TqdmDefaultWriteLock.create_th_lockN)r&r'r(r6r>rCr0rDrHrLrN classmethodrErTr)r)r)r*r?Ns  r?c @seZdZdZdZddjeeedddZ dZ d Z d Z d d d ddddddZ de dfddZeddZejddZddZdS)Bara `str.format`-able bar with format specifiers: `[width][type]` - `width` + unspecified (default): use `self.default_len` + `int >= 0`: overrides `self.default_len` + `int < 0`: subtract from `self.default_len` - `type` + `a`: ascii (`charset=self.ASCII` override) + `u`: unicode (`charset=self.UTF` override) + `b`: blank (`charset=" "` override) z 123456789# i%i%r z zz[38;2;%d;%d;%dmzzzzzzzz)BLACKREDGREENYELLOWBLUEMAGENTACYANWHITE NcCs^d|kodkns6tdtddtdtd|}|dksBt||_||_||_||_dS)Nrr zclamping frac to range [0, 1]rQ)rR) r r"maxminrSfrac default_lencharsetcolour)r1rdrerfrgr)r)r*r0s z Bar.__init__cCs|jS)N)_colour)r1r)r)r*rgsz Bar.colourcCs|sd|_dSyz|j|jkr0|j|j|_nV|ddkrt|dkr|jtdd|dd|dd|ddfD|_ntWn<ttfk rtd |d j |jft d d d|_YnXdS) Nr#css|]}t|dVqdS)N)int)r@ir)r)r* szBar.colour..r z7Unknown colour (%s); valid choices: [hex (#00ff00), %s]z, rQ)rR) rhupperCOLOURSlen COLOUR_RGBtupleKeyErrorAttributeErrorr joinr")r1valuer)r)r*rgs4 c Cs|rz|dj}y|j|j|jd|}Wntk rD|j}YnX|dd}|rrt|}|dkrx||j7}q|j}n |j}|j}t|d}t t|j |||\}}|d|}||kr||||d||d}|j r|j ||j S|S)Nr )r4ubrrKrKrK) lowerASCIIUTFBLANKrvrfrlrersdivmodrdrg COLOUR_RESET) r1 format_spec_typerfZN_BARSZnsymsZ bar_lengthZfrac_bar_lengthresr)r)r* __format__s(       zBar.__format__rK)r&r'r(r6r}rxmaprranger~rrrtrrr0propertyrgsetterrr)r)r)r*rVs   rVc@s$eZdZdZdddZd ddZdS) EMAa[ Exponential moving average: smoothing to give progressively lower weights to older values. Parameters ---------- smoothing : float, optional Smoothing factor in range [0, 1], [default: 0.3]. Increase to give more weight to recent values. Ranges from 0 (yields old value) to 1 (yields new value). 333333?cCs||_d|_d|_dS)Nr)alphalastcalls)r1 smoothingr)r)r*r0sz EMA.__init__NcCsVd|j}|dk r6|j|||j|_|jd7_|jrP|jd||jS|jS)zk Parameters ---------- x : float New value to include in EMA. r N)rrr)r1xbetar)r)r*__call__s  z EMA.__call__)r)N)r&r'r(r6r0rr)r)r)r*rs  rc@seZdZdZdZdZeZed_ddZ edd Z ed d Z ed d Z ed`ddZ ddZedaddZeddZedbddZeedcddZeddZed d!Zed"d#Zddd(d)Zd*d+Zd,d-Zd.d/Zd0d1Zd2d3Zd4d5Zd6d7Zd8d9Z d:d;Z!e"dd?Z$d@dAZ%dedCdDZ&dEdFZ'dfdGdHZ(dgdIdJZ)dKdLZ*dhdMdNZ+didOdPZ,djdQdRZ-dkdSdTZ.dldUdVZ/dWdXZ0e"dYdZZ1dmd[d\Z2eednd]d^Z3dS)orz 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. raNrXcCs~xndD]f}t|d krdt|d krRt|d kr@d j|||Sd j|||Sdj|||S||}qWdj||S)a Formats a number (greater than unity) with SI Order of Magnitude prefixes. Parameters ---------- num : float Number ( >= 1) to format. suffix : str, optional Post-postfix [default: '']. divisor : float, optional Divisor between prefixes [default: 1000]. Returns ------- out : str Number with Order of Magnitude SI unit postfix. rXr5MGTPEZg<@gX@g= ףp#@z{0:1.2f}z{0:2.1f}z{0:3.0f}z {0:3.1f}Y)rXr5rrrrrr)absformat)numsuffixdivisorunitr)r)r* format_sizeofs     ztqdm.format_sizeofcCsBtt|d\}}t|d\}}|r2dj|||Sdj||SdS)z Formats a number of seconds as a clock time, [H:]MM:SS Parameters ---------- t : int Number of seconds. Returns ------- out : str [H:]MM:SS <z{0:d}:{1:02d}:{2:02d}z{0:02d}:{1:02d}N)rrlr)tZminsshmr)r)r*format_interval s ztqdm.format_intervalcCs:dj|jddjdd}t|}t|t|kr6|S|S)z Intelligent scientific notation (.3g). Parameters ---------- n : int or float or Numeric A Number. Returns ------- out : str Formatted number. z{0:.3g}z+0+z-0-)rreplacer-rs)nfr)r)r* format_num6sztqdm.format_numcsr|tdddtjtjfkrLttjdddttjdddfdddgfd d }|S) z 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). flushcSsdS)Nr)r)r)r)r*Qsz%tqdm.status_printer..cSsdS)Nr)r)r)r)r*rSscSsdS)Nr)r)r)r)r*rTscsjt|dS)N)writer)r)fpfp_flushr)r*r3Vsz%tqdm.status_printer..fp_writercs6t|}d|dtd|d|d<dS)N rWr)rrb)rZlen_s)r3last_lenr)r* print_status\s"z)tqdm.status_printer..print_status)getattrsysstderrstdout)filerr))rrr3rr*status_printerIsztqdm.status_printerFitrc#*Ks|r||dkrd}|rD|dkrD|r,||9}||9}|r@||9}d}tj|}|dkrf|rf|| |}|rrd|nd}tj}|r|r||qdj|nd|d}|r|r||qdj|ndd |}|r|dkr|n|}|r ||| d }|dk r||| d nd}nt|}|dk r$t|nd}y| r8d | nd } Wntk rTYnX|rn|rn|||nd }|rtj|nd}y,|r|rtjt|dntj d }Wnt k rtj }YnX|r|d ddk}|r|n|d}nd }dj|||||| }t f||||||||p,d ||rB|dkrB|n||||||| | | |||||d|}|r||}|d}|dj|7}|d kr|dd!|ddS|j |d| r|j |d|s| jdd } nd} t} y| jfd| i|}!Wn2tk r6t| } | jfd| i|}!YnX| jsD|!St||r`t d|t|!nd|dkrrtjn |p|tj| d} t| j rt| rt| } | jfd| i|}"|rt|"|S|"S| r`|d7}|j |d dt} | jfd| i|}!| js|!Std |r*t d|t|!ndtj| d} | jfd| i|}"|r\t|"|S|"Sdj|rr|dnd ||||| SdS)"a Return a string-based progress bar given some parameters Parameters ---------- n : int or float Number of finished iterations. total : int or float The expected total number of iterations. If meaningless (None), 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 `{bar}` to stay within this bound [default: None]. If `0`, will not print any bar (only stats). The fallback is `{bar:10}`. prefix : str, optional Prefix message (included in total width) [default: '']. Use as {desc} in bar_format string. ascii : bool, optional or str, optional If not set, use unicode (smooth blocks) to fill the meter [default: False]. The fallback is to use ASCII characters " 123456789#". unit : str, optional The iteration unit [default: 'it']. unit_scale : bool or int or float, optional If 1 or True, the number of iterations will be printed with an appropriate SI metric prefix (k = 10^3, M = 10^6, etc.) [default: False]. If any other non-zero number, will scale `total` and `n`. 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='{desc}: {percentage:3.0f}%|' and r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' '{rate_fmt}{postfix}]' Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, rate, rate_fmt, rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, postfix, unit_divisor, remaining, remaining_s, eta. Note that a trailing ": " is automatically removed after {desc} if the latter is empty. postfix : *, optional Similar to `prefix`, but placed at the end (e.g. for additional stats). Note: postfix is usually a string (not a dict) for this method, and will if possible be set to postfix = ', ' + postfix. However other types are supported (#382). unit_divisor : float, optional [default: 1000], ignored unless `unit_scale` is True. initial : int or float, optional The initial counter value [default: 0]. colour : str, optional Bar colour (e.g. 'green', '#00ff00'). Returns ------- out : Formatted meter and stats, ready to display. g?NTr Fz{0:5.2f}?z/szs/)rz, rXr)secondsrQz: z| {0}/{1} [{2}<{3}, {4}{5}])rn_fmttotal total_fmtelapsedZ elapsed_sncolsdescrraterate_fmtZ rate_noinvrate_noinv_fmtZrate_inv rate_inv_fmtpostfix unit_divisorrg remainingZ remaining_sl_barr_baretadz {0:3.0f}%|)r) percentagez{desc}: z{l_bar}{bar}{r_bar}barra)rfrg|)rrz{0}{1}{2} [{3}, {4}{5}])Tr rK)rrrrr- TypeErrorrnowrutcfromtimestamp OverflowErrorrbdictupdaterrUnicodeEncodeErrorrZ format_calledrVrr}r~rrfrr)#rrrrprefixasciir unit_scaler bar_formatrrinitialrg extra_kwargsZ elapsed_strZinv_raterrrrrrrZ remaining_strZeta_dtZbool_prefix_colon_alreadyrr format_dictrdrZfull_barZnobarrr)r)r* format_metercsF    && ,       ztqdm.format_metercOstj|}|j|jj||jr|jdks<|jj ryt||j|_Wn>t k r}z"t dt |t ddd|_WYdd}~XnXWdQRX|S)Nz>tqdm:disabling monitor support (monitor_interval = 0) due to: rQ)rRr) object__new__get_lock _instancesaddmonitor_intervalmonitorreportr Exceptionr r-r%)rI___instanceer)r)r*r0s     "z tqdm.__new__cs2fdd|jD}tttt|dj|S)zSkips specified instance.cs(h|] }|k rt|drt|jqS)pos)rOrr)r@inst)rr)r* Csz%tqdm._get_free_pos..r )rrcsetrrs difference)rIrZ positionsr))rr* _get_free_pos@sztqdm._get_free_poscs|jy|jj|Wntk r,YnX|js|jp.cSs|jS)N)r)rmr)r)r*ras)keyT)nolockN) _lockrremovervguinrowslistfilterrcclearrr)rIrZ instancesrr))rr*_decr_instancesGs    ztqdm._decr_instancesr+c CsD|dk r |ntj}|j||d|j||j|WdQRXdS)z5Print a message via tqdm (without overlap with bars).N)rr)rrexternal_write_moder)rIrrendrrr)r)r*res z tqdm.writec cs|dk r |ntj}z|s$|jjg}xVt|dgD]F}t|dr6|j|ksftdd||jfDr6|jdd|j |q6WdVx|D]}|j ddqWWd|s|j j XdS)z Disable tqdm within context and refresh tqdm when exits. Useful when writing to standard output stream Nrstart_tcss|]}|tjtjfkVqdS)N)rrr)r@rr)r)r*rnsz+tqdm.external_write_mode..T)r) rrrrDrrOrallrappendrefreshrrH)rIrrrZ inst_clearedrr)r)r*rns   ztqdm.external_write_modecCs ||_dS)zSet the global lock.N)r)rIrJr)r)r*set_locksz tqdm.set_lockcCst|dst|_|jS)z7Get the global lock. Construct it if it does not exist.r)rOr?r)rIr)r)r*rs z tqdm.get_lockc K sddlm}m}ddlm}ddlmy.||dtdddlm }WdQRXWnt k rnd}YnXd\}}ydd l m Wn|t k rydd l m WnTt k ry$dd lm}dd l m}||fWnt k rdYnXYnXYnXydd lm}dd lm} WnRt k rtyddlm} m}Wn&t k rnddlm} m}YnXYnXyddlm} Wn"t k rddlm} YnXyddlm} WnBt k ryddlm} Wnt k rd} YnXYnXjjddgdfdd } | _| |_| d_| d|_| |_| | _| d|_|dk rz| |_| dk r| | _| | _| d| _| d| _|dk r|dk r| |_| |_ndk r| _dS)ae Registers the current `tqdm` class with pandas.core. ( frame.DataFrame | series.Series | groupby.(generic.)DataFrameGroupBy | groupby.(generic.)SeriesGroupBy ).progress_apply A new instance will be created every time `progress_apply` is called, and each instance will automatically `close()` upon completion. Parameters ---------- tqdm_kwargs : arguments for the tqdm instance Examples -------- >>> import pandas as pd >>> import numpy as np >>> from tqdm import tqdm >>> from tqdm.gui import tqdm as 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) References ---------- r)catch_warnings simplefilter) DataFrame)Seriesignore)category)PanelN)_Rolling_and_Expanding) Expanding)Rolling) SeriesGroupBy)DataFrameGroupBy)rr)GroupBy) PanelGroupBy deprecated_tapplycsfdd}|S)Ncsbjdt|dd}|dkrdkr,|j}n^t|r@t|}nJdksTt| r|jdd}|dkrnd}n |dkrzd }|j|j|}ddk rddd<nfd|it|dkrtdtjdt j j dyddl m }Wntk r |j}YnXy |Wntk r0YnXfdd}zt||f|SjXdS)aT Parameters ---------- df : (DataFrame|Series)[GroupBy] Data (may be grouped). func : function To be applied on the (grouped) data. **kwargs : optional Transmitted to `df.apply()`. rZngroupsNapplymapaxisrindexcolumnsr z/Except func, normal arguments are intentionallyz not supported byz- `(DataFrame|Series|GroupBy).progress_apply`.z Use keyword arguments instead.r)r3)is_builtin_funccs.jj sjjkrdndd||S)Nr r)r)rrr)r<r=)funcrr)r*wrapper#s$zDtqdm.pandas..inner_generator..inner..wrapperz@Except func, normal arguments are intentionally not supported byzmExcept func, normal arguments are intentionally not supported by `(DataFrame|Series|GroupBy).progress_apply`.zExcept func, normal arguments are intentionally not supported by `(DataFrame|Series|GroupBy).progress_apply`. Use keyword arguments instead.)poprsize isinstancersgetshaper$rrrrZpandas.core.commonrr:Z_is_builtin_funcrclose)dfrr<r=rrrr)r rrIr df_function tqdm_kwargs)rrr*innersF           z3tqdm.pandas..inner_generator..innerr))r%r')r rrIrr&)r%r*inner_generatorsGz$tqdm.pandas..inner_generatorrrZ aggregateZ transform)NN)r)warningsrrZpandas.core.framer Zpandas.core.seriesr  FutureWarningpandasr r:Zpandas.core.window.rollingrZpandas.core.windowZpandas.core.window.expandingrrZpandas.core.groupby.genericrrZpandas.core.groupby.groupbyZpandas.core.groupbyrrcopyrZprogress_applyZ progress_mapZprogress_applymapZprogress_aggregateZprogress_transform) rIr&rrr r rrrrrrr(r))r rrIrr&r*r+s~#        L         z tqdm.pandasT皙?$@333333?c (Ks|dkr|dkotjdk}|dkr(tj}|rDt|t|ddp>dd}t||d}| dkrpt|drp|j rpd} |dkr|dk ry t|}Wnt t fk rd}YnX|t d krd}| r ||_ | |_ |j|j||_|jj|WdQRX||_||_||_dS|rtd|_ |j|j||_|jj|WdQRXd |krdtd t|d tjjd ntdt||dks|dkr|tjtjfks|r|rt}|r||\}}n4t}|r||\}}|dkr|}|dkr|}| dkrd} d}nd}|dkrd}|dkr(d}| dkr|j,d|j9|_?|j?|_@dS)a Parameters ---------- 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 or float, optional The number of expected iterations. If unspecified, len(iterable) is used if possible. If float("inf") or 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 number, e.g. 9e9. leave : bool, optional If [default: True], keeps all traces of the progressbar upon termination of iteration. If `None`, will leave only if `position` is `0`. 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. For encoding, see `write_bytes`. 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 display update interval [default: 0.1] seconds. maxinterval : float, optional Maximum progress display update interval [default: 10] seconds. Automatically adjusts `miniters` to correspond to `mininterval` after long display update lag. Only works if `dynamic_miniters` or monitor thread is enabled. miniters : int or float, optional Minimum progress display update interval, in iterations. If 0 and `dynamic_miniters`, will automatically adjust to equal `mininterval` (more CPU efficient, good for tight loops). If > 0, will skip display of specified number of iterations. Tweak this and `mininterval` to get very efficient loops. If your progress is erratic with both fast and slow iterations (network, skipping items, etc) you should set miniters=1. ascii : bool or str, optional If unspecified or False, use unicode (smooth blocks) to fill the meter. The fallback is to use ASCII characters " 123456789#". disable : bool, optional Whether to disable the entire progressbar wrapper [default: False]. If set to None, disable on non-TTY. unit : str, optional String that will be used to define the unit of each iteration [default: it]. unit_scale : bool or int or float, optional If 1 or True, 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]. If any other non-zero number, will scale `total` and `n`. dynamic_ncols : bool, optional If set, constantly alters `ncols` and `nrows` 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. [default: '{l_bar}{bar}{r_bar}'], where l_bar='{desc}: {percentage:3.0f}%|' and r_bar='| {n_fmt}/{total_fmt} [{elapsed}<{remaining}, ' '{rate_fmt}{postfix}]' Possible vars: l_bar, bar, r_bar, n, n_fmt, total, total_fmt, percentage, elapsed, elapsed_s, ncols, nrows, desc, unit, rate, rate_fmt, rate_noinv, rate_noinv_fmt, rate_inv, rate_inv_fmt, postfix, unit_divisor, remaining, remaining_s, eta. Note that a trailing ": " is automatically removed after {desc} if the latter is empty. initial : int or float, optional The initial counter value. Useful when restarting a progress bar [default: 0]. If using float, consider specifying `{n:.3f}` or similar in `bar_format`, or specifying `unit_scale`. 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). postfix : dict or *, optional Specify additional stats to display at the end of the bar. Calls `set_postfix(**postfix)` if possible (dict). unit_divisor : float, optional [default: 1000], ignored unless `unit_scale` is True. write_bytes : bool, optional If (default: None) and `file` is unspecified, bytes will be written in Python 2. If `True` will also write bytes. In all other cases will default to unicode. lock_args : tuple, optional Passed to `refresh` for intermediate output (initialisation, iterating, and updating). nrows : int, optional The screen height. If specified, hides nested bars outside this bound. If unspecified, attempts to use environment height. The fallback is 20. colour : str, optional Bar colour (e.g. 'green', '#00ff00'). delay : float, optional Don't display until [default: 0] seconds have elapsed. gui : bool, optional WARNING: internal parameter - do not use. Use tqdm.gui.tqdm(...) instead. If set, will attempt to use matplotlib animations for a graphical output [default: False]. Returns ------- out : decorated iterator. Nroencodingzutf-8)r0)Z tqdm_instanceisattyTinfnestedzQ`nested` is deprecated and automated. Use `position` instead for manual control. r)r3zUnknown argument(s): rFrXr) lock_args)ro)Ar version_inforrrrrOr1rsrrwfloatiterabledisablerrrrrrrleaver$rr!r-rrrrrrrrr mininterval maxintervalminitersdynamic_minitersrrrrrr4delayr dynamic_ncolsrr_ema_dn_ema_dt _ema_minitersrrrgr _time set_postfix last_print_nrspr last_print_tr) r1r7rrr9rrr:r;r<rr8rrr?rrrpositionrr write_bytesr4rrgr>rr=Z_dynamic_ncolsZ_ncolsZ_nrowsr=r)r)r*r0Ns|      "&              &  z tqdm.__init__cCs0|jdk r|jdkS|jdkr&tdt|jS)Nrz/bool() undefined when iterable == total == None)rr7rbool)r1r)r)r*__bool__\s    z tqdm.__bool__cCs|jS)N)rK)r1r)r)r* __nonzero__csztqdm.__nonzero__cCs`|jdkr|jSt|jdr(|jjdSt|jdr>t|jSt|jdrT|jjSt|ddS)Nr"r__len____length_hint__r)r7rrOr"rsrNr)r1r)r)r*rMfs z tqdm.__len__cCsNz@y |j}Wntk r(tdYnXt|j|_|jSWd||_XdS)Nz'tqdm' object is not reversible)r7rwrreversed__iter__)r1origr)r)r* __reversed__ns   ztqdm.__reversed__cCs*t|jdd}|dk r||S||jkS)N __contains__)rr7rP)r1itemcontainsr)r)r*rSysztqdm.__contains__cCs|S)Nr))r1r)r)r*rL}sztqdm.__enter__c CsDy |jWn2tk r>|||fdkr,tdtddYnXdS)NzAttributeError ignoredrQ)rR)NNN)r#rwr r")r1exc_type exc_value tracebackr)r)r*rNs  z tqdm.__exit__cCs |jdS)N)r#)r1r)r)r*__del__sz tqdm.__del__cCs|jf|jS)N)rr)r1r)r)r*__str__sz tqdm.__str__cCstt|ddS)Nrr l)rr)r1r)r)r* _comparablesztqdm._comparablecCst|S)N)id)r1r)r)r*__hash__sz tqdm.__hash__c cs|j}|jr$x|D] }|VqWdS|j}|j}|j}|j|j}|j}|j}zfx`|D]X}|V|d7}|||j krV|} | |} | |krV| |krV|j |||j}|j}qVWWd||_|j XdS)z6Backward-compatibility to use: for x in tqdm(iterable)Nr ) r7r8r:rGrErr>rrCr<rr#) r1r7objr:rGrEZ min_start_trr cur_tdtr)r)r*rPs0    z tqdm.__iter__r cCs8|jr dS|dkr |j|7_|j|7_|j|j|jkr4|j}||j}||jkol||j|jkr4|j}|j|j}|j r|r|r|j ||j ||j |j d|jr"|jr||jkr||jp|j||_n>|j r|j||jo|r|j|nd|_nt|j||_|j|_||_dSdS)ag 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. Parameters ---------- n : int or float, optional Increment to add to the internal counter of iterations [default: 1]. If using float, consider specifying `{n:.3f}` or similar in `bar_format`, or specifying `unit_scale`. Returns ------- out : bool or None True if a `display()` was triggered. Nr)r4r T)r8rErr<rCrGr:rr>rr@rArr4r=r;rBrb)r1rr`radnr)r)r*rs4     z tqdm.updatecs jr dSd_tj}jjjjkr:dStdddkrNdSfdd}y |dWn4tk r}zdt |krdSWYdd}~XnXj dkr|dknj }j F|rd d _ j dd |d nj d|d r| r|dWdQRXdS)z3Cleanup and (if leave=False) close the progressbar.NTrFcsjjt|dS)N)rrr)r)r1r)r*r3sztqdm.close..fp_writerXclosedrcSsdS)Nr)r)r)r)r*r#sztqdm.close..)rr+)r2rr)r8rrrrGrr>r ValueErrorr-r9rrAdisplay)r1rr3rr9r))r1r*r#s0        z tqdm.closecCsn|jr dS|s|jjt|j}||jp,dkr\|j||jd|jj d|j| |sj|jj dS)zClear current bar display.NrrXr) r8rrDrrrmovetorFrrrH)r1rrr)r)r*r+s      z tqdm.clearcCsH|jr dS|s.|r$|jj|s.dSn |jj|j|sD|jjdS)a Force refresh the display of this bar. Parameters ---------- nolock : bool, optional If `True`, does not lock. If [default: `False`]: calls `acquire()` on internal lock. lock_args : tuple, optional Passed to internal lock's `acquire()`. If specified, will only `display()` if `acquire()` returns `True`. NFT)r8rrDrerH)r1rr4r)r)r*r;s    z tqdm.refreshcCs0|jr dS|j}|j||j7_||_dS)z(Restart tqdm timer from last print time.N)r8rCrrG)r1r`r)r)r*unpauseVs z tqdm.unpausecCsdd|_|dk r||_|jrdSd|_|j|_|_t|j|_ t|j|_ t|j|_ |j dS)z Resets to 0 iterations for repeated use. Consider combining with `leave=True`. Parameters ---------- total : int or float, optional. Total to use for the new bar. rN) rrr8rErCrGrrrr@rArBr)r1rr)r)r*reset^s    z tqdm.resetcCs"|r |dnd|_|r|jdS)z Set/modify description of the progress bar. Parameters ---------- desc : str, optional refresh : bool, optional Forces refresh [default: True]. z: rXN)rr)r1rrr)r)r*set_descriptionts ztqdm.set_descriptioncCs|pd|_|r|jdS)z-Set/modify description without ': ' appended.rXN)rr)r1rrr)r)r*set_description_strs ztqdm.set_description_strc st|dkrgn|x t|jD]}|||<q"WxPjD]D}t|trf|j||<q@t|ts@t||<q@WdjfddjD|_ |r|j dS)a8 Set/modify postfix (additional stats) with automatic formatting based on datatype. Parameters ---------- ordered_dict : dict or OrderedDict, optional refresh : bool, optional Forces refresh [default: True]. kwargs : dict, optional Nz, c3s"|]}|d|jVqdS)=N)strip)r@r)rr)r*rnsz#tqdm.set_postfix..) rsortedkeysr r rrr-rxrr)r1Z ordered_dictrr=rr))rr*rDs ztqdm.set_postfixcCst||_|r|jdS)zS Postfix without dictionary expansion, similar to prefix handling. N)r-rr)r1rrr)r)r*set_postfix_strs ztqdm.set_postfix_strcCs8|jjtd|t| t|jddddS)Nr+rcSsdS)Nr)r)r)r)r*rsztqdm.moveto..)rrrrr)r1rr)r)r*rfs z tqdm.movetocCs|jr.t|d r.tdd|j|jdddS|jrH|j|j\|_|_|j|jt|drh|j |j nd|j|j|j |j |j |j|jr|j|jnd|j|j|j|j|jd S) z'Public API for read-only member access.rcSsdS)Nr)r)r)r)r*rsz"tqdm.format_dict..rr)rrrrrN)rrrrrrrrrrrrrrrg)r8rOrrrr?rrrrCrrrrrrAr@rrrrrg)r1r)r)r*rs  ztqdm.format_dictcCs|dkrt|j}|jpd}||dkrD||kr4dS|s@|dkrDd}t|dshtdt|jdtjj d |rv|j ||j |dkr|j n||r|j | d S) a Use `self.sp` to display `msg` in the specified `pos`. Consider overloading this function when inheriting to use e.g.: `self.some_frontend(**self.format_dict)` instead of `self.sp`. Parameters ---------- msg : str, optional. What to display (default: `repr(self)`). pos : int, optional. Position to `moveto` (default: `abs(self.pos)`). Nrr Fz ... (more hidden) ...rFzAPlease use `tqdm.gui.tqdm(...)` instead of `tqdm(..., gui=True)` r)r3T) rrrrOr$rrrrrrfrFrZ)r1r2rrr)r)r*res$        z tqdm.displayc ksH|fd|i|,}|r*d|_d|_d|_t|j||VWdQRXdS)a stream : file-like object. method : str, "read" or "write". The result of `read()` and the first argument of `write()` should have a `len()`. >>> with tqdm.wrapattr(file_obj, "read", total=file_obj.size) as fobj: ... while True: ... chunk = fobj.read(chunk_size) ... if not chunk: ... break rBTiN)rrrrr)rIstreammethodrbytesr&rr)r)r*wrapattrs z tqdm.wrapattr)rXr) NrXFrFNNNrrN)N)Nr+F)NF)NNNTNNr-r.NNFrFFr/NrNNrNNNNrF)r )F)FN)N)NT)NT)NT)rXT)NN)NT)4r&r'r(r6rrr r staticmethodrrrrrrrUrrrrrrrr+r0rKrLrMrRrSrLrNrYrZrr\r^rPrr#rrrgrhrirjrDrorfrrertr)r)r)r*rs~     K      7     & C,         $cOstt|f|S)zh A shortcut for tqdm(xrange(*args), **kwargs). On Python3+ range is used instead of xrange. )rr)r<r=r)r)r*rs):r6 __future__rrr collectionsrr contextlibrrrZnumbersr r r)r weakrefr _monitorrutilsrrrrrrrrrrrrrrr __author____all__rr rvr!Warningr"r*r#DeprecationWarningr$RuntimeWarningr%r>rr?rVrrrr)r)r)r* sL      D  7S