%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/netaddr/strategy/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/netaddr/strategy/__pycache__/ipv4.cpython-312.pyc

�

ӊ�^��
���dZddlZddlZddlmZejdvr	ddl	m
ZmZnddlm
ZmZddl
mZmZmZddlmZmZmZmZmZmZmZddl m!Z!d	Z"d
Z#dZ$dZ%eZ&d
Z'dZ(dZ)de"zdz
Z*e"e#zZ+de#zdz
Z,e-e.de"dz�D�cgc]}|e*de"|z
zdz
zf��c}�Z/e-e.de"dz�D�cgc]}e*de"|z
zdz
z|f��c}�Z0e-e.de"dz�D�cgc]}|de"|z
zdz
f��c}�Z1e-e.de"dz�D�cgc]}de"|z
zdz
|f��c}�Z2d"d�Z3d"d�Z4d#d�Z5d�Z6d�Z7d�Z8d�Zd�Z9d�Z:d�Zd�Zd#d�Zd�Zd�Zd �Zd!�Z;ycc}wcc}wcc}wcc}w)$zIPv4 address logic.�N)�	inet_aton)�win32�cygwin)�	inet_pton�AF_INET)�AddrFormatError�ZEROFILL�	INET_PTON)�valid_words�
valid_bits�bits_to_int�int_to_bits�	valid_bin�
int_to_bin�
bin_to_int)�	_str_type� ��%d�.�IPv4��
��c	�.�|dk(rtd��d}|tzr:dj|jd�D�cgc]}dt	|�z��c}�}	|t
zrt
t|�|St|�	|Scc}w#t$rd}Y|SwxYw)aP
    :param addr: An IPv4 address in presentation (string) format.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Supported constants are INET_PTON and ZEROFILL. See the
        netaddr.core docs for details.

    :return: ``True`` if IPv4 address is valid, ``False`` otherwise.
    �z Empty strings are not supported!TrrF)
rr	�join�split�intr
�
_inet_ptonr�
_inet_aton�	Exception)�addr�flags�validity�is    �7/usr/lib/python3/dist-packages/netaddr/strategy/ipv4.py�	valid_strr)Qs����r�z��@�A�A��H��x���x�x��
�
�3��@�1���A���@�A����9���w��%��O�	
�t���O��A�������O��s�B�B�2B�B�Bc	�n�|tzr:dj|jd�D�cgc]}dt|�z��c}�}	|tzr'tjdtt|��dStjdt|��dScc}w#t$rt|�d���wxYw)aP
    :param addr: An IPv4 dotted decimal address in string form.

    :param flags: decides which rules are applied to the interpretation of the
        addr value. Supported constants are INET_PTON and ZEROFILL. See the
        netaddr.core docs for details.

    :return: The equivalent unsigned integer for a given IPv4 address.
    rr�>Irz$ is not a valid IPv4 address string!)r	rrr r
�_struct�unpackr!rr"r#r)r$r%r's   r(�
str_to_intr.ns���
�x���x�x��
�
�3��@�1���A���@�A��R��9���>�>�$�
�7�D�(A�B�1�E�E��>�>�$�
�4�(8�9�!�<�<��
A���R��$�P�Q�Q�R�s�B�/B�5!B�B4c�x�d|cxkr	tkrnnd|dz	|dz	dz|dz	dz|dzfzSt|�d���)z�
    :param int_val: An unsigned integer.

    :param dialect: (unused) Any value passed in is ignored.

    :return: The IPv4 presentation (string) format address equivalent to the
        unsigned integer provided.
    rz%d.%d.%d.%d���rz( is not a valid 32-bit unsigned integer!��max_int�
ValueError)�int_val�dialects  r(�
int_to_strr8�sY��	�G��w����r�M�
��]�d�"�
��\�T�!��d�N�	 ��	���R�S�S�c��t|�D�cgc]}d|z��	}}|j�|jgd��dj|�Scc}w)z�
    :param int_val: An unsigned integer.

    :return: The reverse DNS lookup for an IPv4 address in network byte
        order integer form.
    r)zin-addr�arparr)�int_to_words�reverse�extendr)r6r'�wordss   r(�int_to_arpar@�sI�� ,�G�4�5�!�T�A�X�5�E�5�	�M�M�O�	�L�L�(�)��8�8�E�?���
6s�Ac�.�tjd|�S)z�
    :param int_val: the integer to be packed.

    :return: a packed string that is equivalent to value represented by an
    unsigned integer.
    r+)r,�pack�r6s r(�
int_to_packedrD�s���<�<��g�&�&r9c�4�tjd|�dS)a
    :param packed_int: a packed string containing an unsigned integer.
        It is assumed that string is packed in network byte order.

    :return: An unsigned integer equivalent to value of network address
        represented by packed binary string.
    r+r)r,r-)�
packed_ints r(�
packed_to_intrG�s���>�>�$�
�+�A�.�.r9c�,�t|tt�S�N)�_valid_words�	word_size�	num_words�r?s r(rr�s����y�)�4�4r9c�p�d|cxkr	tksnt|�d���|dz	|dz	dz|dz	dz|dzfS)z�
    :param int_val: An unsigned integer.

    :return: An integer word (octet) sequence that is equivalent to value
        represented by an unsigned integer.
    rz< is not a valid integer value supported bythis address type!r0r1r2rr3rCs r(r<r<�sV��
��"�7�"��18�;�<�	<�
��]�
��]�d�"�
��]�d�"�
�t�^��r9c��t|�st|�d���tjdtjdg|����dS)z�
    :param words: A list or tuple containing integer octets.

    :return: An unsigned integer that is equivalent to value represented
        by word (octet) sequence.
    z/ is not a valid octet list for an IPv4 address!r+�4Br)rr5r,r-rBrMs r(�words_to_intrQ�s?���u���PU�W�X�X��>�>�$����T� :�E� :�;�A�>�>r9c�,�t|tt�SrI)�_valid_bits�width�word_sep��bitss r(rr�s���t�U�H�-�-r9c�,�t|tt�SrI)�_bits_to_intrTrUrVs r(r
r
�s����e�X�.�.r9c�L�|�
t�d}t|tt|�S)NrU)�globals�_int_to_bitsrKrL)r6rUs  r(rr�s%�����9�Z�(�����I�x�@�@r9c�"�t|t�SrI)�
_valid_binrT��bin_vals r(rr�s���g�u�%�%r9c�"�t|t�SrI)�_int_to_binrTrCs r(rr�����w��&�&r9c�"�t|t�SrI)�_bin_to_intrTr_s r(rr�rcr9c��g}td|z�}t|t�r�d|vr|�	d|vr+|jd�D�cgc]}dt	|�z��}}ndt	|�zg}dt
|�cxkrdkr2n|�tdt
|�z
�D]}|jd��n|�|s|�dt|�zScc}w#t
$r|�wxYw)	z�
    Expands a partial IPv4 address into a full 4-octet version.

    :param addr: an partial or abbreviated IPv4 address

    :return: an expanded IP address in presentation format (x.x.x.x)

    z!invalid partial IPv4 address: %r!�:rrrr�0z%s.%s.%s.%s)
r�
isinstancerrr r5�len�range�append�tuple)r$�tokens�error�or's     r(�expand_partial_addressrq�s����F��?�$�F�G�E��$�	�"��$�;��K�	��d�{�15���C��A�A�$��Q��-�A��A���T��*�+��
��F�� �q� ��K��1�s�6�{�?�+�
#���
�
�c�"�
#��K�����5��=�(�(��B���	��K�	�s�C�C�C�C�C)rrI)<�__doc__�sys�_sys�structr,�socketrr"�platform�netaddr.fbsocketrr!r�netaddr.corerr	r
�netaddr.strategyrrJrrSr
rYrr\rr^rrbrre�netaddr.compatrrTrK�word_fmtrU�family�family_name�version�	word_baser4rL�max_word�dictrk�prefix_to_netmask�netmask_to_prefix�prefix_to_hostmask�hostmask_to_prefixr)r.r8r@rDrGr<rQrq)r's0r(�<module>r�s�����*��=�=�'�'�B�A�8�=�=����%�	��
�	�����
������
�	��u�*�q�.��
�Y��	�
�	�>�A����49�!�U�Q�Y�4G�H�q�a��A�%�!�)�$�q�(�	)�*�H�J���49�!�U�Q�Y�4G�H�q�g��u�q�y�!�A�%�&��*�H�J���*/��5�1�9�*=�>�Q�a�!���	�
�Q�
� �>�@���*/��5�1�9�*=�>�Q�q�U�Q�Y��!��a� �>�@���:R�,T�&
�'�/�5�
� 	?�.�/�A�&�'�'�#)��cI��I��?��?s�E�5E#�#E(�E-

Zerion Mini Shell 1.0