o
    -˜Žjß'  ã                   @   s`  d dl Z 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  g d¢Z!ej"dkrt											d.dd„Zn										d/dd„Z									d0dd„Z	 									d1dd„Zd2dd„Zej"dkr½													 d3dd„Z#n												 d4dd„Z#	 									d1d d!„Z$	d2d"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 )5é    N)ÚpartialÚsingledispatch)ÚBufferedRandomÚBufferedReaderÚBufferedWriterÚFileIOÚ
TextIOBase)ÚNamedTemporaryFile)ÚSpooledTemporaryFile)ÚTemporaryDirectory)ÚTemporaryFile)Ú_TemporaryFileWrapperé   )ÚAiofilesContextManager)ÚAsyncBufferedIOBaseÚAsyncBufferedReaderÚAsyncFileIO©ÚAsyncTextIOWrapperé   )ÚAsyncSpooledTemporaryFileÚAsyncTemporaryDirectory)r	   r   r
   r   )é   é   úw+béÿÿÿÿTc                 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+   úW/var/www/kodo/Anonymous/send/lib/python3.10/site-packages/aiofiles/tempfile/__init__.pyr	      s    ôÿr	   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   öÿr   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   öÿr
   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
   
ÿÿr   c                 Ã   s˜   �|
du r	t  ¡ }
| rtt|||||||||	d�
}ntt|||||||d�}|
 ||¡I dH }t|ƒtu rDt|j	||
|d�}|j
|_
|S t|||
|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u r	t  ¡ }	| rtt||||||||d�	}ntt|||||||d�}|	 |
|¡I dH }t|ƒtu rCt|j	||	|
d�}|j
|_
|S t|||	|
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
                 Ã   sL   �|du 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u 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   6  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)Ú_coroÚ_objÚname)Úselfr+   r+   r,   Ú
__aenter__F  s   €z(AiofilesContextManagerTempDir.__aenter__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__rI   r+   r+   r+   r,   r1   C  s    r1   r5   c                C   s   d| › �}t |ƒ‚)z=Wrap the object with interface based on type of underlying IOzUnsupported IO type: )Ú	TypeError)Úbase_io_objr>   r'   r(   Úmsgr+   r+   r,   r=   K  s   
r=   c                C   ó   t |||d�S ©Nr5   r   ©rO   r>   r'   r(   r+   r+   r,   Ú_S  ó   rT   c                C   rQ   rR   )r   rS   r+   r+   r,   rT   X  rU   c                C   rQ   rR   )r   rS   r+   r+   r,   rT   ]  s   c                C   rQ   rR   )r   rS   r+   r+   r,   rT   c  rU   )r   r   NNNNNTTNN)
r   r   NNNNNTNN)	r   r   NNNNNNN)
r   r   r   NNNNNNN)NNNNN)Tr   r   NNNNNTTNNr   )Tr   r   NNNNNTNNr   )*r6   ÚsysÚ	functoolsr   r   Úior   r   r   r   r   Útempfiler	   r8   r
   rC   r   rD   r   r9   r   r<   Úbaser   Úthreadpool.binaryr   r   r   Úthreadpool.textr   Ú	temptypesr   r   Ú__all__Úversion_infor*   r/   r2   r1   r=   ÚregisterrT   r+   r+   r+   r,   Ú<module>   sâ    
õ"
ö
÷
ö

ó:
ô8
ö#
ÿ