
    +hb)                         d Z ddlZddlZddlZddlmZ ddlmZm	Z	m
Z
 ddlmZ dgZ ej                  e      Zd Zd	d
d dfdZ ej&                  d      Z ej&                  d      ZdZdZej0                  dfdZy)zI
Module version for monitoring CLI pipes (`... | python -m tqdm | ...`).
    N)literal_eval   )TqdmKeyErrorTqdmTypeErrortqdm)__version__mainc           	         t         j                  | |f       d|v r5|j                  d      D ]  }	 t        | |      c S  t	        | dz   |z         |dk(  r"| dk(  s| dk(  ry| dk(  ryt	        | dz   |z         	 t        |d	z   | z   d
z         S # t        $ r Y kw xY w# t        $ rJ |dk(  r3t        t        t        d| z   dz                     j                         cY S t	        | dz   |z         w xY w)Nz or z : boolTrue TFalseFz("z")chr")
logdebugsplitcastr   eval	Exceptionr   ordencode)valtypts      ;/var/www/html/venv/lib/python3.12/site-packages/tqdm/cli.pyr   r      s   IIsCj}6" 	AC|#	
 C%K#-.. f}6MsbyG^ec 1223C$J$t+,, !   3%<s4c	C01299;;ec 122	3s#   B9B 	BB?C/C/   \n   c                      y N )floats    r   <lambda>r#   ,           Tc           	      @   |j                   }|sB	 | j                  |      }|s t        |dd               y ||        |t        |             Ad}t        |      }		 | j                  |      }|sY|rC ||       |r |d|j	                  |      z          n|j                  |      D ]
  }
 ||
         t        |dd               y	 |j                  |      }
|
dk  r||z  }n7 |||d|
t        |      z    z           ||rdn||d|
 z          d}||
|	z   d }S)aZ  
    Params
    ------
    fin  : binary file with `read(buf_size : int)` method
    fout  : binary file with `write` (and optionally `flush`) methods.
    callback  : function(float), e.g.: `tqdm.update`
    callback_len  : If (default: True) do `callback(len(buffer))`.
      Otherwise, do `callback(data) for data in buffer.split(delim)`.
    flushc                       y r    r!   r!   r%   r   r#   zposix_pipe.<locals>.<lambda>>   r$   r%   Nr%   r   c                       y r    r!   r!   r%   r   r#   zposix_pipe.<locals>.<lambda>U   r$   r%   r   )writereadgetattrlencountr   find)finfoutdelimbuf_sizecallbackcallback_lenfp_writetmpbuf	len_delimis              r   
posix_piper;   +   sB    zzH((8$C 4g|46SMSX  CE
I
hhx  Q5!112 YYu- $ $0GD'<02A1us
S3CJ//0,QS3r7]<Ca)mn%C ! r%   z\n {4}(\S+)\s{2,}:\s*([^,]+)z\s*(?<!\S)--?([^\s=]+)(\s+|=|$))iterableguioutfilea  
    Extra CLI Options
    -----------------
    name  : type, optional
        TODO: find out why this is needed.
    delim  : chr, optional
        Delimiting character [default: '\n']. Use '\0' for null.
        N.B.: on Windows systems, Python converts '\n' to '\r\n'.
    buf_size  : int, optional
        String buffer size in bytes [default: 256]
        used when `delim` is specified.
    bytes  : bool, optional
        If true, will count bytes, ignore `delim`, and default
        `unit_scale` to True, `unit_divisor` to 1024, and `unit` to 'B'.
    tee  : bool, optional
        If true, passes `stdin` to both `stderr` and `stdout`.
    update  : bool, optional
        If true, will treat input as newly elapsed iterations,
        i.e. numbers to pass to `update()`. Note that this is slow
        (~2e5 it/s) since every input must be decoded as a number.
    update_to  : bool, optional
        If true, will treat input as total elapsed iterations,
        i.e. numbers to assign to `self.n`. Note that this is slow
        (~2e5 it/s) since every input must be decoded as a number.
    null  : bool, optional
        If true, will discard input (no stdout).
    manpath  : str, optional
        Directory in which to install tqdm man pages.
    comppath  : str, optional
        Directory in which to place tqdm completion.
    log  : str, optional
        CRITICAL|FATAL|ERROR|WARN(ING)|[default: 'INFO']|DEBUG|NOTSET.
c           	          !" t         j                  dd 	 j                  d      }|dz      }t        j                  t        t        |      d       t        j                  t        z   }t        t        j                  |            }t        D ]  }|j!                  |        t"        j%                  t'        |j)                                      t        j+                  |      }t-        |ddd   |d	dd   |ddd         }	d
j/                  d |	D              }d}
|
dz   |j1                  d      z   dz   }t3        fddD              r<t         j4                  j7                  t8        dz          t        j:                  d       nt3        fddD              r8t         j4                  j7                  |dz          t        j:                  d       n5r3d   dd	 dk7  r(t         j<                  j7                  dd    d|
        t>        j+                  dj/                  dgz               t        t-        ddd   ddd               }t"        j%                  |       |j!                  dd       d i}	 |j)                         D ]*  \  }}|jA                  dd      }	 tC        |||         ||<   , t"        j%                  dtI        |      z          |j!                  dd      }|j!                  d d      }|j!                  d!d      }tK        |||f      dkD  rtG        d"      	 |j!                  d#d$      }|j!                  d%d&      }|j!                  d'd      }|j!                  d(d      }|j!                  d)d      }|j!                  d*d      r G d+ d,tL              }nt         j4                  }t        |d-|      }t        t         jN                  d-t         jN                        }|s|rcdd.l(m)  dd/l*m+} dd0l,m-  fd1}| |d2|j/                  |d2             | |d3|j/                  |d4             t        j:                  d       |r6|j6                  !t         d-       j6                   G  !fd5d,tL              }|ry|j]                  d6d7       |j]                  d8d       |j]                  d9d:       t"        j%                  |       t        d@i |5 "t_        ||d
|"j`                         ddd       y|d&k(  ryt"        j%                  |       |j6                  }|s|r:t        d@i |5 "|r"fd;}n"fd<}|D ]  } ||        ||        	 ddd       yt        |fi |D ]
  } ||        yt"        j%                  |       t        d@i |5 "d}|r"fd=}n|r"fd>}n"j`                  }d}t_        ||||||       ddd       y# t        $ r. D ]#  }|j	                  d      s|t        d      d } n d}Y w xY w# tD        $ r}tG        tI        |            d}~ww xY w# 1 sw Y   yxY w# 1 sw Y   yxY w# 1 sw Y   yxY w# tb        $ rP  j7                  d?|
z          t         jN                  t         j4                  j6                  c}!|D ]
  } !|         w xY w)Az
    Parameters (internal use only)
    ---------
    fp  : file-like object for tqdm
    argv  : list (default: sys.argv[1:])
    Nr   z--logz--log=INFOz/%(levelname)s:%(module)s:%(lineno)d:%(message)s)levelformat      r   c              3      K   | ]F  }|d    t         vr9 |d   dk(  rdndj                  |d    j                  dd      |d    g|dd   H yw)r   r   r   z
  --{0}  : {2}{3}z
  --{0}=<{1}>  : {2}{3}_-N)UNSUPPORTED_OPTSrC   replace).0otds     r   	<genexpr>zmain.<locals>.<genexpr>   sj      M SV;K-K5#a&F*:&,ffV^^C-s1vA8;ABA Ms   AAz!Usage:
  tqdm [--help | options]
z^
Options:
  -h, --help     Print this help and exit.
  -v, --version  Print version and exit.

c              3   &   K   | ]  }|v  
 y wr    r!   rK   vargvs     r   rM   zmain.<locals>.<genexpr>   s     
219
2   )z-vz	--versionr   c              3   &   K   | ]  }|v  
 y wr    r!   rP   s     r   rM   zmain.<locals>.<genexpr>   s     11Q$Y1rS   )z-hz--helpz--zError:Unknown argument: r   r   Tr?   rH   rG   zargs:bytesFupdate	update_toz1Can only have one of --bytes --update --update_tor3   r   r2   r   teemanpathcomppathnullc                       e Zd Zed        Zy)main.<locals>.stdoutc                      y r    r!   )rG   s    r   r*   zmain.<locals>.stdout.write   s    r%   N__name__
__module____qualname__staticmethodr*   r!   r%   r   stdoutr^      s     r%   re   buffer)	resources)path)copyfilec                    t        d      r% t        j                  d      | z        |       n-j                  d|       5 } t        |      |       ddd       t        j                  d|       y# 1 sw Y    xY w)zcopy resource `name` to `dst`filesr   Nz
written:%s)hasattrstrrk   rh   r   info)namedstsrcri   rg   s      r   cpzmain.<locals>.cp   sk    9g.S!84!?@#F"5 0 S3/0s+0 0s   A77B ztqdm.1zcompletion.shztqdm_completion.shc                   &    e Zd Ze fd       Zy)r^   c                 |    t        j                        5   |        d d d         |        y # 1 sw Y   xY w)N)r?   )r   external_write_mode)xfpr6   stdout_writes    r   r*   zmain.<locals>.stdout.write  s4    11r: $ $ O$ $s   	2;Nr`   )rw   r6   rx   s   r   re   zmain.<locals>.stdout  s    $ $r%   unitB
unit_scaleunit_divisori   c                 V    j                  t        | j                                      y r    rW   numericdecoder:   r   s    r   r4   zmain.<locals>.callback  s    HHWQXXZ%89r%   c                 p    j                  t        | j                               j                  z
         y r    rW   r   r   nr   s    r   r4   zmain.<locals>.callback"  s#    HHWQXXZ%8133%>?r%   c                 V    j                  t        | j                                      y r    r~   r   s    r   r4   zmain.<locals>.callback/  s    !45r%   c                 p    j                  t        | j                               j                  z
         y r    r   r   s    r   r4   zmain.<locals>.callback2  s#    !4qss!:;r%   z
Error:
r!   )2sysrR   index
ValueError
startswithr-   loggingbasicConfigr,   r   __doc__CLI_EXTRA_DOCdictRE_OPTSfindallrI   popr   r   sorteditemsr   zipjoinstripanyre   r*   r   exitstderrRE_SHLEXrJ   r   KeyErrorr   rm   sumobjectstdin	importlibrg   osrh   shutilri   
setdefaultr;   rW   r   )#rw   rR   log_idxlogLevelr:   d	opt_typesor   opt_types_desc
help_shortopts	tqdm_argsrQ   edelim_per_charrW   rX   r3   r2   rY   rZ   r[   re   r   rh   rr   r*   r4   r5   ri   r6   rg   rx   r   s#   ``                            @@@@@r   r	   r	      s\    |xx|%**W% !$ggx8PR 	}$AW__Q'(I  a IIfY__&'( MM!Eqt!teADqDk5A;?N
 M *M 	MA
 7J  	 ggdm		 		A 
21
22

t+,	1 01	1

T"	$q'"1+%

247)2j\JK>>#((F8d?34DDAJQTT
+,DIIdOHHUDIdSjjl 	+FQ		#s#A+#Ay|4	!	+ 			'C	N*+"w6x/MM+u5		23a7RSS 8 ==S1gv.mmE5)--	40==T2==' 
 ZZFVXv6F		8SYY7h+', "8TYYw9:#?DIIh8L$MNHHQK!<<Lr8R066H$ $ $   -  t4  6IIi "	" Ba5&"hAB Bf_IIi LLE&I& 	$!:@" $a $	$ 	$ e1y1 A!H IIi "	" Sa$6<  !xxH#'L5&%8\RS Sc   	A||H%S]^,	
 Hz  +"3q6**+~B B	$ 	$S SW  

*+!ii)9)9| 	AO	sm   W, (Y/ 0X&A5Y/ 1Y	%Y21Y#,X#X#"X#&	Y/YYY/ YY #Y,/A[)r   r   rer   astr   r   stdr   r   r   versionr   __all__	getLoggerra   r   r   r;   compiler   r   rI   r   r   r	   r!   r%   r   <module>r      s     	 
 ' 2 2  (g!36 !'*6&t "**4
52::89 6  F JJT gSr%   