
    ,h                    2   d dl mZ d dlmZmZmZ d dl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mZ  ed      Z ed      Z ed	
       G d de             Z ed	
       G d de
e   ee                Z ed	
       G d de
e   ee                Zy)    )annotations)CallableMappingSequence)	dataclass)AnyGenericTypeVar   )ByteReceiveStreamByteSendStream
ByteStreamListenerObjectReceiveStreamObjectSendStreamObjectStream	TaskGroupT_ItemT_StreamF)eqc                  Z    e Zd ZU dZded<   ded<   dddZddZddZdd	Ze	dd
       Z
y)StapledByteStreamaV  
    Combines two byte streams into a single, bidirectional byte stream.

    Extra attributes will be provided from both streams, with the receive stream
    providing the values in case of a conflict.

    :param ByteSendStream send_stream: the sending byte stream
    :param ByteReceiveStream receive_stream: the receiving byte stream
    r   send_streamr   receive_streamc                T   K   | j                   j                  |       d {   S 7 wNr   receive)self	max_bytess     W/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/anyio/streams/stapled.pyr   zStapledByteStream.receive%   s#     ((00;;;;s   (&(c                V   K   | j                   j                  |       d {    y 7 wr   r   sendr   items     r!   r$   zStapledByteStream.send(         ##D)))   )')c                T   K   | j                   j                          d {    y 7 wr   r   acloser   s    r!   send_eofzStapledByteStream.send_eof+        %%'''   (&(c                   K   | j                   j                          d {    | j                  j                          d {    y 7 '7 wr   r   r+   r   r,   s    r!   r+   zStapledByteStream.aclose.   ?     %%'''!!((*** 	(*!   AA!AA
A
Ac                ^    i | j                   j                  | j                  j                  S r   r   extra_attributesr   r,   s    r!   r6   z"StapledByteStream.extra_attributes2   4    
//
!!22
 	
    N)i   )r    intreturnbytes)r&   r;   r:   Noner:   r<   r:   zMapping[Any, Callable[[], Any]]__name__
__module____qualname____doc____annotations__r   r$   r-   r+   propertyr6    r8   r!   r   r      s=      %%<*(+ 
 
r8   r   c                  X    e Zd ZU dZded<   ded<   ddZddZddZdd	Ze	dd
       Z
y)StapledObjectStreamab  
    Combines two object streams into a single, bidirectional object stream.

    Extra attributes will be provided from both streams, with the receive stream
    providing the values in case of a conflict.

    :param ObjectSendStream send_stream: the sending object stream
    :param ObjectReceiveStream receive_stream: the receiving object stream
    zObjectSendStream[T_Item]r   zObjectReceiveStream[T_Item]r   c                R   K   | j                   j                          d {   S 7 wr   r   r,   s    r!   r   zStapledObjectStream.receiveI   s!     ((002222s   '%'c                V   K   | j                   j                  |       d {    y 7 wr   r#   r%   s     r!   r$   zStapledObjectStream.sendL   r'   r(   c                T   K   | j                   j                          d {    y 7 wr   r*   r,   s    r!   r-   zStapledObjectStream.send_eofO   r.   r/   c                   K   | j                   j                          d {    | j                  j                          d {    y 7 '7 wr   r1   r,   s    r!   r+   zStapledObjectStream.acloseR   r2   r3   c                ^    i | j                   j                  | j                  j                  S r   r5   r,   s    r!   r6   z$StapledObjectStream.extra_attributesV   r7   r8   N)r:   r   )r&   r   r:   r<   r=   r>   r?   rF   r8   r!   rH   rH   :   s=     *)//3*(+ 
 
r8   rH   c                  T    e Zd ZU dZded<   d	dZ	 d
	 	 	 	 	 ddZd	dZedd       Z	y)MultiListenera  
    Combines multiple listeners into one, serving connections from all of them at once.

    Any MultiListeners in the given collection of listeners will have their listeners
    moved into this one.

    Extra attributes are provided from each listener, with each successive listener
    overriding any conflicting attributes from the previous one.

    :param listeners: listeners to serve
    :type listeners: Sequence[Listener[T_Stream]]
    zSequence[Listener[T_Stream]]	listenersc                    g }| j                   D ]N  }t        |t              r+|j                  |j                          |j                   d d = >|j	                  |       P || _         y r   )rP   
isinstancerO   extendappend)r   rP   listeners      r!   __post_init__zMultiListener.__post_init__o   s]    .0	 	+H(M2  !3!34&&q)  *	+ #r8   Nc                   K   ddl m}  |       4 d {   }| j                  D ]  }|j                  |j                  ||       ! d d d       d {    y 7 C7 # 1 d {  7  sw Y   y xY ww)Nr   )create_task_group) rX   rP   
start_soonserve)r   handler
task_grouprX   tgrU   s         r!   r[   zMultiListener.servez   st      	)$& 	C 	C" NN ChnngzBC	C 	C 	C 	C 	C 	C 	CsD   A1AA1/AA1AA1A1A."A%#A.*A1c                b   K   | j                   D ]  }|j                          d {     y 7 wr   )rP   r+   )r   rU   s     r!   r+   zMultiListener.aclose   s,      	$H//###	$#s   #/-/c                b    i }| j                   D ]  }|j                  |j                          |S r   )rP   updater6   )r   
attributesrU   s      r!   r6   zMultiListener.extra_attributes   s6    
 	9Hh778	9 r8   r=   r   )r\   zCallable[[T_Stream], Any]r]   zTaskGroup | Noner:   r<   r>   )
r@   rA   rB   rC   rD   rV   r[   r+   rE   r6   rF   r8   r!   rO   rO   ^   sU     ,+	# RVC0C>NC	C$  r8   rO   N)
__future__r   collections.abcr   r   r   dataclassesr   typingr   r	   r
   abcr   r   r   r   r   r   r   r   r   r   r   rH   rO   rF   r8   r!   <module>rh      s    " 7 7 ! ( (	 	 	 
	: e 

  
  
F e 
'&/<+?  
  
F e.GH%x'9 . .r8   