;iudZddlZddlmZmZddlmZddlmZmZm Z ddl m Z ddl m Z ddl mZdd lmZd d lmZd d lmZmZmZmZmZmZmZmZmZmZmZmZd Z gdZ!Gdde"Z#Gdde$Z%Gdde&Z'Gdde'e(Z)Gdde'e*Z+Gdde'e,Z-dZ.Gdde/Z0Gdde/Z1Gd d!e/Z2Gd"d#eZ3d$Z4dS)%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): ... ... N) OrderedDict defaultdict)contextmanager)datetime timedeltatimezone)Number)time)warn)WeakSet)TMonitor) CallbackIOWrapper ComparableDisableOnWriteError FormatReplaceSimpleTextIOWrapper _is_ascii_screen_shape_wrapper_supports_unicode _term_move_updisp_len disp_trimenvwrapz*https://github.com/tqdm/tqdm#contributions)tqdmtrange TqdmTypeError TqdmKeyError TqdmWarningTqdmExperimentalWarningTqdmDeprecationWarningTqdmMonitorWarningceZdZdS)rN__name__ __module__ __qualname__tqdm monitor errors which do not affect external functionalityNr?r(r)r*r"r">sHHDr)r"cP ddlm}||i|S#ttf$rYdSwxYw)zthreading RLockrRLockN) threadingrD ImportErrorOSError)argskwargsrDs r*TRLockrJCsU ######ud%f%%%  !     s %%cpeZdZdZeZdZdZdZdZ dZ e dZ e dZ d S) 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. ct|}|j}|||d|j|jfD|_||dSdS)Ncg|]}||Sr;r().0lks r* z1TqdmDefaultWriteLock.__init__..bsPPPRbr))typeth_lockacquirecreate_mp_lockmp_locklocksrelease)r6cls root_locks r*r5zTqdmDefaultWriteLock.__init__Zs4jjK        PPCK#=PPP          ! r)c4|jD]}|j|i|dSr;)rWrT)r6r9r:locks r*rTzTqdmDefaultWriteLock.acquirefs7J " "D DL! !q ! ! ! ! " "r)cT|jdddD]}|dS)N)rWrX)r6r\s r*rXzTqdmDefaultWriteLock.releasejs7Jttt$  D LLNNNN  r)c.|dSr;)rTr6s r* __enter__zTqdmDefaultWriteLock.__enter__n r)c.|dSr;)rX)r6excs r*__exit__zTqdmDefaultWriteLock.__exit__qrbr)ct|ds7 ddlm}||_dS#tt f$r d|_YdSwxYwdS)NrVrrC)hasattrmultiprocessingrDrVrFrG)rYrDs r*rUz#TqdmDefaultWriteLock.create_mp_locktsssI&& # #111111#egg ) # # #"  #  # #s)AAcXt|dsJtdtddS)NrSz!create_th_lock not needed anymore stacklevel)rgr r!rYs r*create_th_lockz#TqdmDefaultWriteLock.create_th_lock}s6sI&&&&& 02HUVWWWWWWr)N)r%r&r'r<rJrSr5rTrXrare classmethodrUrnr(r)r*rLrLLsfhhG    """##[#XX[XXXr)rLc eZdZdZdZddeeedddzZ dZ d Z d Z d d d ddddddZ de dfdZedZejdZdZdS)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 Ncd|cxkrdks7ntdtdtdtd|}|dksJ||_||_||_||_dS)Nrr zclamping frac to range [0, 1]rjrk)r rmaxminfrac default_lencharsetcolour)r6rrrrs r*r5z Bar.__init__stD~~~~A~~~~ 0+! L L L Lq#a,,''DQ &  r)c|jSr;)_colourr`s r*rz Bar.colours |r)c |s d|_dS ||jvr&|j||_dS|ddkrVt|dkrC|jt d|dd|dd|ddfDz|_dSt #t tf$rAtd|d d |jd td d|_YdSwxYw)Nr#c36K|]}t|dVdS)N)int)rOis r* zBar.colour..sC7N7N#$C2JJ7N7N7N7N7N7Nr)r zUnknown colour (z"); valid choices: [hex (#00ff00), , ]rjrk) rupperCOLOURSlen COLOUR_RGBtupleKeyErrorAttributeErrorr joinr)r6values r*rz Bar.colours< DL F {{}} ,,#|EKKMM: qSSZZ1__#7N7N).qsU1Q3Zqs(L7N7N7N2N2N N .)   D $,////1 , , , , DLLLL  s?B7A B70B77AD D c2|r|d} |j|j|jd|}|dd}n#t$r |j}YnwxYw|r t |}|dkr ||jz }n|j}n|j}|j}t|dz }tt |j |z|z|\}}|d|z}||kr|||z|d||z dz zz}|j r|j |z|j zn|S)Nr^)r9ubrr ) lowerASCIIUTFBLANKrrrrrdivmodrr COLOUR_RESET) r6 format_spec_typerN_BARSnsyms bar_lengthfrac_bar_lengthress r* __format__zBar.__format__sY  &O))++E / $  KKER*#2#.  ' ' ', ' *[))A::d..F)lG%FG q &,SV1Ce1K-L-Le&T&T# ObkJ&   0071:*ATWXAX3YYC8< Lt{S 4#444LsAAA)r%r&r'r<rrmapchrrangerrrrrr5propertyrsetterrr(r)r*rqrqs   E ##c55#<#<==>> >C EL&J": #ZJ!J88G*,SX ]  ] $MMMMMr)rqc"eZdZdZddZddZdS)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?c0||_d|_d|_dS)Nralphalastcalls)r6 smoothings r*r5z EMA.__init__s   r)Ncd|jz }|*|j|z||jzz|_|xjdz c_|jr|jd||jzz z n|jS)zk Parameters ---------- x : float New value to include in EMA. r r)r6xbetas r*__call__z EMA.__call__sc4:~ = Q )99DI JJ!OJJ7;zPtyA 2233tyPr))rr;)r%r&r'r<r5rr(r)r*rrsL   Q Q Q Q Q Qr)rc eZdZdZdZdZeZed:dZ edZ edZ ed Z e d;d Z dZeddZedZedZedZeddeeeeed d?dZd Zd!Zd"Zd#Zd$Z d%Z!d&Z"d'Z#e$d(Z%d)Z&d*Z'd@d,Z(d-Z)dAd.Z*dBd/Z+d0Z,d 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 Whether to write bytes. If (default: False) will write 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. r|NrscdD]a}t|dkrGt|dkr)t|dkr |d||cS|d||cS|d||cS||z}b|dd |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. )rsr:MGTPEZg<@gX@g= ףp#@z1.2fz2.1f3.0fz3.1fY)abs)numsuffixdivisorunits r* format_sizeofztqdm.format_sizeofrs(<  D3xx%s88e##3xx%''"%::D:&:::::!666f6666622D2&22222 7NCC%%%V%%%r)ctt|d\}}t|d\}}|r |dd|dd|dn|dd|dS)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 <d:02d)rr)tminsshms r*format_intervalztqdm.format_intervalssQ$$adB1+,D!''''''''''Q2D2D2DQ2D2D2DDr)c|ddddd}t|}t|t|kr|n|S)z Intelligent scientific notation (.3g). Parameters ---------- n : int or float or Numeric A Number. Returns ------- out : str Formatted number. z.3gze+0ze+ze-0ze-)replacer2r)nfs r* format_numztqdm.format_numsVJJ  ud + + 3 3E4 @ @ FFFFSVVOOqq*r)c|tddtjtjfvrHttjddttjddfddgfd}|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). flushcdSr;r(r(r)r*z%tqdm.status_printer..sr)cdSr;r(r(r)r*rz%tqdm.status_printer..r)cdSr;r(r(r)r*rz%tqdm.status_printer..rr)c`t|dSr;)writer2)rfpfp_flushs r*r8z%tqdm.status_printer..fp_writes* HHSVV    HJJJJJr)rct|}d|zdtd|z dzz|d<dS)N rrr)rr~)rlen_sr8last_lens r* print_statusz)tqdm.status_printer..print_statussLQKKE HTAXs8A;+>'B'B!BC D D DHQKKKr))getattrsysstderrstdout)filerrrr8rs @@@@r*status_printerztqdm.status_printers2w 55 #*cj) ) ) 6GCJ 6 6 8 8 8 6GCJ 6 6 8 8 8      3      r)Fitrc *|r ||dzkrd}|r|dvr|r||z}||z}|r||z}d}t|}| |r|| z |z }|rd|z nd}tj}|r|r ||n|dnd|zdz}|r|r ||n|dndd z|z}|r|dkr|n|}|r||| }| ||| nd}n"t|}|t|nd} | rd | znd } n#t$rYnwxYw|r |r||z |z nd }|rt|nd} |r&|r$t jt|znt jd tj }n#t$rt j }YnwxYw|r|dddk}|r|n|dz}nd }d|d|d|d|d || d }id|d|d|d|d|d|d|d|pd d|d|r|dkr|n|d |d!|d"|d#|d$|d%| d&| | |||||d'|}|rC||z }|d(z}||d)d*z }|d kr|dd+|ddzS| |,| r/| |-|s| d.d } nd/} t} | jd6d0| i|}!| js|!St%||r td|t'|!z nd1|d2ur t$jn |p t$j| 3} t-| jst-| rt| } | jd6d0| i|}"|rt1|"|n|"S| r|d4z }| |d 5t} | jd6d0| i|}!| js|!St%d |r td|t'|!z nd1t$j| 3} | jd6d0| i|}"|rt1|"|n|"S|r|dznd ||d|d || d S)7a 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?N)Tr Fr z5.2f?z/szs/)rrrsr)secondsr0z| /z [CK3q%(5//"9:::05 3995CSCG"(***HX-.. -9Z3H3H - __ #*#@@@K@@C,1:9S%(((s :  K SLE   Uq  9 9 9$H%J%BB(BkBBE)  1>CK3q%(5//"9:::#&9V===H$*#@@@K@@C,1:9S%(((s :+18 bJJ"JJ&1JJ5=J?FJJJ Ks%* C44 DD1AE99FFct|}|5|j||jr|j|jsa t||j|_nE#t$r8}tdt|ztdd|_Yd}~nd}~wwxYwdddn #1swxYwY|S)Nz>tqdm:disabling monitor support (monitor_interval = 0) due to: rjrkr) object__new__get_lock _instancesaddmonitor_intervalmonitorreportr Exceptionr r2r")rY___instancees r*r-z tqdm.__new__s>>>#&& \\^^ - - N  x ( ( (# -)<03 0B0B0D0D*=-"*30D"E"ECKK ---=?B1vvF+;;;;,-C(((((( - - - - - - - - - - - - - - - -s<AC2B  C C.C C CCC"%C"c fd|jD}tttt |dz|S)zSkips specified instance.c`h|]*}|ut|dt|j+Spos)rgrr<)rOinstr7s r* z%tqdm._get_free_pos..sGGGGtH,,u1E1E,]],,,r)r )r/rsetrr difference)rYr7 positionss ` r* _get_free_posztqdm._get_free_possjGGGGs~GGG 3uS^^a/0011<.sga//ADAEMr)c|jSr;r;)rs r*rz&tqdm._decr_instances..sr))keyTnolockN) _lockr/removerguinrowslistfilterrclearrr<)rYr7 instancesr=rs @r*_decr_instancesztqdm._decr_instancess=Y 1 1 %%h////     < 1 ,"1 AAAAN"$"$%% 1yoo>>>DJJdJ+++"8<00DH% 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1s-B>&B> 3B>3A>B>>CCr/c||n tj}|||5||||ddddS#1swxYwYdS)z5Print a message via tqdm (without overlap with bars).N)rrI)rrexternal_write_moder)rYrrendrIrs r*rz tqdm.writes%TT3:  $ $$v $ > >   HHQKKK HHSMMM                  s+A  A$'A$c#0K||n tj} |s&|g}t |dgD]h}t |drV|j|ks td||jfDr+|d| |idV|D]}| d |s|j dSdS#|s|j wwxYw)z Disable tqdm within context and refresh tqdm when exits. Useful when writing to standard output stream Nr/start_tc3JK|]}|tjtjfvVdSr;)rrr)rOrs r*rz+tqdm.external_write_mode..sQFNFN:;cj#*55FNFNFNFNFNFNr)TrH) rrr.rTrrgrallrPappendrefreshrJrX)rYrrIr inst_clearedr=s r*rTztqdm.external_write_modesm%TT3: $ ) &&(((L\266 . .4++.B#FNFN@BDG}FNFNFNCNCNJJdJ+++ ''--- EEE$ * * D )))) * $ !!##### $ $6 $ !!#### $s CC77Dc||_dS)zSet the global lock.N)rJ)rYr\s r*set_lockz tqdm.set_locks r)cVt|dst|_|jS)z7Get the global lock. Construct it if it does not exist.rJ)rgrLrJrms r*r.z tqdm.get_locks+sG$$ /,..CIyr)c 8 ddlm}m}ddlm}ddlm  |5|dtddlm }dddn #1swxYwYn#t$rd}YnwxYwd \}} dd l m nL#t$r? dd l m n4#t$r' dd lm}dd l m}||fn#t$rdYnwxYwYnwxYwYnwxYw dd lm}ddlm} n2#t$r% ddlm} m}n#t$r ddlm} m}YnwxYwYnwxYw ddlm} n#t$r ddlm} YnwxYw ddlm} n*#t$r ddlm} n#t$rd} YnwxYwYnwxYwddgd fd } | _| |_| d _| d|_| |_| | _| d|_| d|_| d| _|| |_| | | _| | _| d| _| d| _|"| | |_| |_dS| _dSdS)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)PanelNNN)_Rolling_and_Expanding) Expanding)Rolling) SeriesGroupBy)DataFrameGroupBy)rmrl)GroupBy) PanelGroupBy deprecated_tapplycfd}|S)Nc*dt|dd}|| dkr|j}nnt| rt |}nN t| s<|dd}|dkrd}n|dkrd }|j|j|z} d dd d<n  dd|it |dkr4td tjd tj j   dd l m }n#t$r |j}YnwxYw |n#t $rYnwxYwfd} t| |fi|S#wxYw)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()`. rngroupsNapplymapaxisrindexcolumnsr zExcept func, normal arguments are intentionally not supported by `(DataFrame|Series|GroupBy).progress_apply`. Use keyword arguments instead.rr8)is_builtin_funccrjrjjkrdnd|i|S)Nr r)r)rrr)rHrIfuncrs r*wrapperzDtqdm.pandas..inner_generator..inner..wrappersE HHG13==qqaHHHH40000r)r()poprsize isinstancergetshaper!rrrrpandas.core.commonrzrF_is_builtin_funcrclose)dfr|rHrIrrvrzr}rrdrirYrp df_function tqdm_kwargss ` @r*innerz3tqdm.pandas..inner_generator..innerRs$Y1M1MNN="j00 "#B// : #B08(-CDD9 &zz&!447??#$DD!Y..#$D "28D> 9 ?.$QA&*LOO77%7;77At99q==*:")w 8H!I!I KKKK:BBBBBBB":::&(&9OOO:*?400DD D111111372{33GFFvFFGGIIIIAGGIIIIs0DD*)D*. D:: EEE<<Fr()rrrdrirYrprs` r*inner_generatorz$tqdm.pandas..inner_generatorQsHE E E E E E E E E E NLr)rru aggregate transform)rq)warningsrarbpandas.core.framercpandas.core.seriesrd FutureWarningpandasrgrFpandas.core.window.rollingripandas.core.windowpandas.core.window.expandingrjrkpandas.core.groupby.genericrlrmpandas.core.groupby.groupbypandas.core.groupbyrnrocopyr~progress_apply progress_mapprogress_applymapprogress_aggregateprogress_transform)rYrrarbrcrgrkrjrlrmrnrorrdrirps`` @@@r*rz tqdm.pandassF :9999999//////------ !! ) ) X >>>>(((((( ) ) ) ) ) ) ) ) ) ) ) ) ) ) )   EEE ' 2 I I I I I I I 2 2 2 2EEEEEEE 2 2 22FFFFFFBBBBBB-4i-?**"222-1***2  2 2 P A A A A A A D D D D D D D P P P PWWWWWWWWW P P POOOOOOOOOO P P  4 ; ; ; ; ; ; ; 4 4 4 3 3 3 3 3 3 3 3 4 $ @ @ @ @ @ @ @ $ $ $ $<<<<<<< $ $ $#  $ $ "&&(( #==> H H H H H H H H H H X!0 1 1'6'8'8 $-oe44%4_U%;%; "#2?#4#4  *9/*;*;'&5oj&A&A #!0!7!7 (7(>(>%  #2?#4#4E  #*9/*;*;L '!0!2!2%4_[%A%A"%4_[%A%A"  9#8%4_%6%6G "'6'8'8I $ $ $ # /4CO4E4E " 1 1 10 /s  AA  A AAAA A%$A%.A55 B>BB> B8B#"B8# B2/B81B22B85B>7B88B>=B> C C>C#"C>#C85C>7C88C>=C>D DD D'' E2D98E9 EEEE ETQDM_T)rrminiterspositionrM) is_methodtypes皙?$@rc | tj}|r"t|t|ddpd}t ||}| &t |dr|sd} |,|* t|}n#ttf$rd}YnwxYw|tdkrd}| rx||_ | |_ |j 5|||_|j|dddn #1swxYwY||_||_||_dS|rd|_ |j 5|||_|j|dddn #1swxYwYd |vr/t+d t|d tjj nt/d t1|z|||tjtjfvs|rG|rt5}|r||\}}n&t5}|r||\}}||}||}| d} d}nd}|d}|d}| t7| } |r"| durt9| st1|}|d}||_ |pd|_||_||_||_||_||_ ||_!||_"| |_#||_$| |_%| |_ | |_&| |_'||_(||_)||_*||_+||_,||_-||_.t_||_0t_||_1t_||_2||_3d|_4||_5tl|_7|r( |j8dddi|n#t$r ||_4YnwxYw||_9||_|j 5|||n| |_dddn #1swxYwY|s@|:|j|_;|dkr|<|j*|7|_=|j=|_>dS)zsee tqdm.tqdm for argumentsNencodingzutf-8)r) tqdm_instanceisattyTinfnestedzQ`nested` is deprecated and automated. Use `position` instead for manual control. rryzUnknown argument(s): rFrsr[ lock_argsr()?rrrrrrgrrrrfloatiterabledisablerJrBr<r/rKrrleaver!rrr2rrrrrrrrM mininterval maxintervalrdynamic_minitersrrrr r rdelayrL dynamic_ncolsrr_ema_dn_ema_dt _ema_minitersrr rr _time set_postfix last_print_nrspr[ last_print_trW) r6rrrrrrrrrrrrrrrrr rr r  write_bytesrrMrrrLrI_dynamic_ncols_ncols_nrowsrs r*r5z tqdm.__init__s <:D  K'wtZ>>I'KKKD#4t<<< ?wtX66?t{{}}?G =X1 H ~.     E%LL E  $DM"DL - ---d33&&t,,, - - - - - - - - - - - - - - -DFDJDJ F  EDL - ---d33&&t,,, - - - - - - - - - - - - - - -v%% 'C$T7CJ4DEEGGGG 4s6{{BCC  E]em$3:sz:R2R2R 3S ' 5 7 7  7#0=#6#6LE5!6!8!8!'%3^D%9%9NFF} &} &  H#  $   K  K =)$///E  )%t++Ie4D4D+ZJ  I! JB     &&  0   $( " *"9~~ 9~~  ^^$    ' '  :::':::: ' ' '&  '$Z S S3;3Ct))$///(DH S S S S S S S S S S S S S S S 7))$'22DGzz t~ 666!JJLL( sZ1BBB5DD D 95E::E>E>NN)(N) O--O14O1cz|j |jdkS|jtdt|jS)Nrz/bool() undefined when iterable == total == None)rrrboolr`s r*__bool__z tqdm.__bool__Qs= : !:> ! = MNN NDM"""r)c<|j|jnt|jdr|jjdngt|jdrt |jn>t|jdr|jnt |ddS)Nrr__len____length_hint__r)rrrgrrrrr`s r*rz tqdm.__len__Xs-/DJJ+24='+J+J.$Q'''.t}i'H'H.T]###4;DMK\4]4]...000w--  /r)c |j}t|j|_|||_S#t$rt dwxYw#||_wxYw)Nz'tqdm' object is not reversible)rreversed__iter__rr)r6origs r* __reversed__ztqdm.__reversed__`sw !=D%T]33DM==?? DMM  ? ? ?=>> > ? !DM s=,AAA A#ctt|jdd}| ||n||vS)N __contains__)rrr)r6itemcontainss r*rztqdm.__contains__ks94=.$??!)!5xx~~~44==??;RRr)c|Sr;r(r`s r*raztqdm.__enter__os r)c |dS#t$r%|||fdkrtdtdYdSwxYw)N)NNNzAttributeError ignoredrjrk)rrr r)r6exc_type exc_value tracebacks r*rez tqdm.__exit__rsm F JJLLLLL F F F)Y/3EEE );1 E E E E E E E  Fs+AAc.|dSr;)rr`s r*__del__z tqdm.__del__{s r)c&|jdi|jS)Nr()r*r'r`s r*__str__z tqdm.__str__~s t 444#3444r)c>tt|ddS)Nr<l)rrr`s r* _comparableztqdm._comparables7400111r)c t|Sr;)idr`s r*__hash__z tqdm.__hash__s $xxr)c#K|j}|jr |D]}|VdS|j}|j}|j}|j|jz}|j}|j} |D]Z}|V|dz }||z |j krA|} | |z } | |kr,| |kr&| ||z |j}|j}[ ||_| dS#||_| wxYw)z6Backward-compatibility to use: for x in tqdm(iterable)Nr ) rrrrrrWrrrrrr) r6robjrrr min_start_trr cur_tdts r*rz tqdm.__iter__s5= <    F& ( ( lTZ/ Fz  9 9 Q|#t}44 DFFE-B[((Uk-A-A A $4555'+'8 '+'8  9DF JJLLLLLDF JJLLLLs AC C'r c4|jrdS|dkr|xj|z c_|xj|z c_|j|jz |jkrK|}||jz }||jkr#||j|jzkr|}|j|jz }|j r.|r,|r*| || || |j |jr~|jr%||jkr||jp|jz|z |_nR|j r1|||jr |r |j|z ndz|_nt#|j||_|j|_||_dSdSdSdS)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. Nrrr T)rrrrrrrrWrrrrr[rrrrr~)r6rrrdns r*rz tqdm.updates4 <  F q55    "   !  6D% % 6 6JJLLE**BT%%%%4<$*3L*L*L Vd//>%b%R%LL$$$LL$$$ t~ 666(? ' ?B$2B,B,B(*d.>.R$BR(SVX(X ?(,(:(:4;K#)PR#)$"2R"7"7'(*)+)+ ),DM2(>(> %)F!$)!t? 7 6&%*L*Lr)cTjrdSd_tj}jjjzkrdStdddSfd} |dn*#t$r}dt|vrYd}~dSd}~wwxYwj |dknj }j 5|r*d_ d |d n$ d| r |s |d ddddS#1swxYwYdS) z3Cleanup and (if leave=False) close the progressbar.NTrcVjt|dSr;)rrr2)rr6s r*r8ztqdm.close..fp_writes# GMM#a&& ! ! ! ! !r)rsclosedrcdSr;r(r(r)r*rztqdm.close..tr)r;r/)r7r<r)rrr<rRrrWrr ValueErrorr2rrJrdisplay)r6r<r8r8rs` r*rz tqdm.closes <  F $(mm T"""  t|dj8 8 8 F 4t $ $ , F " " " " "  HRLLLL   3q66!!   !J.qDJ Z # # #+|   ###<** 4>**  00 r)cR|r|dznd|_|r|dSdS)z Set/modify description of the progress bar. Parameters ---------- desc : str, optional refresh : bool, optional Forces refresh [default: True]. r0rsNrr[r6rr[s r*set_descriptionztqdm.set_descriptionfs;$(/D4KKR   LLNNNNN  r)cH|pd|_|r|dSdS)z-Set/modify description without ': ' appended.rsNrrs r*set_description_strztqdm.set_description_strts0JB   LLNNNNN  r)c 4t|gn|t|D] }|||<D]o}t|tr|||<.sP!<!<%("%sWS\-?-?-A-A!A!<!<!<!<!<!> 1 1C'#,// 1#ws|<<  c22 1"73<00 yy!<!<!<!<,3LLNN!<!<!<<<   LLNNNNN  r)c^t||_|r|dSdS)zS Postfix without dictionary expansion, similar to prefix handling. N)r2r r[)r6rr[s r*set_postfix_strztqdm.set_postfix_strs41vv   LLNNNNN  r)c|jd|zt| zzt|jdddS)Nr/rcdSr;r(r(r)r*rztqdm.moveto..s$r))rrrr)r6rs r*rz tqdm.movetosN  dQhA2!55666/,,//11111r)cD|jr0t|ds td|j|jdddS|jr'||j\|_|_|j|jt|dr| |j z nd|j|j|j |j |j |j|r)||z nd|j|j|j|j|jdS) z'Public API for read-only member access.rcdSr;r(r(r)r*rz"tqdm.format_dict..rr)rr)rrrrrWN)rrrrrMrrrrrrr r r r)rrgrrrrrrrMrrWrrrrrrrr r r rr`s r*r'ztqdm.format_dicts < Of 5 5 O||VdjQ.N.NOO O   A%)%7%7%@%@ "DJ $*6=dI6N6NUtzz||dl22TUZ$* Z$/7;||~~ODLLNNT\\^^334/dl -$,k## #r)c|t|j}|jpd}||dz kr||krdS|s|d}t|ds4t dt |jdtjj  |r| || || n||r| | 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)`). NrDr Fz ... (more hidden) ...rzAPlease use `tqdm.gui.tqdm(...)` instead of `tqdm(..., gui=True)` rryT) rr<rMrgr!rrrrrrrr)r6r7r<rMs r*rz tqdm.displays ;dh--C  b %!)  e||u /ck.tT"" F(6 '3:3CDDFFF F   KK    #+ 3777   KK   tr)c+K|dd|i|5}|rd|_d|_d|_t|j||VddddS#1swxYwYdS)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 rBTiNr()rrr rr)rYstreammethodrbytesrrs r*wrapattrz tqdm.wrapattrsS , ,u , , , > &# !%#AHff== = = =  > > > > > > > > > > > > > > > > > >s0A  AA)rsr) NrsFrFNNNrrNr;)Nr/F)NF)NNNTNNrrNNFrFFrNrNNrFNNNrF)r )F)FN)NT)rsTrh)6r%r&r'r<r1r2r r/ staticmethodrrrrr*r-rorBrRrrrTr^r.rrrrr5rrrrrarerrrrrrrrrPr[rrrrrrrr'rrr(r)r*rrsvvpGJ&&&\&:EE\E$++\+$\2QUKO:>DKDKDK\DKL III[I 11[1:[$$$^[$8[[ uFuF[uFp WWecW\9222 ##X#"""""H>>>^[>>>r)rc*tt|fi|S)z*Shortcut for tqdm(range(*args), **kwargs).)rr)rHrIs r*rrs t ' ' ' ''r))5r<r collectionsrr contextlibrrrrnumbersr r rr weakrefr _monitorrutilsrrrrrrrrrrrr __author____all__rrrrWarningrrr DeprecationWarningr!RuntimeWarningr"rJr,rLrqrrrr(r)r*rs^ 00000000%%%%%%2222222222                            :  ! ! !      I        8    + + + + +' + + +     k=        [*<        n      4X4X4X4X4X64X4X4XnPMPMPMPMPM&PMPMPMfQQQQQ&QQQ>z>z>z>z>z>:z>z>z>z'(((((r)