%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/dns/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/dns/__pycache__/inet.cpython-312.pyc

�

5��e����dZddlZddlmZmZmZddlZddlZejZ	ejZ
dedede
fd�Zdede
defd	�Zdedefd
�Zdedefd�Zdedefd�Z	dd
eeefdeedefd�Zd�Zdedefd�Zy)z*Generic Internet address helper functions.�N)�Any�Optional�Tuple�family�text�returnc��|tk(rtjj|�S|tk(r tj
j|d�St�)aConvert the textual form of a network address into its binary form.

    *family* is an ``int``, the address family.

    *text* is a ``str``, the textual address.

    Raises ``NotImplementedError`` if the address family specified is not
    implemented.

    Returns a ``bytes``.
    T)�AF_INET�dns�ipv4�	inet_aton�AF_INET6�ipv6�NotImplementedError)rrs  �*/usr/lib/python3/dist-packages/dns/inet.py�	inet_ptonr!sF������x�x�!�!�$�'�'�	�8�	��x�x�!�!�$��-�-�!�!��addressc��|tk(rtjj|�S|tk(rtj
j|�St�)a0Convert the binary form of a network address into its textual form.

    *family* is an ``int``, the address family.

    *address* is a ``bytes``, the network address in binary form.

    Raises ``NotImplementedError`` if the address family specified is not
    implemented.

    Returns a ``str``.
    )r
rr�	inet_ntoarrr)rrs  r�	inet_ntopr6sD������x�x�!�!�'�*�*�	�8�	��x�x�!�!�'�*�*�!�!rc���	tjj|�tS#t$r=	tj
j|d�tcYS#t$rt�wxYwwxYw)z�Determine the address family of a textual-form network address.

    *text*, a ``str``, the textual address.

    Raises ``ValueError`` if the address family cannot be determined
    from the input.

    Returns an ``int``.
    T)rrr
r
�	Exceptionrr�
ValueError�rs r�af_for_addressrKs`��������4� ������	��H�H���t�T�*��O���	���	��	�s �$'�	A-�%A�A-�A)�)A-c��	tjj|�d}|dk\xr|dkS#t$r?	tjj|d�d}|dk(cYS#t$rt
�wxYwwxYw)z�Is the textual-form network address a multicast address?

    *text*, a ``str``, the textual address.

    Raises ``ValueError`` if the address family cannot be determined
    from the input.

    Returns a ``bool``.
    r����T�)rrr
rrr)r�firsts  r�is_multicastr"as�������"�"�4�(��+����|�,����,����	��H�H�&�&�t�T�2�1�5�E��C�<����	���	��	�s �-0�	A8�'A$�!A8�$A4�4A8c���	tjj|�y#t$r4	tjj|d�Yy#t$rYYywxYwwxYw)z{Is the specified string an IPv4 or IPv6 address?

    *text*, a ``str``, the textual address.

    Returns a ``bool``.
    TF)rrr
rrrs r�
is_addressr$wsY��������4� �����	��H�H���t�T�*����	��	��	�s&�"�	A� A�	A�A�A�A�
high_tuple�afc��|\}}|�t|�}|tk(r||fS|tk(rb|jd�}|dkr||ddfS|d|}||dzd}|j	�r||dt|�fS	||dt
j|�fStd|����#t$r2tj}t
j|||��^�^}}	}|	cYSwxYw)aXGiven a "high-level" address tuple, i.e.
    an (address, port) return the appropriate "low-level" address tuple
    suitable for use in socket calls.

    If an *af* other than ``None`` is provided, it is assumed the
    address in the high-level tuple is valid and has that af.  If af
    is ``None``, then af_for_address will be called.
    N�%r�)�flags�unknown address family )rr
r�find�isdigit�int�socket�if_nametoindex�AttributeError�AI_NUMERICHOST�getaddrinfor)
r%r&r�port�i�addrpart�scope�ai_flags�_�tups
          r�low_level_address_tupler;�s���M�G�T�	�z�
�G�
$��	�W�}�����	�x���L�L�����q�5��T�1�a�(�(��2�A�;����A��� ���=�=�?��d�A�s�5�z�2�2�	��d�A�v�'<�'<�U�'C�D�D�"�$;�B�4�"@�A�A���	��,�,�H�$�0�0��$�h�O�O�Y�q�#���J�	�s�2B�8C�Cc�n�|tjk(ry|tjk(rytd|����)z:Return the 'any' address for the specified address family.z0.0.0.0z::r+)r/r
rr)r&s r�
any_for_afr=�s3��	�V�^�^���	�v���	��
� 7��t�<�
=�=rc���	tjj|�S#t$r6	tjj|�cYS#t$rt
�wxYwwxYw)aVerify that *address* is a valid text form IPv4 or IPv6 address and return its
    canonical text form.  IPv6 addresses with scopes are rejected.

    *text*, a ``str``, the address in textual form.

    Raises ``ValueError`` if the text is not valid.
    )rr�canonicalizerrrrs rr?r?�sZ����x�x�$�$�T�*�*����	��8�8�(�(��.�.���	���	���s �!�	A �A�	A �A�A )N)�__doc__r/�typingrrr�dns.ipv4r�dns.ipv6r
rr.�str�bytesrrr�boolr"r$r;r=r?�rr�<module>rHs���$1�
�'�'���
�.�.���?�?��"�c�"��"��"�*"�c�"�E�"�c�"�*�����,�s��t��,�S��T��(6:�!B��c�3�h��!B�%-�c�]�!B��!B�H>��s��s�r

Zerion Mini Shell 1.0