o
    RÊÆhµ
  ã                   @   s:   d dl Z d dlmZmZ ddlmZ G dd„ de jƒZdS )é    N)ÚOptionalÚcasté   )Útcp_nodelayc                   @   s’   e Zd ZdZdejddfdd„Zedefdd„ƒZ	dd	d
„Z
ddd„Zddd„Zddd„Zdejddfdd„Zdee ddfdd„Zddd„ZdS )ÚBaseProtocol)Ú_loopÚ_pausedÚ_drain_waiterÚ_connection_lostÚ_reading_pausedÚ	transportÚloopÚreturnNc                 C   s"   || _ d| _d | _d| _d | _d S ©NF)r   r   r	   r   r   )Úselfr   © r   úb/var/www/html/HyperOracle/crypto_trader/venv/lib/python3.10/site-packages/aiohttp/base_protocol.pyÚ__init__   s
   
zBaseProtocol.__init__c                 C   s
   | j duS )z&Return True if the connection is open.N)r   ©r   r   r   r   Ú	connected   s   
zBaseProtocol.connectedc                 C   s   | j rJ ‚d| _ d S ©NT)r   r   r   r   r   Úpause_writing   s   

zBaseProtocol.pause_writingc                 C   sB   | j sJ ‚d| _ | j}|d urd | _| ¡ s| d ¡ d S d S d S r   )r   r	   ÚdoneÚ
set_result©r   Úwaiterr   r   r   Úresume_writing"   s   
ýzBaseProtocol.resume_writingc              
   C   sJ   | j s!| jd ur#z| j ¡  W n tttfy   Y nw d| _ d S d S d S r   )r   r   Úpause_readingÚAttributeErrorÚNotImplementedErrorÚRuntimeErrorr   r   r   r   r   ,   ó   ÿ
ûzBaseProtocol.pause_readingc              
   C   sJ   | j r!| jd ur#z| j ¡  W n tttfy   Y nw d| _ d S d S d S r   )r   r   Úresume_readingr   r   r    r   r   r   r   r"   4   r!   zBaseProtocol.resume_readingr   c                 C   s    t tj|ƒ}t|dƒ || _d S r   )r   ÚasyncioÚ	Transportr   r   )r   r   Útrr   r   r   Úconnection_made<   s   

zBaseProtocol.connection_madeÚexcc                 C   sX   d | _ | jsd S | j}|d u rd S d | _| ¡ rd S |d u r%| d ¡ d S | |¡ d S )N)r   r   r	   r   r   Úset_exception)r   r'   r   r   r   r   Úconnection_lostA   s   zBaseProtocol.connection_lostc                 Ã   sL   �| j stdƒ‚| jsd S | j}|d u r| j ¡ }|| _t |¡I d H  d S )NzConnection lost)r   ÚConnectionResetErrorr   r	   r   Úcreate_futurer#   Úshieldr   r   r   r   Ú_drain_helperQ   s   €
zBaseProtocol._drain_helper)r   N)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r#   ÚAbstractEventLoopr   ÚpropertyÚboolr   r   r   r   r"   ÚBaseTransportr&   r   ÚBaseExceptionr)   r-   r   r   r   r   r      s    	




r   )r#   Útypingr   r   Útcp_helpersr   ÚProtocolr   r   r   r   r   Ú<module>   s    