U
    ;g(                     @   s  d dl Z d dlmZmZ d dlmZmZmZmZm	Z	 d dl
mZ d dl
mZ d dl
mZ d dl
mZ d dl
mZ d	d
lmZ d	dlmZmZmZ d	dlmZ ddlmZmZ d dl Z ddddgZ!e j"dkrd-ddZn
d.ddZd/ddZd0ddZd1ddZe j"dkrd2ddZ#n
d3ddZ#d4dd Z$d5d!d"Z%G d#d$ d$eZ&eddd%d&d'Z'e'(e	ddd%d(d)Z)e'(eddd%d*d)Z)e'(ee'(eddd%d+d)Z)e'(eddd%d,d)Z)dS )6    N)partialsingledispatch)BufferedRandomBufferedReaderBufferedWriterFileIO
TextIOBase)NamedTemporaryFile)SpooledTemporaryFile)TemporaryDirectory)TemporaryFile)_TemporaryFileWrapper   )AiofilesContextManager)AsyncBufferedIOBaseAsyncBufferedReaderAsyncFileIOAsyncTextIOWrapper   )AsyncSpooledTemporaryFileAsyncTemporaryDirectoryr	   r   r
   r   )      w+bTc                 C   s$   t td| |||||||||	|
dS )!Async open a named temporary fileT)namedmode	bufferingencodingnewlinesuffixprefixdirdeletedelete_on_closeloopexecutorr   _temporary_file)r   r   r    r!   r"   r#   r$   r%   r&   r'   r(    r+   Z/opt/bot/vods_filmes/script/venv/lib/python3.8/site-packages/aiofiles/tempfile/__init__.pyr	      s     c
           
      C   s"   t td| |||||||||	dS )r   T)r   r   r   r    r!   r"   r#   r$   r%   r'   r(   r)   )
r   r   r    r!   r"   r#   r$   r%   r'   r(   r+   r+   r,   r	   ?   s    c	           	      C   s    t td| ||||||||d
S )z$Async open an unnamed temporary fileF)
r   r   r   r    r!   r"   r#   r$   r'   r(   r)   )	r   r   r    r!   r"   r#   r$   r'   r(   r+   r+   r,   r   ]   s    c
           
      C   s    t t| |||||||||	d
S )z#Async open a spooled temporary file
max_sizer   r   r    r!   r"   r#   r$   r'   r(   )r   _spooled_temporary_filer-   r+   r+   r,   r
   y   s    c                 C   s   t t| ||||dS )z Async open a temporary directoryr"   r#   r$   r'   r(   )AiofilesContextManagerTempDir_temporary_directoryr0   r+   r+   r,   r      s        c                    s   |
dkrt  }
| r2tt|||||||||	d
}ntt|||||||d}|
||I dH }t|tkrt|j	||
|d}|j
|_
|S t|||
|dS dS ):Async method to open a temporary file with async interfaceN)	r   r   r    r!   r"   r#   r$   r%   r&   r   r   r    r!   r"   r#   r$   r'   r(   )asyncioget_running_loopr   syncNamedTemporaryFilesyncTemporaryFilerun_in_executortypesyncTemporaryFileWrapperwrapfile_closer)r   r   r   r    r!   r"   r#   r$   r%   r&   r'   r(   r.   cbfresultr+   r+   r,   r*      s>    r*   c                    s   |	dkrt  }	| r0tt||||||||d	}ntt|||||||d}|	|
|I dH }t|tkrt|j	||	|
d}|j
|_
|S t|||	|
dS dS )r3   N)r   r   r    r!   r"   r#   r$   r%   r4   r5   )r6   r7   r   r8   r9   r:   r;   r<   r=   r>   r%   )r   r   r   r    r!   r"   r#   r$   r%   r'   r(   r.   r@   rA   rB   r+   r+   r,   r*      s<    c
                    sJ   |dkrt  }tt| |||||||d	}
||	|
I dH }t|||	dS )z2Open a spooled temporary file with async interfaceN)r.   r   r   r    r!   r"   r#   r$   r5   )r6   r7   r   syncSpooledTemporaryFiler:   r   )r.   r   r   r    r!   r"   r#   r$   r'   r(   r@   rA   r+   r+   r,   r/     s    r/   c                    s>   |dkrt  }tt| ||}|||I dH }t|||dS )z?Async method to open a temporary directory with async interfaceNr5   )r6   r7   r   syncTemporaryDirectoryr:   r   )r"   r#   r$   r'   r(   r@   rA   r+   r+   r,   r2   8  s
    r2   c                   @   s   e Zd ZdZdd ZdS )r1   zGWith returns the directory location, not the object (matching sync lib)c                    s   | j I d H | _| jjS )N)Z_coro_objname)selfr+   r+   r,   
__aenter__H  s    z(AiofilesContextManagerTempDir.__aenter__N)__name__
__module____qualname____doc__rH   r+   r+   r+   r,   r1   E  s   r1   r5   c                C   s   t d| dS )z=Wrap the object with interface based on type of underlying IOzUnsupported IO type: {}N)	TypeErrorformatZbase_io_objr>   r'   r(   r+   r+   r,   r=   M  s    r=   c                C   s   t |||dS Nr5   r   rO   r+   r+   r,   _S  s    rQ   c                C   s   t |||dS rP   )r   rO   r+   r+   r,   rQ   X  s    c                C   s   t |||dS rP   )r   rO   r+   r+   r,   rQ   ]  s    c                C   s   t |||dS rP   )r   rO   r+   r+   r,   rQ   c  s    )r   r   NNNNNTTNN)
r   r   NNNNNTNN)	r   r   NNNNNNN)
r   r   r   NNNNNNN)NNNNN)Tr   r   NNNNNTTNNr   )Tr   r   NNNNNTNNr   )
r   r   r   NNNNNNN)NNNNN)*r6   	functoolsr   r   ior   r   r   r   r   tempfiler	   r8   r
   rC   r   rD   r   r9   r   r<   baser   Zthreadpool.binaryr   r   r   Zthreadpool.textr   Z	temptypesr   r   sys__all__version_infor*   r/   r2   r1   r=   registerrQ   r+   r+   r+   r,   <module>   s   
           "          
         
          

             ;            
9          
#         
