o
    [h                     @   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_loopZ	_executor)selffileloopexecutor r   t/home/ubuntu/experiments/live_experiments/Pythonexperiments/Otree/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   r1   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   r/   r0   r   r2   r6   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   r3   )r   r4   exc_valexc_tbr   r   r   r6   V   s   
z AiofilesContextManager.__aexit__N)r   r   r   __doc__r6   r   r   r   r   r9   S   s    r9   N)r<   typesr   collections.abcr   r   r   r9   r   r   r   r   <module>   s    :