HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/.local/lib/python3.10/site-packages/tqdm/__pycache__/cli.cpython-310.pyc
o

���g+�@s�dZddlZddlZddlZddlmZddlmZddl	m
Z
mZmZddl
mZdgZe�e�Zd	d
�Zddd
d�dfdd�Ze�d�Ze�d�ZdZdZejdfdd�ZdS)zI
Module version for monitoring CLI pipes (`... | python -m tqdm | ...`).
�N)�literal_eval)�indent�)�TqdmKeyError�
TqdmTypeError�tqdm)�__version__�mainc
Cs~t�||f�d|vr-|�d�D]}zt||�WSty#Yqwt|�d|����|dkrI|dks9|dkr;dS|dkrAdSt|d|��|d	krpt|�d
krW|��St�d|�rgt	d|�d����St|�d|����|d
krv|S|dkr�zt
|�WSty�}z
t|�d|���|�d}~ww|dkr�zt|�WSty�}z
t|�d|���|�d}~wwt|�d|����)Nz or z : �bool�True�T�FalseF�chrrz^\\\w+$�"�str�int�float)
�log�debug�split�castr�len�encode�re�match�evalr�
ValueErrorr)�val�typ�t�exc�r!�;/home/arjun/.local/lib/python3.10/site-packages/tqdm/cli.pyrsL�
��
��r�\n�cC�dS�Nr!)rr!r!r"�<lambda>8�r'TcCs"|j}|s#	|�|�}|st|ddd���dS||�|t|��qd}t|�}		|�|�}|sZ|rO||�|rC|d|�|��n|�|�D]}
||
�qHt|ddd���dS	|�|�}
|
d	kri||7}n'|||d|
t|���||r|dn||d|
��d}||
|	d�}q[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�flushcSr%r&r!r!r!r!r"r'Jr(zposix_pipe.<locals>.<lambda>N�rcSr%r&r!r!r!r!r"r'ar(r)�write�read�getattrr�countr�find)�fin�fout�delim�buf_size�callback�callback_len�fp_write�tmp�buf�	len_delim�ir!r!r"�
posix_pipe7sD
�


��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.
cs&�durtjdd��z��d�}Wnty1�D]}|�d�r,|td�d�}nqd}Ynw�|d}tjtt|�dd�tj	dkrJt
jntt
jd	�t
}tt�|��}tD]}|�|�q[t�t|����t�|�}t|ddd
�|ddd
�|d
dd
��}	d�d
d�|	D��}d}
|
d|�d�d}t�fdd�dD��r�tj�td�t�d�n3t�fdd�dD��r�tj�|d�t�d�n�r�ddd�dkr�tj �d�d�d|
���t!�d�dg����tt�ddd
��d
dd
���}t�|�|�dd�d�i}zY|��D])\}}
|�"dd�}zt#|
||�||<W�qt$�yB}zt%t&|���d}~wwt�d t&|��|�d!d"�}|�d#d"�}|�d$d"�}t'|||f�dk�rlt%d%��Wn"t(�y���d&|
�tj)tjj}�|D]}�|��q��w|�d'd(�}|�d)d*�}|�d+d"�}|�d,d�}|�d-d�}|�d.d"��r�Gd/d0�d0t*�}n	tj}t|d1|�}ttj)d1tj)�}|�s�|�rzddl+�Wnt,�y�dd2l-m.�Ynwdd3l/m0}�fd4d5�}|du�r|d6||�d6�|du�r|d7||�d8�t�d�|�r2|j�t�d1��j�G���fd9d0�d0t*�}|�rp|�1d:d;�|�1d<d�|�1d=d>�t�|�t
dDi|����t2||d|�j3�Wd�dS1�siwYdS|d*k�r�t�|�|j}|�s�|�r�t
dDi|���&�|�r��fd?d@�}n�fdAd@�}|D]}||�||��q�Wd�n1�s�wYdSdSt
|fi|��D]}||��q�dSt�|�t
dDi|���-�d"}|�r�fdBd@�}n|�r�fdCd@�}n�j3}d}t2||||||�Wd�dS1�swYdS)Ez�
    Parameters (internal use only)
    ---------
    fp  : file-like object for tqdm
    argv  : list (default: sys.argv[1:])
    Nrz--logz--log=�INFOz/%(levelname)s:%(module)s:%(lineno)d:%(message)s)�level�format)��
z    rC�rcssX�|]'}|dtvr|ddkrdndj|d�dd�|dg|dd��R�VqdS)rrr
z
  --{0}  : {2}{3}z
  --{0}=<{1}>  : {2}{3}�_�-N)�UNSUPPORTED_OPTSrB�replace)�.0�otdr!r!r"�	<genexpr>�s���
��zmain.<locals>.<genexpr>z!Usage:
  tqdm [--help | options]
z^
Options:
  -h, --help     Print this help and exit.
  -v, --version  Print version and exit.
�
c3��|]}|�vVqdSr&r!�rJ�v��argvr!r"rL���)z-vz	--versionrc3rNr&r!rOrQr!r"rL�rS)z-hz--helpz--zError:Unknown argument:� rrTr?rGrFzargs:�bytesF�update�	update_toz1Can only have one of --bytes --update --update_toz
Error:
r3r$r2r#�tee�manpath�comppath�nullc@seZdZedd��ZdS)�main.<locals>.stdoutcSr%r&r!)rFr!r!r"r+�s�main.<locals>.stdout.writeN��__name__�
__module__�__qualname__�staticmethodr+r!r!r!r"�stdout�src�buffer��	resources)�Pathcs,��d�|}|�|���t�d|�dS)zcopy resource `name` to `dst`rz
written:%sN)�files�write_bytes�
read_bytesr�info)�name�dst�firer!r"�cpszmain.<locals>.cpztqdm.1z
completion.shztqdm_completion.shcs eZdZe���fdd��ZdS)r\cs@tj�d���|�Wd�n1swY�|�dS)N)r?)r�external_write_mode)�x��fpr6�stdout_writer!r"r+s
�r]Nr^r!rrr!r"rcs�unit�B�
unit_scale�unit_divisoric���t|����dSr&�rV�numeric�decode�r:�rr!r"r4,�zmain.<locals>.callbackc���t|����j�dSr&�rVr{r|�nr}r~r!r"r4/�cryr&rzr}r~r!r"r4<rcr�r&r�r}r~r!r"r4?r�r!)4�sysrR�indexr�
startswithr�logging�basicConfigr-�version_infor�__doc__r�
CLI_EXTRA_DOC�dict�RE_OPTS�findallrH�poprr�sorted�itemsr�zip�join�strip�anyrcr+r�exit�stderr�RE_SHLEXrIr�KeyErrorrr�sum�	Exception�stdin�object�importlib_resources�ImportError�	importlibrf�pathlibrg�
setdefaultr;rV)rsrR�log_idxr:�logLevel�d�	opt_types�or�opt_types_desc�
help_short�opts�	tqdm_argsrP�e�delim_per_charrVrWr�r3r2rXrYrZrcrgror+r4r5r!)rRrsr6rfrtrr"r	�s

���
��
*
���"
�����



$�

�&��
$�)r�r�rr��astrr{�textwrapr�stdrrr�versionr�__all__�	getLoggerr_rrr;�compiler�r�rHr�r�r	r!r!r!r"�<module>s&
&
�
:
#