HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/anyio/abc/__pycache__/_sockets.cpython-310.pyc
o

���gv�@s�ddlmZddlZddlmZddlmZmZmZddl	m
Z
ddlmZddl
mZmZddlmZdd	lmZdd
lmZmZmZddlmZmZmZd
dlmZmZmZd
dlm Z ee!eefZ"e#e!e$fZ%ee%e!fZ&e#e'e%fZ(e#e'e!fZ)ed�Z*Gdd�d�Z+Gdd�de�Z,Gdd�de�Z-Gdd�dee-�Z.Gdd�de.�Z/Gdd�dee.e-�Z0Gdd�dee(e-�Z1Gdd �d ee'e-�Z2Gd!d"�d"ee)e-�Z3Gd#d$�d$ee'e-�Z4dS)%�)�annotationsN)�abstractmethod)�Callable�
Collection�Mapping)�AsyncExitStack)�IOBase)�IPv4Address�IPv6Address)�
AddressFamily)�
TracebackType)�Any�TypeVar�Union�)�TypedAttributeProvider�TypedAttributeSet�typed_attribute�)�
ByteStream�Listener�UnreliableObjectStream)�	TaskGroup�T_Retvalc@s eZdZddd�Zddd
�ZdS)�_NullAsyncContextManager�return�Nonec���dS�N���selfrr�=/usr/local/lib/python3.10/dist-packages/anyio/abc/_sockets.py�
__aenter__s�z#_NullAsyncContextManager.__aenter__�exc_type�type[BaseException] | None�exc_val�BaseException | None�exc_tb�TracebackType | None�bool | Nonec�rrr)r!r$r&r(rrr"�	__aexit__!s�z"_NullAsyncContextManager.__aexit__N)rr)r$r%r&r'r(r)rr*)�__name__�
__module__�__qualname__r#r+rrrr"rs
rc@sbeZdZUe�Zded<e�Zded<e�Zded<e�Zded<e�Z	ded	<e�Z
ded
<dS)�SocketAttributer�family�SockAddrType�
local_address�int�
local_port�
socket.socket�
raw_socket�remote_address�remote_portN)r,r-r.rr0�__annotations__r2r4r6r7r8rrrr"r/*s
r/c@s,eZdZed	dd��Zeed
dd���ZdS)�_SocketProviderr�Mapping[Any, Callable[[], Any]]cs�ddlm�tj�fdd�tj��fdd�tj�fdd�i}z	��j����Wnty2d�Ynw�dur@�fdd�|tj	<�jjt
jt
jfvrd�fdd�|tj
<�durd�d	��fd
d�|tj<|S)Nr)�convert_ipv6_sockaddrcs�jjSr)�_raw_socketr0rr rr"�<lambda>?sz2_SocketProvider.extra_attributes.<locals>.<lambda>cs��j���Sr�r=�getsocknamer)�convertr!rr"r>@s�cs�jSr)r=rr rr"r>C�c��Srrr)�peernamerr"r>L�cs�j��dS)Nrr?rr rr"r>QsrcrCrrr)r8rr"r>UrE)�_core._socketsr<r/r0r2r6r=�getpeername�OSErrorr7r�AF_INET�AF_INET6r4r8)r!�
attributesr)rArDr8r!r"�extra_attributes:s&��
�z _SocketProvider.extra_attributesr5cCsdSrrr rrr"r=Ysz_SocketProvider._raw_socketN)rr;)rr5)r,r-r.�propertyrLrr=rrrr"r:9sr:c@�eZdZdZdS)�SocketStreamzu
    Transports bytes over a socket.

    Supports all relevant extra attributes from :class:`~SocketAttribute`.
    N�r,r-r.�__doc__rrrr"rO_�rOc@s(eZdZeddd��Zedd
d��ZdS)�UNIXSocketStream�message�bytes�fds�Collection[int | IOBase]rrc���dS)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)r!rTrVrrr"�send_fdshrBzUNIXSocketStream.send_fds�msglenr3�maxfds�tuple[bytes, list[int]]c�rX)a
        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)r!rZr[rrr"�receive_fdsrrBzUNIXSocketStream.receive_fdsN)rTrUrVrWrr)rZr3r[r3rr\)r,r-r.rrYr]rrrr"rSgs
	rSc@s,eZdZdZeddd��Z	dddd
�ZdS)�SocketListenerz}
    Listens to incoming socket connections.

    Supports all relevant extra attributes from :class:`~SocketAttribute`.
    rrOc�rX)zAccept an incoming connection.Nrr rrr"�accept�rBzSocketListener.acceptN�handler�Callable[[SocketStream], Any]�
task_group�TaskGroup | Nonerc	�sp�ddlm}t�4IdH�}|dur|�|��IdH}	|��IdH}|�||�q1IdHs1wYdS)Nr)�create_task_group)�rdr�enter_async_contextr_�
start_soon)r!r`rbrd�stack�streamrrr"�serve�s���zSocketListener.serve)rrOr)r`rarbrcrr)r,r-r.rQrr_rjrrrr"r^}s�r^c@seZdZdZd
d
d�ZdS)�	UDPSocketz{
    Represents an unconnected UDP socket.

    Supports all relevant extra attributes from :class:`~SocketAttribute`.
    �datarU�host�str�portr3rrc�s�|�|||ff�IdHS)z^
        Alias for :meth:`~.UnreliableObjectSendStream.send` ((data, (host, port))).

        N��send)r!rlrmrorrr"�sendto�s�zUDPSocket.sendtoN)rlrUrmrnror3rr�r,r-r.rQrrrrrr"rk�srkc@rN)�ConnectedUDPSocketzy
    Represents an connected UDP socket.

    Supports all relevant extra attributes from :class:`~SocketAttribute`.
    NrPrrrr"rt�rRrtc@seZdZdZddd	�Zd
S)�UNIXDatagramSocketz�
    Represents an unconnected Unix datagram socket.

    Supports all relevant extra attributes from :class:`~SocketAttribute`.
    rlrU�pathrnrrc�s�|�||f�IdHS)zCAlias for :meth:`~.UnreliableObjectSendStream.send` ((data, path)).Nrp)r!rlrvrrr"rr�s�zUNIXDatagramSocket.sendtoN)rlrUrvrnrrrsrrrr"ru�sruc@rN)�ConnectedUNIXDatagramSocketz�
    Represents a connected Unix datagram socket.

    Supports all relevant extra attributes from :class:`~SocketAttribute`.
    NrPrrrr"rw�rRrw)5�
__future__r�socket�abcr�collections.abcrrr�
contextlibr�ior�	ipaddressr	r
r�typesr�typingr
rr�_core._typedattrrrr�_streamsrrr�_tasksrrn�
IPAddressType�tupler3�IPSockAddrTyper1rU�
UDPPacketType�UNIXDatagramPacketTyperrr/r:rOrSr^rkrtrurwrrrr"�<module>s>
&
�