a
    nJh<  ã                   @   sF   d dl Z d dlmZmZ ddlmZ ddlmZ G dd„ de jƒZ	dS )é    N)ÚOptionalÚcasté   )Úset_exception)Útcp_nodelayc                   @   s    e Zd ZdZejddœdd„Zeedœdd„ƒZ	ddœd	d
„Z
ddœdd„Zddœdd„Zddœdd„Zejddœdd„Zee ddœdd„Zddœdd„ZdS )ÚBaseProtocol)Ú_loopÚ_pausedÚ_drain_waiterZ_connection_lostÚ_reading_pausedÚ	transportN)ÚloopÚreturnc                 C   s"   || _ d| _d | _d| _d | _d S ©NF)r   r	   r
   r   r   )Úselfr   © r   úG/var/www/shaz/venv/lib/python3.9/site-packages/aiohttp/base_protocol.pyÚ__init__   s
    zBaseProtocol.__init__)r   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   s:   | j s
J ‚d| _ | j}|d ur6d | _| ¡ s6| d ¡ d S r   )r	   r
   ÚdoneÚ
set_result©r   Úwaiterr   r   r   Úresume_writing#   s    
zBaseProtocol.resume_writingc              
   C   sB   | j s>| jd ur>z| j ¡  W n tttfy6   Y n0 d| _ d S r   )r   r   Úpause_readingÚAttributeErrorÚNotImplementedErrorÚRuntimeErrorr   r   r   r   r   -   s    zBaseProtocol.pause_readingc              
   C   sB   | j r>| jd ur>z| j ¡  W n tttfy6   Y n0 d| _ d S r   )r   r   Úresume_readingr   r   r    r   r   r   r   r!   5   s    zBaseProtocol.resume_reading)r   r   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)Úexcr   c                 C   s\   d | _ | jsd S | j}|d u r"d S d | _| ¡ r4d S |d u rH| d ¡ nt|tdƒ|ƒ d S ©NzConnection lost)r   r	   r
   r   r   r   ÚConnectionError)r   r&   r   r   r   r   Úconnection_lostB   s     ýzBaseProtocol.connection_lostc                 Ã   sJ   | j stdƒ‚| jsd S | j}|d u r6| j ¡ }|| _t |¡I d H  d S r'   )r   ÚConnectionResetErrorr	   r
   r   Zcreate_futurer"   Úshieldr   r   r   r   Ú_drain_helperV   s    
zBaseProtocol._drain_helper)Ú__name__Ú
__module__Ú__qualname__Ú	__slots__r"   ZAbstractEventLoopr   ÚpropertyÚboolr   r   r   r   r!   ZBaseTransportr%   r   ÚBaseExceptionr)   r,   r   r   r   r   r      s   	
r   )
r"   Útypingr   r   Zhelpersr   Ztcp_helpersr   ÚProtocolr   r   r   r   r   Ú<module>   s   