Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/future/backports/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/future/backports/__pycache__/socket.cpython-311.pyc

�

�܋f/=��,�dZddlmZddlmZddlmZddlmZddlmZddlZddlTddl	Z	ddl
Z
ddlZ	ddlZn
#e
$rdZYnwxYweed	d
��Zeedd��Zeed
d��ZddgZe�e	je����eZe
j����d��rbiZded<ded<ded<ded<ded<ded<ded<ded <d!ed"<d#ed$<d%ed&<d'ed(<d)ed*<d+ed,<d-ed.<e�d/��Gd0�d1ej��Zd=d2�Zeejd3��rd4�Zeed5��rdedfd6�Z e!eeg��Z"Gd7�d8ej#��Z$d>d:�Z%dd;lm&Z&e&dfd<�Z'dS)?aThis module provides socket operations and some related functions.
On Unix, it supports IP (Internet Protocol) and Unix domain sockets.
On other systems, it only supports IP. Functions specific for a
socket are available as methods of the socket object.

Functions:

socket() -- create a new socket object
socketpair() -- create a pair of new socket objects [*]
fromfd() -- create a socket object from an open file descriptor [*]
fromshare() -- create a socket object from data received from socket.share() [*]
gethostname() -- return the current hostname
gethostbyname() -- map a hostname to its IP number
gethostbyaddr() -- map an IP number or hostname to DNS info
getservbyname() -- map a service name and a protocol name to a port number
getprotobyname() -- map a protocol name (e.g. 'tcp') to a number
ntohs(), ntohl() -- convert 16, 32 bit int from network to host byte order
htons(), htonl() -- convert 16, 32 bit int from host to network byte order
inet_aton() -- convert IP addr string (123.45.67.89) to 32-bit packed format
inet_ntoa() -- convert 32-bit packed format IP to string (123.45.67.89)
socket.getdefaulttimeout() -- get the default timeout value
socket.setdefaulttimeout() -- set the default timeout value
create_connection() -- connects to an address, with an optional timeout and
                       optional source address.

 [*] not available on all platforms!

Special objects:

SocketType -- type object for socket objects
error -- exception raised for I/O errors
has_ipv6 -- boolean value indicating if IPv6 is supported

Integer constants:

AF_INET, AF_UNIX -- socket domains (first argument to socket() call)
SOCK_STREAM, SOCK_DGRAM, SOCK_RAW -- socket types (second argument)

Many other constants may be defined; these may be used in calls to
the setsockopt() and getsockopt() methods.
�)�unicode_literals)�print_function)�division)�absolute_import)�superN)�*�EBADF�	�EAGAIN��EWOULDBLOCK�getfqdn�create_connection�winzThe operation was interrupted.i'zA bad file handle was passed.i'zPermission denied.i'z!A fault occurred on the network??i'z#An invalid operation was attempted.i&'z The socket operation would blocki3'z,A blocking operation is already in progress.i4'zThe network address is in use.i@'zThe connection has been reset.iF'zThe network has been shut down.iJ'zThe operation timed out.iL'zConnection refused.iM'zThe name is too long.iO'zThe host is down.iP'zThe host is unreachable.iQ'�errorTabc���eZdZdZgd�Zeeddfd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
dd
�Zd�Zejfd�Zd�Z�fd�Z�xZS)�socketz:A subclass of _socket.socket adding the makefile() method.)�__weakref__�_io_refs�_closedrNc��|�#tj�||||��n#tj�|||||��d|_d|_dS)NrF)�_socketr�__init__rr)�self�family�type�proto�filenos     �h/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/future/backports/socket.pyrzsocket.__init__csV���>��N�#�#�D�&�$��>�>�>�>��N�#�#�D�&�$��v�F�F�F���
������c��|S�N��rs r�	__enter__zsocket.__enter__ks���r c�@�|js|���dSdSr")r�close)r�argss  r�__exit__zsocket.__exit__ns'���|�	��J�J�L�L�L�L�L�	�	r c	���tj�|��}|�d��r;d|jj�d|jj�t|dd��rdpd�|dd	���}|S)
z.Wrap __repr__() to reveal the real class name.z<socket object�<�.rFz
 [closed] ��N)rr�__repr__�
startswith�	__class__�
__module__�__name__�getattr)r�ss  rr/zsocket.__repr__rs����N�#�#�D�)�)���<�<�(�)�)�	'�	'� $�� 9� 9� 9� $�� 7� 7� '��i�� ?� ?� P�L� V�TV� V� !�!�"�"���'�A��r c� �td���)NzCannot serialize socket object)�	TypeErrorr$s r�__getstate__zsocket.__getstate__|s���8�9�9�9r c���t|�����}|�|j|j|j|���}|�|�����|S)zjdup() -> socket object

        Return a new socket object connected to the same system resource.
        �r)�duprr1rrr�
settimeout�
gettimeout)r�fd�socks   rr;z
socket.dupsY��
������
�
���~�~�d�k�4�9�d�j��~�L�L��������)�)�*�*�*��r c���|���\}}t|j|j|j|���}t���)|���r|�d��||fS)z�accept() -> (socket object, address info)

        Wait for an incoming connection.  Return a new socket
        representing the connection, and the address of the client.
        For IP sockets, the address info is a pair (hostaddr, port).
        r:NT)�_acceptrrrr�getdefaulttimeoutr=�setblocking)rr>�addrr?s    r�acceptz
socket.accept�sl���<�<�>�>���D��d�k�4�9�d�j��D�D�D�����&�4�?�?�+<�+<�&����T�"�"�"��T�z�r �rc�f�d|vr|d}|d=nd}d|vr|d}|d=nd}d|vr|d}|d=nd}|D]}|dvrtd����d|v}d|vp|}	|	s|sJ�d	|v}
d
}|	r|dz
}|r|dz
}t||��}|xjdz
c_|�d}|d
krtj}|d
kr|
std���|S|	r|rtj|||��}
n1|	rtj||��}
n|sJ�tj||��}
|
r|
Stj|
|||��}||_	|S)a
makefile(...) -> an I/O stream connected to the socket

        The arguments are as for io.open() after the filename,
        except the only mode characters supported are 'r', 'w' and 'b'.
        The semantics are similar too.  (XXX refactor to share code?)
        �newlineN�errors�encoding)rF�w�bz&invalid mode %r (only r, w, b allowed)rKrFrLr-����rz!unbuffered streams must be binary)
�
ValueError�SocketIOr�io�DEFAULT_BUFFER_SIZE�BufferedRWPair�BufferedReader�BufferedWriter�
TextIOWrapper�mode)rrW�	buffering�_3to2kwargsrHrIrJ�c�writing�reading�binary�rawmode�raw�buffer�texts               r�makefilezsocket.makefile�s�����#�#�{�9�/E�W�;�W`�Ka�Ka��g��{�"�"�[��-B�F��T\�H]�H]��f���$�$��Z�1H�h�k�Zd�Ne�Ne��h��	K�	K�A���'�'� �!I�J�J�J�(���+����+�,�W����!�'�!�!�!��������	��s�N�G��	��s�N�G��t�W�%�%���
�
���
�
����I��q�=�=��.�I���>�>��
F� �!D�E�E�E��J��	7�w�	7��&�s�C��;�;�F�F�
�	7��&�s�I�6�6�F�F��N�N�7��&�s�I�6�6�F��	��M�����&�'�B�B����	��r c�v�|jdkr|xjdzc_|jr|���dSdS)NrrM)rrr'r$s r�_decref_socketioszsocket._decref_socketios�sD���=�1����M�M�Q��M�M��<�	��J�J�L�L�L�L�L�	�	r c�0�|�|��dSr")r')r�_sss  r�_real_closezsocket._real_close�s���	�	�$�����r c�V�d|_|jdkr|���dSdS)NTr)rrrgr$s rr'zsocket.close�s6������=�A������������r c�R��d|_t�����S)adetach() -> file descriptor

        Close the socket object without closing the underlying file descriptor.
        The object cannot be used after this call, but the file descriptor
        can be reused for other purposes.  The file descriptor is returned.
        T)rr�detach�rr1s �rrjz
socket.detach�s �������w�w�~�~���r )rFN)r3r2�__qualname__�__doc__�	__slots__�AF_INET�SOCK_STREAMrr%r)r/r8r;rErbrdrrrgr'rj�
__classcell__�r1s@rrr]s�������D�D�6�6�6�I�%�K�q���������������:�:�:������� .�.�.�.�`���&�n�������� � � � � � � � � r rc�D�t|��}t||||��S)z� fromfd(fd, family, type[, proto]) -> socket object

    Create a socket object from a duplicate of the given file
    descriptor.  The remaining arguments are the same as for socket().
    )r;r)r>rrr�nfds     r�fromfdru�s#���b�'�'�C��&�$��s�+�+�+r �sharec�&�tddd|��S)z� fromshare(info) -> socket object

        Create a socket object from a the bytes object returned by
        socket.share(pid).
        r)r)�infos r�	fromsharery�s���a��A�t�$�$�$r �
socketpairc��|� 	t}n#t$r
t}YnwxYwtj|||��\}}t||||�����}t||||�����}||fS)aasocketpair([family[, type[, proto]]]) -> (socket object, socket object)

        Create a pair of socket objects from the sockets returned by the platform
        socketpair() function.
        The arguments are the same as for socket() except the default family is
        AF_UNIX if defined on the platform; otherwise, the default is AF_INET.
        )�AF_UNIX�	NameErrorrorrzrrj)rrr�arLs     rrzrz�s����>�
!� �����
!�
!�
!� ����
!�����!�&�$��6�6���1��6�4�����
�
�3�3���6�4�����
�
�3�3���!�t�s�� � c�x��eZdZdZd�Zd�Zd�Zd�Zd�Z�fd�Z	d�Z
ed	���Zed
���Z
d�Z�xZS)rPz�Raw I/O implementation for stream sockets.

    This class supports the makefile() method on sockets.  It provides
    the raw I/O interface on top of a socket object.
    c���|dvrtd|z���tj�|��||_d|vr|dz
}||_d|v|_d|v|_d|_dS)N)rFrK�rw�rb�wb�rwbzinvalid mode: %rrLrFrKF)	rOrQ�	RawIOBaser�_sock�_mode�_reading�_writing�_timeout_occurred)rr?rWs   rrzSocketIO.__init__s|���:�:�:��/�$�6�7�7�7�
����d�#�#�#���
��d�?�?��C�K�D���
��t���
��t���
�!&����r c�2�|���|���|jrtd���		|j�|��S#t$r	d|_�t$r }|jdtvrYd}~dS�d}~wwxYw)a3Read up to len(b) bytes into the writable buffer *b* and return
        the number of bytes read.  If the socket is non-blocking and no bytes
        are available, None is returned.

        If *b* is non-empty, a 0 return value indicates that the connection
        was shutdown at the other end.
        z!cannot read from timed out objectTrN)
�_checkClosed�_checkReadabler��IOErrorr��	recv_into�timeout�errorr(�_blocking_errnos�rrL�es   r�readintozSocketIO.readinto)s���	
�������������!�	?��=�>�>�>�	�

��z�+�+�A�.�.�.���
�
�
�)-��&���
�
�
��6�!�9� 0�0�0��4�4�4�4�4������
���s�A�B�6B�B�Bc���|���|���	|j�|��S#t$r }|jdtvrYd}~dS�d}~wwxYw)aWrite the given bytes or bytearray object *b* to the socket
        and return the number of bytes written.  This can be less than
        len(b) if not all data could be written.  If the socket is
        non-blocking and no bytes could be written None is returned.
        rN)r��_checkWritabler��sendr�r(r�r�s   r�writezSocketIO.writeBs���	
������������	��:�?�?�1�%�%�%���	�	�	��v�a�y�,�,�,��t�t�t�t�t������		���s�A�
A.�A)�(A)�)A.c�<�|jrtd���|jS)z2True if the SocketIO is open for reading.
        �I/O operation on closed socket.)�closedrOr�r$s r�readablezSocketIO.readableR�&���;�	@��>�?�?�?��}�r c�<�|jrtd���|jS)z2True if the SocketIO is open for writing.
        r�)r�rOr�r$s r�writablezSocketIO.writableYr�r c�p��|jrtd���t�����S)z2True if the SocketIO is open for seeking.
        r�)r�rOr�seekablerks �rr�zSocketIO.seekable`s5����;�	@��>�?�?�?��w�w���!�!�!r c�\�|���|j���S)z=Return the file descriptor of the underlying socket.
        )r�r�rr$s rrzSocketIO.filenogs*��	
�������z� � �"�"�"r c�<�|js|���SdS)NrN)r�rr$s r�namez
SocketIO.namems���{�	��;�;�=�=� ��2r c��|jSr")r�r$s rrWz
SocketIO.modets
���z�r c��|jrdStj�|��|j���d|_dS)z�Close the SocketIO object.  This doesn't close the underlying
        socket, except if all references to it have disappeared.
        N)r�rQr�r'r�rdr$s rr'zSocketIO.closexsH���;�	��F�
����4� � � ��
�$�$�&�&�&���
�
�
r )r3r2rlrmrr�r�r�r�r�r�propertyr�rWr'rqrrs@rrPrPs����������
'�
'�
'����2��� ������"�"�"�"�"�#�#�#�����X������X��������r rPr-c���|���}|r|dkrt��}	t|��\}}}|�d|��|D]}d|vrn�	|}n#t$rYnwxYw|S)aGet fully qualified domain name from name.

    An empty argument is interpreted as meaning the local host.

    First the hostname returned by gethostbyaddr() is checked, then
    possibly existing aliases. In case no FQDN is available, hostname
    from gethostname() is returned.
    z0.0.0.0rr,)�strip�gethostname�
gethostbyaddr�insertr�)r��hostname�aliases�ipaddrss    rrr�s����:�:�<�<�D���4�9�$�$��}�}��
�%2�4�%8�%8�"��'�7�	���q�(�#�#�#��	�	�D��d�{�{�����D����
�
�
���
�����Ks�A#�#
A0�/A0)�_GLOBAL_DEFAULT_TIMEOUTc��|\}}d}t||dt��D]�}|\}}}	}
}d}	t|||	��}|tur|�|��|r|�|��|�|��|cS#t$r"}
|
}|�|���Yd}
~
��d}
~
wwxYw|�|�td���)adConnect to *address* and return the socket object.

    Convenience function.  Connect to *address* (a 2-tuple ``(host,
    port)``) and return the socket object.  Passing the optional
    *timeout* parameter will set the timeout on the socket instance
    before attempting to connect.  If no *timeout* is supplied, the
    global default timeout setting returned by :func:`getdefaulttimeout`
    is used.  If *source_address* is set it must be a tuple of (host, port)
    for the socket to bind as a source address before making the connection.
    An host of '' or port 0 tells the OS to use the default.
    Nrz!getaddrinfo returns an empty list)	�getaddrinforprr�r<�bind�connectr�r')�addressr��source_address�host�port�err�res�af�socktyper�	canonname�sar?�_s              rrr�s���J�D�$�
�C��4��q�+�6�6����-0�*��H�e�Y����	��"�h��.�.�D��5�5�5�����(�(�(��
*��	�	�.�)�)�)��L�L������K�K�K���	�	�	��C����
�
�������������	����
���	��7�8�8�8s�AB�
B7�B2�2B7)r)r-)(rm�
__future__rrrr�future.builtinsrr�os�sysrQ�errno�ImportErrorr4r	rr
�__all__�extend�_get_exports_listr�_realsocket�platform�lowerr0r�appendru�hasattrryrprz�setr�r�rPrr�rr#r r�<module>r�sC��)�)�V(�'�'�'�'�'�%�%�%�%�%�%�������&�&�&�&�&�&�!�!�!�!�!�!�����������������������L�L�L�L�������E�E�E��������w��"�"��	����"�	%�	%���g�e�]�B�/�/���)�
*�����#�r�#�G�,�,�-�-�-����<�����"�"�5�)�)���H�6�H�U�O�5�H�U�O�*�H�U�O�9�H�U�O�;�H�U�O�8�H�U�O�D�H�U�O�6�H�U�O�6�H�U�O�7�H�U�O�0�H�U�O�+�H�U�O�-�H�U�O�)�H�U�O�0�H�U�O��N�N�:����D �D �D �D �D �W�^�D �D �D �L,�,�,�,��7�7�>�7�#�#�%�%�%�%��7�7�L�!�!���[������&�3���,�-�-��t�t�t�t�t�r�|�t�t�t�n����6+�*�*�*�*�*�(?�%)�$9�$9�$9�$9�$9�$9s�;�A�A

Hacked By AnonymousFox1.0, Coded By AnonymousFox