B
    Jd	                 @   s   d Z ddlmZ ddlmZ ddlmZmZ ddlm	Z	 ddgiZ
d	d
dgZG dd de	Zdd Zddefdd	Zdd
 Zdd ZdS )z^
Thin wrappers around common functions.

Subpackages contain potentially unstable extensions.
    )warn   )tqdm)TqdmDeprecationWarningr   )ObjectWrapperzgithub.com/Z	casperdcl
tenumeratetziptmapc                   s2   e Zd ZdZ fddZd	ddZdd Z  ZS )
DummyTqdmFilez'Dummy file-like that will write to tqdmc                s   t t| | g | _d S )N)superr
   __init___buf)selfwrapped)	__class__ G/var/www/html/venv/lib/python3.7/site-packages/tqdm/contrib/__init__.pyr      s    zDummyTqdmFile.__init__Fc             C   sn   t |trdnd}||\}}}|r^t| }tj|| j||g || j|d |g| _n| j	| d S )N   

)endfilenolock)

isinstancebytes
rpartitiontyper   writejoinr   _wrappedappend)r   xr   nlpreseppostblankr   r   r   r      s    

zDummyTqdmFile.writec          	   C   sR   | j rNt| j d  }ytj|| j || jd W n ttfk
rL   Y nX d S )Nr   )r   r   )r   r   r   r   r   r   OSError
ValueError)r   r%   r   r   r   __del__"   s    zDummyTqdmFile.__del__)F)__name__
__module____qualname____doc__r   r   r(   __classcell__r   r   )r   r   r
      s   
r
   c             C   s   t dtdd | S )zReturns `func`z?This function has no effect, and will be removed in tqdm==5.0.0r   )
stacklevel)r   r   )funcr   r   r   builtin_iterable+   s    
r0   Nc             K   sh   yddl }W n tk
r    Y n.X t| |jrN||| fd|pD| ji|S t|| fd|i||S )z
    Equivalent of `numpy.ndenumerate` or builtin `enumerate`.

    Parameters
    ----------
    tqdm_class  : [default: tqdm.auto.tqdm].
    r   Ntotal)numpyImportErrorr   ZndarrayZndenumeratesize	enumerate)iterablestartr1   
tqdm_classtqdm_kwargsnpr   r   r   r   2   s    c             o   s>   |  }|dt}x$t|| f|f| D ]
}|V  q,W dS )zr
    Equivalent of builtin `zip`.

    Parameters
    ----------
    tqdm_class  : [default: tqdm.auto.tqdm].
    r8   N)copypop	tqdm_autozip)Ziter1Z	iter2plusr9   kwargsr8   ir   r   r   r   E   s    c             o   s"   xt ||D ]}| | V  qW dS )zr
    Equivalent of builtin `map`.

    Parameters
    ----------
    tqdm_class  : [default: tqdm.auto.tqdm].
    N)r   )function	sequencesr9   r@   r   r   r   r	   S   s    )r,   warningsr   autor   r=   Zstdr   utilsr   
__author____all__r
   r0   r   r   r	   r   r   r   r   <module>   s   

