
     f                     2   d dl mZmZmZmZmZ ddlmZmZm	Z	 ddl
mZmZmZmZmZmZmZ ddlmZmZmZmZmZ ddlmZ 	 d dl mZ n# e$ r	 d dlmZ Y nw xY wded	ee         fd
Zdeded	ee         fdZdee         d	ee         fdZ  G d d          Z!dS )    )castListTypeUnion
ValuesView   )
Connection	NEED_DATAPAUSED)ConnectionClosedDataEndOfMessageEventInformationalResponseRequestResponse)CLIENTCLOSEDDONE
MUST_CLOSESERVER)Sentinel)Literalconnreturnc                     g }	 |                                  }|t          t          fv rnBt          t          |          }|                    |           t          |          t          u rng|S N)
next_eventr
   r   r   r   appendtyper   )r   
got_eventsevents      T/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/h11/tests/helpers.pyget_all_eventsr$      ss    J!!Y'''UE""%   ;;***     datac                 J    |                      |           t          |           S r   )receive_datar$   )r   r&   s     r#   receive_and_getr)   #   s$    d$r%   	in_eventsc                    g }| D ]}t          |          t          u r$t          t          |j                  dd          }|rpt          |d                   t          |          cxu r	t          u rBn n?t          |d         j        |j        z   |d         j        |d         j                  |d<   |                    |           |S )NF)r&   chunk_start	chunk_end)r    r   bytesr&   r,   r-   r   )r*   
out_eventsr"   s      r#   normalize_data_eventsr1   *   s     J 
% 
%;;$eEJ//UeTTTE 	%$z"~..$u++EEEEEEEEE!^(5:5&rN6$R.2  JrNN e$$$$r%   c                       e Zd Zd
dZedee         fd            Z	 ddee	         de
ee         ef         de
ee         eed         f         defd	ZdS )ConnectionPairr   Nc                     t           t          t                     t          t          t                    i| _        t           t          t          t           i| _        d S r   )r   r	   r   r   otherselfs    r#   __init__zConnectionPair.__init__?   s6    Z//F9K9KL	fff5


r%   c                 4    | j                                         S r   )r   valuesr6   s    r#   connszConnectionPair.connsC   s    y!!!r%   matchrolesend_eventsexpectc                    t          |t                    s|g}d}d}|D ],}| j        |                             |          }|d}'||z  }-|r+| j        | j        |                                      |           |r+| j        | j        |                                      d           t          | j        | j        |                            }|dk    r|}t          |t                    s|g}||k    sJ |S )Nr%   FTr<   )
isinstancelistr   sendr5   r(   r$   )	r7   r=   r>   r?   r&   closed
send_eventnew_datar!   s	            r#   rC   zConnectionPair.sendH   s    +t,, 	(&-K% 	! 	!Jy++J77H   	;Idj&'44T::: 	:Idj&'44S999#DIdj.>$?@@
W F&$'' 	XFV####r%   )r   N)r<   )__name__
__module____qualname__r8   propertyr   r	   r;   r   r   r   r   r   r   r/   rC    r%   r#   r3   r3   >   s        6 6 6 6 "z*- " " " X" ?F	 8n 4;-. d5k5''*::;	
 
     r%   r3   N)"typingr   r   r   r   r   _connectionr	   r
   r   _eventsr   r   r   r   r   r   r   _stater   r   r   r   r   _utilr   r   ImportErrortyping_extensionsr$   r/   r)   r1   r3   rK   r%   r#   <module>rS      s   6 6 6 6 6 6 6 6 6 6 6 6 6 6 7 7 7 7 7 7 7 7 7 7                  > = = = = = = = = = = = = =      * * * *))))))))*
 
U 
 
 
 
 *  E  d5k        T%[ T%[    (' ' ' ' ' ' ' ' ' 's    A AA