
    zIf*                         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j        dfdZdS )zI
Module version for monitoring CLI pipes (`... | python -m tqdm | ...`).
    N)literal_eval   )TqdmKeyErrorTqdmTypeErrortqdm)__version__mainc                 b   t                               | |f           d|v rN|                    d          D ]$}	 t          | |          c S # t          $ r Y !w xY wt	          |  d|           |dk    r+| dk    s| dk    rdS | dk    rdS t	          | dz   |z             |d	k    rut          |           d
k    r|                                 S t          j        d|           r%t          d|  d                                          S t	          |  d|           |dk    r| S |dk    r7	 t          |           S # t          $ r}t	          |  d|           |d }~ww xY w|dk    r7	 t          |           S # t          $ r}t	          |  d|           |d }~ww xY wt	          |  d|           )Nz or z : boolTrue TFalseFchrr   z^\\\w+$"strintfloat)logdebugsplitcastr   lenencoderematchevalr   
ValueErrorr   )valtyptexcs       </var/www/piapp/venv/lib/python3.11/site-packages/tqdm/cli.pyr   r      s&   IIsCj}}6"" 	 	AC||###    s,,s,,--- f}}6MMsbyy4'>>5C%K#-...
e||s88q==::<<8J$$ 	-
C


##**,,,s,,s,,---
e||

e||	;s88O 	; 	; 	;3 0 03 0 011s:	;
g~~	;:: 	; 	; 	;3 0 03 0 011s:	;
3((3((
)
))sA   A
AA*D9 9
EEE'E6 6
F FF   \n   c                     d S N )r   s    r"   <lambda>r(   7   s    d     Tc           	         |j         }|sX	 |                     |          }|s t          |dd                        dS  ||            |t          |                     Wd}t          |          }		 |                     |          }|sp|rR ||           |r" |d|                    |          z              n#|                    |          D ]}
 ||
            t          |dd                        dS 	 |                    |          }
|
dk     r||z  }nP |||d|
t          |          z            z               ||rdn||d|
         z              d}||
|	z   d         }q)	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)`.
    Tflushc                      d S r&   r'   r'   r)   r"   r(   zposix_pipe.<locals>.<lambda>I   s    t r)   Nr)   r   c                      d S r&   r'   r'   r)   r"   r(   zposix_pipe.<locals>.<lambda>`   s    4 r)   r   )writereadgetattrr   countr   find)finfoutdelimbuf_sizecallbackcallback_lenfp_writetmpbuf	len_delimis              r"   
posix_piper>   6   s    zH 
		((8$$C  4g||44666HSMMMHSXX		 CE

I&hhx    
	 $ $HQ5!1!112222 YYu-- $ $ 0GD'<<00222F		&A1uus
HS3CJJ//000H,;QQS3rr7]<<<Ca)mnn%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         	                     d          }|dz            }nE# t          $ r8 D ]0}|                    d          r|t          d          d         } n1d}Y nw xY wt          j        t          t          |          d           t          j
        t          z   }t          t                              |                    }t          D ]}|                    |           t"                              t'          |                                                     t                              |          }t-          |ddd         |d	dd         |ddd                   }	d
                    d |	D                       }d}
|
dz   |                    d          z   dz   }t3          fddD                       r<t           j                            t8          dz              t          j        d           nt3          fddD                       r7t           j                            |dz              t          j        d           nAr?d         dd	         dk    r+t           j                            dd          d|
            t>                              d                    dgz                       t          t-          ddd         ddd                             }t"                              |           |                    dd           d i}	 |                                D ]c\  }}|                     dd          }	 tC          |||                   ||<   6# tD          $ r!}tG          tI          |                    d}~ww xY wt"                              dtI          |          z              |                    dd          }|                    d d          }|                    d!d          }tK          |||f          dk    rtG          d"          	 |                    d#d$          }|                    d%d&          }|                    d'd          }|                    d(d          }|                    d)d          }|                    d*d          r G d+ d,tL                    }nt           j        }t          |d-|          }t          t           j'        d-t           j'                  }|s|rpdd.l(m)  dd/l*m+} dd0l,m-  fd1}|  |d2|                    |d2                     |  |d3|                    |d4                     t          j        d           |r4|j        !t           d-           j         G  !fd5d,tL                    }|r|.                    d6d7           |.                    d8d           |.                    d9d:           t"                              |           t          d@i |5 "t_          ||d
|"j0                   ddd           dS # 1 swxY w Y   dS |d&k    rt"                              |           |j        }|s|rQt          d@i |5 "|r"fd;}n"fd<}|D ]} ||            ||           	 ddd           n# 1 swxY w Y   dS dS t          |fi |D ]} ||           dS t"                              |           t          d@i |5 "d}|r"fd=}n|r"fd>}n	"j0        }d}t_          ||||||           ddd           dS # 1 swxY w Y   dS # tb          $ rH                      d?|
z              t           j'        t           j        j        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   | ]X}|d          t           v |d         dk    rdndj        |d                              dd          |d          g|dd         R  V  YdS )r   r   r   z
  --{0}  : {2}{3}z
  --{0}=<{1}>  : {2}{3}_-N)UNSUPPORTED_OPTSrF   replace).0otds     r"   	<genexpr>zmain.<locals>.<genexpr>   s       M M SV;K-K-K5#a&F*:*:&&,fV^^C--s1vA8;ABBA A A .L-K-K-KM Mr)   z!Usage:
  tqdm [--help | options]
z^
Options:
  -h, --help     Print this help and exit.
  -v, --version  Print version and exit.

c              3       K   | ]}|v V  	d S r&   r'   rN   vargvs     r"   rP   zmain.<locals>.<genexpr>   s'      
2
219
2
2
2
2
2
2r)   )z-vz	--versionr   c              3       K   | ]}|v V  	d S r&   r'   rS   s     r"   rP   zmain.<locals>.<genexpr>   s'      111Q$Y111111r)   )z-hz--helpz--zError:Unknown argument: r   r   TrB   rK   rJ   zargs:bytesFupdate	update_toz1Can only have one of --bytes --update --update_tor6   r$   r5   r#   teemanpathcomppathnullc                   $    e Zd Zed             ZdS )main.<locals>.stdoutc                     d S r&   r'   )rJ   s    r"   r.   zmain.<locals>.stdout.write   s    Dr)   N__name__
__module____qualname__staticmethodr.   r'   r)   r"   stdoutr`      s-            r)   rg   buffer)	resources)path)copyfilec                 L   t          d          r0 t                              d          | z            |           nG                    d|           5 } t          |          |           ddd           n# 1 swxY w Y   t                              d|           dS )zcopy resource `name` to `dst`filesr   Nz
written:%s)hasattrr   rm   rj   r   info)namedstsrcrk   ri   s      r"   cpzmain.<locals>.cp  s    9g.. 0HS!8!84!?@@#FFFF"55 0 S3///0 0 0 0 0 0 0 0 0 0 0 0 0 0 0s+++++s   A>>BBztqdm.1zcompletion.shztqdm_completion.shc                   .    e Zd Ze fd            ZdS )r`   c                     t          j                  5   |            d d d            n# 1 swxY w Y    |            d S )N)rB   )r   external_write_mode)xfpr9   stdout_writes    r"   r.   zmain.<locals>.stdout.write  s    1r::: $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ $ LOOOOOs   /33Nrb   )rx   r9   ry   s   r"   rg   zmain.<locals>.stdout  sB        $ $ $ $ $ $ $ $ $r)   unitB
unit_scaleunit_divisori   c                 p                         t          |                                                      d S r&   rY   numericdecoder=   r    s    r"   r7   zmain.<locals>.callback*  s+    HHWQXXZZ%8%899999r)   c                                          t          |                                           j        z
             d S r&   rY   r   r   nr   s    r"   r7   zmain.<locals>.callback-  s2    HHWQXXZZ%8%813%>?????r)   c                 p                         t          |                                                      d S r&   r   r   s    r"   r7   zmain.<locals>.callback:  s+    !4!455555r)   c                                          t          |                                           j        z
             d S r&   r   r   s    r"   r7   zmain.<locals>.callback=  s2    !4!4qs!:;;;;;r)   z
Error:
r'   )2sysrU   indexr   
startswithr   loggingbasicConfigr0   r   __doc__CLI_EXTRA_DOCdictRE_OPTSfindallrL   popr   r   sorteditemsr   zipjoinstripanyrg   r.   r   exitstderrRE_SHLEXrM   r   KeyErrorr   r   sumobjectstdin	importlibri   osrj   shutilrk   
setdefaultr>   rY   	Exception)#rx   rU   log_idxlogLevelr=   d	opt_typesor   opt_types_desc
help_shortopts	tqdm_argsrT   edelim_per_charrY   rZ   r6   r5   r[   r\   r]   rg   r   rj   rs   r.   r7   r8   rk   r9   ri   ry   r    s#   ``                            @@@@@r"   r	   r	      s7
    |x|%**W%% !$     	 	A||H%% S]]^^, H ggx88PR R R R 	}$AW__Q''((I   aIIfY__&&''((( MM!Eqt!teADqDk5A;??N
 M M *M M M 	M 	MA
 7J  	 ggdmm		 		A 
2
2
2
21
2
2
222 L
t+,,,	1111 0111	1	1 L
T"""	 L$q'"1"+%%
J47JJjJJKKK>>#((F8d?3344DDAJQTT
++,,DIIdOOOHHUDIdSjjll 	+ 	+FQ		#s##A+#Ay|44	! + + +"3q66***+		'C	NN*+++"w66x//MM+u55		233a77RSSS 8 ==S11gv..mmE5))--	400==T22=='' 	7        
 ZFVXv66F	8SY77 	h 	++++++'''''', , , , , , "8TYYw99:::#?DIIh8L$M$MNNNHQKKK 		$!<Lr8R006H$ $ $ $ $ $ $ $ $ $ $ $  %	S  ---  t444  666IIi   ""	"" Ba5&"hAAAB B B B B B B B B B B B B B B B B Bf__IIi   LE  &&I&& 	$! @: : : : : :@ @ @ @ @" $ $a $	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ e11y11  AE!HHHH  IIi   ""	"" Sa$ (6 6 6 6 6 6 (< < < < < <  !xH#'L5&%8\RRRS S S S S S S S S S S S S S S S S SW    

*+++!i)9| 	 	ALOOOOsy   A   ?BB/]9 5N]9 
N:N55N::B]9 =Y##Y'*Y'')[[!$[!/0],,]03]09A_)r   r   r   r   astr   r   stdr   r   r   versionr   __all__	getLoggerrc   r   r   r>   compiler   r   rL   r   r   r	   r'   r)   r"   <module>r      s$     				 



 ' ' ' ' ' ' 2 2 2 2 2 2 2 2 2 2            (g!!#* #* #*L !'**6& 6& 6& 6&t "*4
5
52:899 6  F JT gS gS gS gS gS gSr)   