o
    MEg                     @   sN   d Z ddlmZ ddlmZ G dd dZG dd deZG dd	 d	eZd
S )zVarious base classes.    )	coroutine)	Coroutinec                   @   s$   e Zd Zdd Zdd Zdd ZdS )	AsyncBasec                 C   s   || _ || _|| _d S N)_file_loop	_executor)selffileloopexecutor r   g/var/www/eduai.edurigo.com/doc_train/edurigo_ai/Puru/venv/lib/python3.10/site-packages/aiofiles/base.py__init__   s   
zAsyncBase.__init__c                 C   s   | S )zWe are our own iterator.r   r	   r   r   r   	__aiter__   s   zAsyncBase.__aiter__c                    s   |   I dH }|r|S t)zSimulate normal file iteration.N)readlineStopAsyncIteration)r	   liner   r   r   	__anext__   s
   zAsyncBase.__anext__N)__name__
__module____qualname__r   r   r   r   r   r   r   r      s    r   c                   @   s   e Zd ZdZdd Zdd ZdddZd	d
 Zedd Z	edd Z
edd Zdd Zedd Zdd Zdd Zdd Zdd ZdS )_ContextManager_coro_objc                 C   s   || _ d | _d S r   r   )r	   coror   r   r   r      s   
z_ContextManager.__init__c                 C   s   | j |S r   )r   send)r	   valuer   r   r   r       s   z_ContextManager.sendNc                 C   s:   |d u r
| j |S |d u r| j ||S | j |||S r   )r   throw)r	   typvaltbr   r   r   r    #   s
   z_ContextManager.throwc                 C   s
   | j  S r   )r   closer   r   r   r   r$   +      
z_ContextManager.closec                 C      | j jS r   )r   gi_framer   r   r   r   r'   .      z_ContextManager.gi_framec                 C   r&   r   )r   
gi_runningr   r   r   r   r)   2   r(   z_ContextManager.gi_runningc                 C   r&   r   )r   gi_coder   r   r   r   r*   6   r(   z_ContextManager.gi_codec                 C   s
   |  d S r   )r   r   r   r   r   __next__:   r%   z_ContextManager.__next__c                 c       | j E d H }|S r   r   r	   respr   r   r   __iter__=   s   z_ContextManager.__iter__c                 c   r,   r   r-   r.   r   r   r   	__await__B      z_ContextManager.__await__c                    s   | j I d H }|S r   r-   r.   r   r   r   r   F   r2   z_ContextManager.__anext__c                    s   | j I d H | _| jS r   r   r   r   r   r   
__aenter__J   s   z_ContextManager.__aenter__c                    s   | j   d | _ d S r   r   r$   )r	   exc_typeexcr#   r   r   r   	__aexit__N   s   

z_ContextManager.__aexit__)NN)r   r   r   	__slots__r   r   r    r$   propertyr'   r)   r*   r+   r   r0   r1   r   r3   r7   r   r   r   r   r      s&    




r   c                   @   s   e Zd ZdZdd ZdS )AiofilesContextManagerz/An adjusted async context manager for aiofiles.c                    s   | j  I d H  d | _ d S r   r4   )r	   r5   exc_valexc_tbr   r   r   r7   V   s   
z AiofilesContextManager.__aexit__N)r   r   r   __doc__r7   r   r   r   r   r:   S   s    r:   N)r=   typesr   collections.abcr   r   r   r:   r   r   r   r   <module>   s    :