+
    P\i3  c                  s  a  0 t $ ^ RIHt ^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
Ht ^ RIHt ^ RIHt ^ RIHtHt ^ RIHt ^ R	IHtHtHt ^R
IHt ^RIHtHtHt ^RIHtH t H!t! ^RI"H#t# ]PH                  R-8  d   ^ RIH%t% M^ RI&H%t% ]]']]3,          t(R])R&   ]*]']+3,          t,R])R&   ]],]'3,          t-R])R&   ]*].],3,          t/R])R&   ]*].]'3,          t0R])R&   ]! R4      t1]Pd                  3RRRR/R R lllt3 ! R R]4      t4 ! R R]4      t5 ! R R ]]54      t6 ! R! R"]64      t7 ! R# R$] ]6,          ]54      t8 ! R% R&]!]/,          ]54      t9 ! R' R(]!].,          ]54      t: ! R) R*]!]0,          ]54      t; ! R+ R,]!].,          ]54      t<R# ).i    )annotationsN)abstractmethod)Callable
CollectionMapping)AsyncExitStack)IOBase)IPv4AddressIPv6Address)AddressFamily)AnyTypeVarUnion)get_async_backend)TypedAttributeProviderTypedAttributeSettyped_attribute)
ByteStreamListenerUnreliableObjectStream)	TaskGroup)	TypeAliasr   IPAddressTypeIPSockAddrTypeSockAddrTypeUDPPacketTypeUNIXDatagramPacketTypeT_Retvalrequire_connectedFrequire_boundc               s0    V ^8  d   QhRRRRRRRRR	RR
R/# )   
sock_or_fdsocket.socket | int	sock_typezsocket.SocketKindaddr_familyzsocket.AddressFamilyr   Zboolr   returnsocket.socket Zformat   "7/usr/lib/python3.14/site-packages/anyio/abc/_sockets.py__annotate__r)   $   sL     B B#B B &B
 B B B    c               s   \        V \        4      '       d    \        P                  ! V R 7      pME\        V \        P                  4      '       d   T pM"\        R\        V 4      P                   R24      h V'       d    VP                  4        V'       dm    VP                  \        P                  \        P                  39   d   VP                  4       ^,          pMVP                  4       p V'       g   \        R4      hV\        P                  8w  dA   VP                  V8w  d0   \        RVP                    RVP                  P                    24      hVP                  V8w  d0   \        R	VP                    RVP                  P                    24      h TP'                  R
4       T#   \         dZ   pTP                  \        P
                  8X  d   \        R4      ThT'       d   \        R4      ThT'       d   \        R4      Thh Rp?ii ; i  \         d   p\        R4      ThRp?ii ; i  \         d    Rp ELRi ; i  \"         d)    \        T \        4      '       d   TP%                  4        h i ; i))Zfilenoz.the file descriptor does not refer to a socketzthe socket must be connectedz+the socket must be bound to a local addressNzexpected an int or socket, got z insteadz"address family mismatch: expected z, got zsocket type mismatch: expected F)Z
isinstanceintsocketOSErrorerrnoZENOTSOCKZ
ValueErrorZ	TypeErrorZtype__qualname__getpeernamefamilyAF_INETAF_INET6getsockname	AF_UNSPECZnameZBaseExceptionZdetachZsetblocking)r   r!   r"   r   r   sockZexcZ
bound_addrs   &&&$$   r(   _validate_socketr7   $   s+    *c""	==
3D 
J	.	.-d:.>.K.K-LHU
 	
"J  " ";;6>>6??"CC!%!1!1!3A!6J!%!1!1!3J  !NOO&***t{{k/I4[5E5E4Ff;;##$& 
 99	!1)..1A		GWX  " 	UKo  
	yyENN* D # !?@cI !NOUXX
	,  J !?@cIJ  "!
"   j#&&KKMs   F, 6I ?H I AH2 I H2 /I 8B I ,H72H*H>HHH/H**H//I 2I?I II 3I9c                  s    ] tR t^it$ Rt]! 4       tR]R&   ]! 4       tR]R&   ]! 4       t	R]R&   ]! 4       t
R]R	&   ]! 4       tR]R
&   ]! 4       tR]R&   RtR# )SocketAttributea  
.. attribute:: family
    :type: socket.AddressFamily

    the address family of the underlying socket

.. attribute:: local_address
    :type: tuple[str, int] | str

    the local address the underlying socket is connected to

.. attribute:: local_port
    :type: int

    for IP based sockets, the local port the underlying socket is bound to

.. attribute:: raw_socket
    :type: socket.socket

    the underlying stdlib socket object

.. attribute:: remote_address
    :type: tuple[str, int] | str

    the remote address the underlying socket is connected to

.. attribute:: remote_port
    :type: int

    for IP based sockets, the remote port the underlying socket is connected to
r	   r1   r   local_addressr+   
local_portr$   
raw_socketremote_addressremote_portr%   N)__name__
__module__r/   __firstlineno____doc__r   r1   __annotations__r9   r:   r;   r<   r=   __static_attributes__r%   r*   r(   r8   r8   i   sX    @ ,-FM-"1"3M<3%'J' / 1J1#2#4NL4&(K(r*   r8   c                  sL    ] tR t^t]R R l4       t]]R R l4       4       tRtR# )_SocketProviderc                   V ^8  d   QhRR/# )r   r#   zMapping[Any, Callable[[], Any]]r%   r&   r'   r(   r)   _SocketProvider.__annotate__   s      "A r*   c                	s  a aaa ^RI Ho \        P                  V 3R l\        P                  VV 3R l\        P
                  V 3R l/p S! S P                  P                  4       4      oSe   V3R lV\        P                  &   S P                  P                  \        P                  \        P                  39   d<   V 3R lV\        P                  &   Se!   S^,          oV3R lV\        P                  &   V#   \         d    Ro Li ; i)	r   )convert_ipv6_sockaddrc                 s0   < S P                   P                  # N)_raw_socketr1   self   r(   <lambda>2_SocketProvider.extra_attributes.<locals>.<lambda>   s    D,<,<,C,Cr*   c                 sD   < S ! SP                   P                  4       4      # rH   rI   r4   )convertrK   s   r(   rM   rN      s    7  ,,.4r*   c                 s   < S P                   # rH   )rI   rJ   rL   r(   rM   rN      s    0@0@r*   Nc                    < S # rH   r%   )peernamerL   r(   rM   rN      s    r*   c                 sF   < S P                   P                  4       ^,          # )i   rO   rJ   rL   r(   rM   rN      s    ((446q9r*   c                 rQ   rH   r%   )r=   rL   r(   rM   rN      s    +r*   )Z_core._socketsrG   r8   r1   r9   r;   rI   r0   r-   r<   r	   r2   r3   r:   r=   )rK   Z
attributesrP   rR   r=   s   f @@@r(   extra_attributesZ _SocketProvider.extra_attributes   s    E ""$C)) , &&(@4

	/6t7G7G7S7S7U/VH
 9IJ556 ""}'<'<m>T>T&UU9 112 #&qk:M
?667!  	H	s    C< <DDc               rE   )r   r#   r$   r%   r&   r'   r(   r)   rF      s      ] r*   c                	s    R # rH   r%   rJ      &r(   rI   Z_SocketProvider._raw_socket   s     	r*   r%   N)	r>   r?   r/   r@   ZpropertyrS   r   rI   rC   r%   r*   r(   rD   rD      s0     <   r*   rD   c                  s0    ] tR t^tRt]R R l4       tRtR# )SocketStreamzi
Transports bytes over a socket.

Supports all relevant extra attributes from :class:`~SocketAttribute`.
c                    V ^8  d   QhRRRR/# )r   r   r    r#   rU   r%   r&   r'   r(   r)   ZSocketStream.__annotate__   s     B B+> B< Br*   c                   "   \        V\        P                  RR7      p\        4       P	                  V4      G Rj  xL
 #  L5i)a  
Wrap an existing socket object or file descriptor as a socket stream.

The newly created socket wrapper takes ownership of the socket being passed in.
The existing socket must already be connected.

:param sock_or_fd: a socket object or file descriptor
:return: a socket stream

Tr   N)r7   r,   SOCK_STREAMr   Zwrap_stream_socketZclsr   r6      && r(   from_socketZSocketStream.from_socket   s6       
F,>,>RVW&(;;DAAAA   9AA Ar%   Nr>   r?   r/   r@   rA   classmethodr\   rC   r%   r*   r(   rU   rU      s     B Br*   rU   c                  sX    ] tR t^t]R R l4       t]R R l4       t]R R l4       tRt	R# )	UNIXSocketStreamc               rV   )r   r   r    r#   r`   r%   r&   r'   r(   r)   UNIXSocketStream.__annotate__   s      G G+> GCS Gr*   c                   "   \        V\        P                  \        P                  RR7      p\	        4       P                  V4      G Rj  xL
 #  L5i)a"  
Wrap an existing socket object or file descriptor as a UNIX socket stream.

The newly created socket wrapper takes ownership of the socket being passed in.
The existing socket must already be connected.

:param sock_or_fd: a socket object or file descriptor
:return: a UNIX socket stream

TrX   N)r7   r,   rY   AF_UNIXr   Zwrap_unix_stream_socketrZ   r[   r(   r\   ZUNIXSocketStream.from_socket   s@       **FNNd
 '(@@FFFF   AA
AAc               $    V ^8  d   QhRRRRRR/# )r   messagebytesfdszCollection[int | IOBase]r#   Noner%   r&   r'   r(   r)   ra      s"      e 2J t r*   c                   "   R# 5i)z
Send file descriptors along with a message to the peer.

:param message: a non-empty bytestring
:param fds: a collection of files (either numeric file descriptors or open file
    or socket objects)
Nr%   )rK   rf   rh      &&&r(   send_fdsZUNIXSocketStream.send_fds           c               s$    V ^8  d   QhRRRRRR/# )r   msglenr+   maxfdsr#   ztuple[bytes, list[int]]r%   r&   r'   r(   r)   ra      s"       S =T r*   c                rj   )z
Receive file descriptors along with a message from the peer.

:param msglen: length of the message to expect from the peer
:param maxfds: maximum number of file descriptors to expect from the peer
:return: a tuple of (message, file descriptors)
Nr%   )rK   ro   rp   rk   r(   receive_fdsZUNIXSocketStream.receive_fds   rm   rn   r%   N)
r>   r?   r/   r@   r_   r\   r   rl   rq   rC   r%   r*   r(   r`   r`      s>    G G     r*   r`   c                  sV    ] tR t^tRt]R R l4       t]R R l4       tR
R R llt	R	t
R# )SocketListenerzq
Listens to incoming socket connections.

Supports all relevant extra attributes from :class:`~SocketAttribute`.
c               rV   )r   r   r    r#   rr   r%   r&   r'   r(   r)   SocketListener.__annotate__   s"     D D'D 
Dr*   c                rW   )z
Wrap an existing socket object or file descriptor as a socket listener.

The newly created listener takes ownership of the socket being passed in.

:param sock_or_fd: a socket object or file descriptor
:return: a socket listener

Tr   N)r7   r,   rY   r   Zwrap_listener_socketrZ   r[   r(   r\   ZSocketListener.from_socket   s5       
F,>,>dS&(==dCCCCr]   c               rE   )r   r#   rU   r%   r&   r'   r(   r)   rs     s     - -l -r*   c                rj   )zAccept an incoming connection.Nr%   rJ   rT   r(   acceptZSocketListener.accept  rm   rn   Nc               re   )r   handlerzCallable[[SocketStream], Any]
task_groupzTaskGroup | Noner#   ri   r%   r&   r'   r(   r)   rs     s(     7 7.7 %7 
	7r*   c                	s.  "   ^RI Hp \        4       ;_uu_4       GRj  xL
 pVf   VP                  V! 4       4      G Rj  xL
 p V P	                  4       G Rj  xL
 pVP                  W4       K,   LR L2 L  + GRj  xL 
 '       g   i     R# ; i5i)r   )create_task_groupN)Z rx   r   Zenter_async_contextru   Z
start_soon)rK   rv   rw   rx   ZstackZstreams   &&&   r(   serveZSocketListener.serve  so     
 	)!###u!#(#<#<=N=P#QQ
#{{},%%g6 $Q - $###s\   BA2BA8A4A8A6A82B4A86A88B	>B?
B	
B		Br%   rH   )r>   r?   r/   r@   rA   r_   r\   r   ru   ry   rC   r%   r*   r(   rr   rr      s;     D D  - -7 7r*   rr   c                  <    ] tR tRtRt]R R l4       tR R ltRtR# )		UDPSocketi"  zo
Represents an unconnected UDP socket.

Supports all relevant extra attributes from :class:`~SocketAttribute`.
c               rV   )r   r   r    r#   r{   r%   r&   r'   r(   r)   UDPSocket.__annotate__*  s     ? ?+> ?9 ?r*   c                rW   )a  
Wrap an existing socket object or file descriptor as a UDP socket.

The newly created socket wrapper takes ownership of the socket being passed in.
The existing socket must be bound to a local address.

:param sock_or_fd: a socket object or file descriptor
:return: a UDP socket

Trt   N)r7   r,   
SOCK_DGRAMr   Zwrap_udp_socketrZ   r[   r(   r\   ZUDPSocket.from_socket)  s5       
F,=,=TR&(88>>>>r]   c               s(    V ^8  d   QhRRRRRRRR/# )	r   datarg   hoststrportr+   r#   ri   r%   r&   r'   r(   r)   r|   8  s(     5 5 5c 5 5 5r*   c                sF   "   V P                  WV334      G Rj  xL
 #  L5i)zN
Alias for :meth:`~.UnreliableObjectSendStream.send` ((data, (host, port))).

NZsend)rK   r~   r   r   s   &&&&r(   sendtoZUDPSocket.sendto8  s#     
 YYTl34444s   !!r%   N	r>   r?   r/   r@   rA   r_   r\   r   rC   r%   r*   r(   r{   r{   "  s%     ? ?5 5r*   r{   c                  0    ] tR tRtRt]R R l4       tRtR# )ConnectedUDPSocketi@  zm
Represents an connected UDP socket.

Supports all relevant extra attributes from :class:`~SocketAttribute`.
c               rV   )r   r   r    r#   r   r%   r&   r'   r(   r)   ZConnectedUDPSocket.__annotate__H  s      I I+> ICU Ir*   c                rW   )a&  
Wrap an existing socket object or file descriptor as a connected UDP socket.

The newly created socket wrapper takes ownership of the socket being passed in.
The existing socket must already be connected.

:param sock_or_fd: a socket object or file descriptor
:return: a connected UDP socket

TrX   N)r7   r,   r}   r   Zwrap_connected_udp_socketrZ   r[   r(   r\   ZConnectedUDPSocket.from_socketG  s<       "

 '(BB4HHHHr]   r%   Nr^   r%   r*   r(   r   r   @  s     I Ir*   r   c                  rz   )	UNIXDatagramSocketi[  zy
Represents an unconnected Unix datagram socket.

Supports all relevant extra attributes from :class:`~SocketAttribute`.
c               rV   )r   r   r    r#   r   r%   r&   r'   r(   r)   UNIXDatagramSocket.__annotate__e  s"     I I'I 
Ir*   c                s   "   \        V\        P                  \        P                  4      p\	        4       P                  V4      G Rj  xL
 #  L5i)z
Wrap an existing socket object or file descriptor as a UNIX datagram
socket.

The newly created socket wrapper takes ownership of the socket being passed in.

:param sock_or_fd: a socket object or file descriptor
:return: a UNIX datagram socket

N)r7   r,   r}   rc   r   Zwrap_unix_datagram_socketrZ   r[   r(   r\   ZUNIXDatagramSocket.from_socketd  s9       
F,=,=v~~N&(BB4HHHHs   AAA	Ac               re   )r   r~   rg   pathr   r#   ri   r%   r&   r'   r(   r)   r   v  s!     - - -c -d -r*   c                sB   "   V P                  W34      G Rj  xL
 #  L5i)zCAlias for :meth:`~.UnreliableObjectSendStream.send` ((data, path)).Nr   )rK   r~   r   rk   r(   r   ZUNIXDatagramSocket.sendtov  s     YY|,,,,s   r%   Nr   r%   r*   r(   r   r   [  s'     I I"- -r*   r   c                  r   )ConnectedUNIXDatagramSocketi{  zv
Represents a connected Unix datagram socket.

Supports all relevant extra attributes from :class:`~SocketAttribute`.
c               rV   )r   r   r    r#   r   r%   r&   r'   r(   r)   Z(ConnectedUNIXDatagramSocket.__annotate__  s"     S S'S 
%Sr*   c                rb   )a:  
Wrap an existing socket object or file descriptor as a connected UNIX datagram
socket.

The newly created socket wrapper takes ownership of the socket being passed in.
The existing socket must already be connected.

:param sock_or_fd: a socket object or file descriptor
:return: a connected UNIX datagram socket

TrX   N)r7   r,   r}   rc   r   Z#wrap_connected_unix_datagram_socketrZ   r[   r(   r\   Z'ConnectedUNIXDatagramSocket.from_socket  s@        ))6>>T
 '(LLTRRRRrd   r%   Nr^   r%   r*   r(   r   r   {  s     S Sr*   r   )i   i
   )=__conditional_annotations__Z
__future__r    r.   r,   ZsysZabcr   Zcollections.abcr   r   r   Z
contextlibr   Zior   Z	ipaddressr   r   r	   Ztypingr
   r   r   Z_core._eventloopr   Z_core._typedattrr   r   r   Z_streamsr   r   r   Z_tasksr   Zversion_infor   Ztyping_extensionsr   r   rB   Ztupler+   r   r   rg   r   r   r   r5   r7   r8   rD   rU   r`   rr   r{   r   r   r   )r   s   @r(   <module>r      s   " "   
  9 9 %  .   & & 0 
 C B w + k;!>?y ?!#s(O	 + 34i 4 !67y 7$)%*$5 	 5: )/(8(8B
 $B  B BJ&)' &)R#, #LB: B.$| $N)7Xl+_ )7X5&}5 5<I/6 I6-12O-@S"8"? Sr*   