
    de
                     P    d dl Z d dlmZmZ ddlmZ  G d de j                  ZdS )    N)Optionalcast   )tcp_nodelayc                       e Zd ZdZdej        ddfdZedefd            Z	ddZ
ddZdd	Zdd
Zdej        ddfdZdee         ddfdZddZdS )BaseProtocol)_loop_paused_drain_waiter_connection_lost_reading_paused	transportloopreturnNc                 L    || _         d| _        d | _        d| _        d | _        d S NF)r	   r
   r   r   r   )selfr   s     5lib/python3.11/site-packages/aiohttp/base_protocol.py__init__zBaseProtocol.__init__   s+    04
=A$6:    c                     | j         duS )z&Return True if the connection is open.N)r   r   s    r   	connectedzBaseProtocol.connected   s     ~T))r   c                 &    | j         rJ d| _         d S NT)r
   r   s    r   pause_writingzBaseProtocol.pause_writing   s    <r   c                     | j         sJ d| _         | j        }|2d | _        |                                s|                    d            d S d S d S r   )r
   r   done
set_resultr   waiters     r   resume_writingzBaseProtocol.resume_writing"   si    |#!%D;;== (!!$''''' ( (r   c                     | j         sH| j        C	 | j                                         n# t          t          t
          f$ r Y nw xY wd| _         d S d S d S r   )r   r   pause_readingAttributeErrorNotImplementedErrorRuntimeErrorr   s    r   r$   zBaseProtocol.pause_reading,   sv    # 	((B,,...."$7F   #'D   	( 	((B(B   * AAc                     | j         rH| j        C	 | j                                         n# t          t          t
          f$ r Y nw xY wd| _         d S d S d S r   )r   r   resume_readingr%   r&   r'   r   s    r   r*   zBaseProtocol.resume_reading4   sv     	)DN$>--////"$7F   #(D   	) 	)$>$>r(   r   c                 h    t          t          j        |          }t          |d           || _        d S r   )r   asyncio	Transportr   r   )r   r   trs      r   connection_madezBaseProtocol.connection_made<   s/    '#Y//Br   excc                     d | _         | j        sd S | j        }|d S d | _        |                                rd S ||                    d            d S |                    |           d S )N)r   r
   r   r   r   set_exception)r   r0   r!   s      r   connection_lostzBaseProtocol.connection_lostA   s    | 	F#>F!;;== 	F;d#####  %%%%%r   c                    K   | j         st          d          | j        sd S | j        }| | j                                        }|| _        t          j        |           d {V  d S )NzConnection lost)r   ConnectionResetErrorr
   r   r	   create_futurer,   shieldr    s     r   _drain_helperzBaseProtocol._drain_helperQ   s~      ~ 	:&'8999| 	F#>Z--//F!'DnV$$$$$$$$$$$r   )r   N)__name__
__module____qualname__	__slots__r,   AbstractEventLoopr   propertyboolr   r   r"   r$   r*   BaseTransportr/   r   BaseExceptionr3   r8    r   r   r   r      s       I;W6 ;4 ; ; ; ; *4 * * * X*   ( ( ( (( ( ( () ) ) ))> 4    
&8M#: &t & & & & 	% 	% 	% 	% 	% 	%r   r   )r,   typingr   r   tcp_helpersr   Protocolr   rB   r   r   <module>rF      sy     ! ! ! ! ! ! ! ! $ $ $ $ $ $S% S% S% S% S%7# S% S% S% S% S%r   