Your IP : 3.144.109.147


Current Path : /opt/alt/python311/lib64/python3.11/__pycache__/
Upload File :
Current File : //opt/alt/python311/lib64/python3.11/__pycache__/ipaddress.cpython-311.pyc

�

c��f2���dZdZddlZdZdZGd�de��ZGd�d	e��Zd
�Zd3d�Z	d
�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd�Zd�ZGd�d��ZdaejGd�de����ZejGd�de����ZGd�d��Zee_Gd�d ��ZGd!�d"ee��ZGd#�d$e��ZGd%�d&ee��ZGd'�d(��Zee_ee_Gd)�d*��Z Gd+�d,e e��Z!Gd-�d.e!��Z"Gd/�d0e e��Z#Gd1�d2��Z$e$e!_e$e#_dS)4z�A fast, lightweight IPv4/IPv6 manipulation library in Python.

This library is used to create/poke/manipulate IPv4 and IPv6 addresses
and networks.

z1.0�N� �c��eZdZdZdS)�AddressValueErrorz%A Value Error related to the address.N��__name__�
__module__�__qualname__�__doc__���0/opt/alt/python311/lib64/python3.11/ipaddress.pyrr�������/�/�/�/r
rc��eZdZdZdS)�NetmaskValueErrorz%A Value Error related to the netmask.Nrrr
rrrrr
rc���	t|��S#ttf$rYnwxYw	t|��S#ttf$rYnwxYwt	|�d����)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Address or IPv6Address object.

    Raises:
        ValueError: if the *address* passed isn't either a v4 or a v6
          address

    z. does not appear to be an IPv4 or IPv6 address)�IPv4Addressrr�IPv6Address�
ValueError��addresss r�
ip_addressrs��� 
��7�#�#�#���0�1�
�
�
���
����
��7�#�#�#���0�1�
�
�
���
������Q�Q�Q�
R�
R�R���%�%�8�A�ATc���	t||��S#ttf$rYnwxYw	t||��S#ttf$rYnwxYwt	|�d����)a�Take an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP network.  Either IPv4 or
          IPv6 networks may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Network or IPv6Network object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address. Or if the network has host bits set.

    z. does not appear to be an IPv4 or IPv6 network)�IPv4Networkrr�IPv6Networkr)r�stricts  r�
ip_networkr9s��� 
��7�F�+�+�+���0�1�
�
�
���
����
��7�F�+�+�+���0�1�
�
�
���
������Q�Q�Q�
R�
R�Rs��&�&�:�A�
Ac���	t|��S#ttf$rYnwxYw	t|��S#ttf$rYnwxYwt	|�d����)agTake an IP string/int and return an object of the correct type.

    Args:
        address: A string or integer, the IP address.  Either IPv4 or
          IPv6 addresses may be supplied; integers less than 2**32 will
          be considered to be IPv4 by default.

    Returns:
        An IPv4Interface or IPv6Interface object.

    Raises:
        ValueError: if the string passed isn't either a v4 or a v6
          address.

    Notes:
        The IPv?Interface classes describe an Address on a particular
        Network, so they're basically a combination of both the Address
        and Network classes.

    z0 does not appear to be an IPv4 or IPv6 interface)�
IPv4Interfacerr�
IPv6Interfacerrs r�ip_interfacer"Vs���*
��W�%�%�%���0�1�
�
�
���
����
��W�%�%�%���0�1�
�
�
���
������S�S�S�
T�
T�Trc�h�	|�d��S#t$rtd���wxYw)a`Represent an address as 4 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv4 IP address.

    Returns:
        The integer address packed as 4 bytes in network (big-endian) order.

    Raises:
        ValueError: If the integer is negative or too large to be an
          IPv4 IP address.

    �z&Address negative or too large for IPv4��to_bytes�
OverflowErrorrrs r�v4_int_to_packedr(xsJ��C�����"�"�"���C�C�C��A�B�B�B�C������1c�h�	|�d��S#t$rtd���wxYw)z�Represent an address as 16 packed bytes in network (big-endian) order.

    Args:
        address: An integer representation of an IPv6 IP address.

    Returns:
        The integer address packed as 16 bytes in network (big-endian) order.

    �z&Address negative or too large for IPv6r%rs r�v6_int_to_packedr,�sJ��C�����#�#�#���C�C�C��A�B�B�B�C���r)c��t|���d��}t|��dkrtd|�����|S)zAHelper to split the netmask and raise AddressValueError if needed�/�zOnly one '/' permitted in )�str�split�lenr)r�addrs  r�_split_optional_netmaskr4�sF���w�<�<���c�"�"�D�
�4�y�y�1�}�}�� H�W� H� H�I�I�I��Kr
c#�K�t|��}t|��x}}|D]}|j|jdzkr||fV�|}|}� ||fV�dS)z�Find a sequence of sorted deduplicated IPv#Address.

    Args:
        addresses: a list of IPv#Address objects.

    Yields:
        A tuple containing the first and last IP addresses in the sequence.

    �N)�iter�next�_ip)�	addresses�it�first�last�ips     r�_find_address_ranger?�sw����
�i���B���8�8��E�D�����
�6�T�X��\�!�!���+�����E����
��+�����r
c�d�|dkr|St|||dz
z�����S)z�Count the number of zero bits on the right hand side.

    Args:
        number: an integer.
        bits: maximum number of bits to count.

    Returns:
        The number of zero bits on the right hand side of the number.

    rr6)�min�
bit_length)�number�bitss  r�_count_righthand_zero_bitsrE�s9����{�{����t�v�g����*�6�6�8�8�9�9�9r
c#�jK�t|t��rt|t��std���|j|jkrt|�d|�d����||krt	d���|jdkrt
}n"|jdkrt}nt	d���|j}|j}|j}||krmtt||��||z
dz���dz
��}||||z
f��}|V�|d|zz
}|dz
|jkrd	S||k�kd	Sd	S)
a�Summarize a network range given the first and last IP addresses.

    Example:
        >>> list(summarize_address_range(IPv4Address('192.0.2.0'),
        ...                              IPv4Address('192.0.2.130')))
        ...                                #doctest: +NORMALIZE_WHITESPACE
        [IPv4Network('192.0.2.0/25'), IPv4Network('192.0.2.128/31'),
         IPv4Network('192.0.2.130/32')]

    Args:
        first: the first IPv4Address or IPv6Address in the range.
        last: the last IPv4Address or IPv6Address in the range.

    Returns:
        An iterator of the summarized IPv(4|6) network objects.

    Raise:
        TypeError:
            If the first and last objects are not IP addresses.
            If the first and last objects are not the same version.
        ValueError:
            If the last object is not greater than the first.
            If the version of the first address is not 4 or 6.

    z1first and last must be IP addresses, not networks� and � are not of the same versionz*last IP address must be greater than firstr$�zunknown IP versionr6N)
�
isinstance�_BaseAddress�	TypeError�versionrrr�_max_prefixlenr9rArErB�	_ALL_ONES)r<r=r>�ip_bits�	first_int�last_int�nbits�nets        r�summarize_address_rangerU�sz����4��|�
,�
,�M�
��l�
+�
+�M��K�L�L�L��}���$�$��������&�'�'�	'��t�|�|��E�F�F�F��}����
���	��!�	�	�
����-�.�.�.��"�G��	�I��x�H�
�x�
�
��.�y�'�B�B��	�)�A�-�9�9�;�;�a�?�A�A���b�)�W�u�_�-�.�.���	�	�	��Q�%�Z��	��q�=�B�L�(�(��E��x�
�
�
�
�
�
r
c#�xK�t|��}i}|re|���}|���}|�|��}|�|||<n||kr||=|�|��|�ed}t|�����D]}|�|j|jkr�|V�|}�dS)auLoops through the addresses, collapsing concurrent netblocks.

    Example:

        ip1 = IPv4Network('192.0.2.0/26')
        ip2 = IPv4Network('192.0.2.64/26')
        ip3 = IPv4Network('192.0.2.128/26')
        ip4 = IPv4Network('192.0.2.192/26')

        _collapse_addresses_internal([ip1, ip2, ip3, ip4]) ->
          [IPv4Network('192.0.2.0/24')]

        This shouldn't be called directly; it is called via
          collapse_addresses([]).

    Args:
        addresses: A list of IPv4Network's or IPv6Network's

    Returns:
        A list of IPv4Network's or IPv6Network's depending on what we were
        passed.

    N)�list�pop�supernet�get�append�sorted�values�broadcast_address)r:�to_merge�subnetsrTrY�existingr=s       r�_collapse_addresses_internalrb�s�����2�I���H��G�
�	&��l�l�n�n���<�<�>�>���;�;�x�(�(���� #�G�H���
��_�_���!��O�O�H�%�%�%��	&��D��g�n�n�&�&�'�'�������%��)>�>�>���	�	�	�����r
c�J�g}g}g}|D�]2}t|t��rI|r1|dj|jkrt|�d|d�d����|�|���a|j|jkry|r1|dj|jkrt|�d|d�d����	|�|j����#t$r|�|j	��Y��wxYw|r1|dj|jkrt|�d|d�d����|�|����4tt|����}|r8t|��D](\}}|�
t||�����)t||z��S)a�Collapse a list of IP objects.

    Example:
        collapse_addresses([IPv4Network('192.0.2.0/25'),
                            IPv4Network('192.0.2.128/25')]) ->
                           [IPv4Network('192.0.2.0/24')]

    Args:
        addresses: An iterator of IPv4Network or IPv6Network objects.

    Returns:
        An iterator of the collapsed IPv(4|6)Network objects.

    Raises:
        TypeError: If passed a list of mixed version objects.

    ���rGrH)rJrK�_versionrLr[�
_prefixlenrNr>�AttributeError�network_addressr\�setr?�extendrUrb)r:�addrs�ips�netsr>r<r=s       r�collapse_addressesrn0s���$
�E�
�C�
�D������b�,�'�'�	��
/�s�2�w�'�2�;�6�6��!#���S��W�W�W�!.�/�/�/��J�J�r�N�N�N�N�
�]�b�/�
/�
/��
/�s�2�w�'�2�;�6�6��!#���S��W�W�W�!.�/�/�/�
/��
�
�2�5�!�!�!�!��!�
/�
/�
/��
�
�2�-�.�.�.�.�.�
/�����
0��R��)�R�[�8�8��!#���T�"�X�X�X�!/�0�0�0��K�K��O�O�O�O���S���
�
�C��?�.�s�3�3�	?�	?�K�E�4��L�L�0���=�=�>�>�>�>�'����5�5�5s�.C	�	$C0�/C0c��t|t��r|���St|t��r|���St
S)a2Return a key suitable for sorting between networks and addresses.

    Address and Network objects are not sortable by default; they're
    fundamentally different so the expression

        IPv4Address('192.0.2.0') <= IPv4Network('192.0.2.0/24')

    doesn't make any sense.  There are some times however, where you may wish
    to have ipaddress sort these for you anyway. If you need to do this, you
    can use this function as the key= argument to sorted().

    Args:
      obj: either a Network or Address object.
    Returns:
      appropriate key.

    )rJ�_BaseNetwork�_get_networks_keyrK�_get_address_key�NotImplemented)�objs r�get_mixed_type_keyrufsR��$�#�|�$�$�&��$�$�&�&�&�	�C��	&�	&�&��#�#�%�%�%��r
c��eZdZdZdZed���Zed���Zed���Zed���Z	d�Z
d�Zed	���Z
ed
���Zed���Zed���Zed
���Zed���Zd�ZdS)�_IPAddressBasezThe mother class.rc�*�|���S)z:Return the longhand version of the IP address as a string.)�_explode_shorthand_ip_string��selfs r�explodedz_IPAddressBase.exploded�s���0�0�2�2�2r
c� �t|��S)z;Return the shorthand version of the IP address as a string.�r0rzs r�
compressedz_IPAddressBase.compressed�s���4�y�y�r
c�*�|���S)aIThe name of the reverse DNS pointer for the IP address, e.g.:
            >>> ipaddress.ip_address("127.0.0.1").reverse_pointer
            '1.0.0.127.in-addr.arpa'
            >>> ipaddress.ip_address("2001:db8::1").reverse_pointer
            '1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa'

        )�_reverse_pointerrzs r�reverse_pointerz_IPAddressBase.reverse_pointer�s���$�$�&�&�&r
c�F�dt|��fz}t|���)Nz%200s has no version specified��type�NotImplementedError�r{�msgs  rrMz_IPAddressBase.version�s"��.�$�t�*�*��>��!�#�&�&�&r
c��|dkrd}t|||jfz���||jkr!d}t|||j|jfz���dS)Nrz-%d (< 0) is not permitted as an IPv%d addressz2%d (>= 2**%d) is not permitted as an IPv%d address)rrerOrN)r{rr�s   r�_check_int_addressz!_IPAddressBase._check_int_address�sn���Q�;�;�A�C�#�C�7�D�M�*B�$B�C�C�C��T�^�#�#�F�C�#�C�7�D�4G�+/�=�+:�%:�;�;�
;�$�#r
c�j�t|��}||krd}t|||||jfz���dS)Nz6%r (len %d != %d) is not permitted as an IPv%d address)r2rre)r{r�expected_len�address_lenr�s     r�_check_packed_addressz$_IPAddressBase._check_packed_address�sS���'�l�l���,�&�&�J�C�#�C�7�K�+7���+H�%H�I�I�
I�'�&r
c�&�|j|j|z	zS)z�Turn the prefix length into a bitwise netmask

        Args:
            prefixlen: An integer, the prefix length.

        Returns:
            An integer.

        )rO)�cls�	prefixlens  r�_ip_int_from_prefixz"_IPAddressBase._ip_int_from_prefix�s���}��
�� :�;�;r
c���t||j��}|j|z
}||z	}d|zdz
}||kr4|jdz}|�|d��}d}t||z���|S)aReturn prefix length from the bitwise netmask.

        Args:
            ip_int: An integer, the netmask in expanded bitwise format

        Returns:
            An integer, the prefix length.

        Raises:
            ValueError: If the input intermingles zeroes & ones
        r6��bigz&Netmask pattern %r mixes zeroes & ones)rErNr&r)	r��ip_int�trailing_zeroesr��leading_ones�all_ones�byteslen�detailsr�s	         r�_prefix_from_ip_intz"_IPAddressBase._prefix_from_ip_int�s���5�V�58�5G�I�I���&��8�	���0����N�a�'���8�#�#��)�Q�.�H��o�o�h��6�6�G�:�C��S�7�]�+�+�+��r
c�,�d|z}t|��d�)Nz%r is not a valid netmask)r)r��netmask_strr�s   r�_report_invalid_netmaskz&_IPAddressBase._report_invalid_netmask�s��)�K�7����$�$�$�.r
c�>�|���r|���s|�|��	t|��}n%#t$r|�|��YnwxYwd|cxkr|jksn|�|��|S)a	Return prefix length from a numeric string

        Args:
            prefixlen_str: The string to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask
        r)�isascii�isdigitr��intrrN)r��
prefixlen_strr�s   r�_prefix_from_prefix_stringz)_IPAddressBase._prefix_from_prefix_string�s����%�%�'�'�	7�M�,A�,A�,C�,C�	7��'�'�
�6�6�6�	7��M�*�*�I�I���	7�	7�	7��'�'�
�6�6�6�6�6�	7�����Y�4�4�4�4�#�"4�4�4�4�4��'�'�
�6�6�6��s�A�A1�0A1c�R�	|�|��}n%#t$r|�|��YnwxYw	|�|��S#t$rYnwxYw||jz}	|�|��S#t$r|�|��YdSwxYw)aTurn a netmask/hostmask string into a prefix length

        Args:
            ip_str: The netmask/hostmask to be converted

        Returns:
            An integer, the prefix length.

        Raises:
            NetmaskValueError: If the input is not a valid netmask/hostmask
        N)�_ip_int_from_stringrr�r�rrO)r��ip_strr�s   r�_prefix_from_ip_stringz%_IPAddressBase._prefix_from_ip_string�s���	0��,�,�V�4�4�F�F�� �	0�	0�	0��'�'��/�/�/�/�/�	0����	��*�*�6�2�2�2���	�	�	��D�	����	�#�-���	0��*�*�6�2�2�2���	0�	0�	0��'�'��/�/�/�/�/�/�	0���s/��:�:�A�
A �A �.B�B&�%B&c���t|ttf��r	||jfSt|t��st|��}t
|��dkr|S|d|jfS)z�Helper function to parse address of Network/Interface.

        Arg:
            address: Argument of Network/Interface.

        Returns:
            (addr, prefix) tuple.
        r6r)rJ�bytesr�rN�tupler4r2)r�rs  r�_split_addr_prefixz!_IPAddressBase._split_addr_prefixss���g��s�|�,�,�	/��C�.�.�.��'�5�)�)�	7�.�g�6�6�G��w�<�<�!����N��q�z�3�-�-�-r
c�0�|jt|��ffS�N��	__class__r0rzs r�
__reduce__z_IPAddressBase.__reduce__-s���~��D�	�	�|�+�+r
N)rr	r
r�	__slots__�propertyr|rr�rMr�r��classmethodr�r�r�r�r�r�r�rr
rrwrws\���������I�
�3�3��X�3�����X���'�'��X�'��'�'��X�'�;�;�;�I�I�I��
<�
<��[�
<�����[��0�/�/��[�/�����[��0�0�0��[�0�B�.�.��[�.�.,�,�,�,�,r
rwc�b��eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Z�fd
�Z�xZS)rKz�A generic IP object.

    This IP class contains the version independent methods which are
    used by single IP addresses.
    rc��|jSr��r9rzs r�__int__z_BaseAddress.__int__>s	���x�r
c�r�	|j|jko|j|jkS#t$r
tcYSwxYwr�)r9rergrs�r{�others  r�__eq__z_BaseAddress.__eq__AsP��	"��H��	�)�8��
���7�
9���	"�	"�	"�!�!�!�!�	"���s�"�6�6c���t|t��stS|j|jkrt	|�d|�d����|j|jkr|j|jkSdS�NrGrHF)rJrKrsrerLr9r�s  r�__lt__z_BaseAddress.__lt__Hsp���%��.�.�	"�!�!��=�E�N�*�*��!�T�T�5�5�5�*�+�+�
+��8�u�y� � ��8�e�i�'�'��ur
c��t|t��stS|�t|��|z��Sr��rJr�rsr�r�s  r�__add__z_BaseAddress.__add__T�7���%��%�%�	"�!�!��~�~�c�$�i�i�%�/�0�0�0r
c��t|t��stS|�t|��|z
��Sr�r�r�s  r�__sub__z_BaseAddress.__sub__Yr�r
c�@�|jj�dt|���d�S�N�(�)�r�rr0rzs r�__repr__z_BaseAddress.__repr__^�"���>�2�2�2�C��I�I�I�I�>�>r
c�P�t|�|j����Sr�)r0�_string_from_ip_intr9rzs r�__str__z_BaseAddress.__str__as ���4�+�+�D�H�5�5�6�6�6r
c�^�ttt|j������Sr�)�hash�hexr�r9rzs r�__hash__z_BaseAddress.__hash__ds ���C��D�H�
�
�&�&�'�'�'r
c��|j|fSr��rerzs rrrz_BaseAddress._get_address_keygs���
�t�$�$r
c� �|j|jffSr�)r�r9rzs rr�z_BaseAddress.__reduce__js���~���{�*�*r
c���|r|ddkrtt|��|��St�ddl}|�d��at�|��}|s!t
���|��S|���\}}}|dkr|j	dkrd}nd	}|dkr|j
}n
|j
dz}|r||dzd
z
z
}|r|dz
}tt|��|�d|�|�|����S)
a�Returns an IP address as a formatted string.

        Supported presentation types are:
        's': returns the IP address as a string (default)
        'b': converts to binary and returns a zero-padded string
        'X' or 'x': converts to upper- or lower-case hex and returns a zero-padded string
        'n': the same as 'b' for IPv4 and 'x' for IPv6

        For binary and hex presentation types, the alternate form specifier
        '#' and the grouping option '_' are supported.
        rd�sNrz(#?)(_?)([xbnX])�nr$�b�xr6r/�0)�formatr0�_address_fmt_re�re�compile�	fullmatch�super�
__format__�groupsrerNr�)	r{�fmtr��m�	alternate�grouping�fmt_base�padlenr�s	        �rr�z_BaseAddress.__format__ms6����	*�c�"�g��n�n��#�d�)�)�S�)�)�)��"��I�I�I� �j�j�);�<�<�O��%�%�c�*�*���	+��7�7�%�%�c�*�*�*�()���
�
�%�	�8�X��s�?�?��}��!�!�������s�?�?��(�F�F��(�A�-�F��	&��f��k�A�o�%�F��	��a�K�F��c�$�i�i�I�!L�!L��!L��!L�(�!L�!L�M�M�Mr
)rr	r
rr�r�r�r�r�r�r�r�r�rrr�r��
__classcell__�r�s@rrKrK3s�����������I����"�"�"����1�1�1�
1�1�1�
?�?�?�7�7�7�(�(�(�%�%�%�+�+�+�/N�/N�/N�/N�/N�/N�/N�/N�/Nr
rKc���eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
ejd���Zejd
���Zed���Zed���Zed���Zed���Zed���Zed���Zd�Zd�Zd�Zd%d�Zd%d�Zed���Zed���Z d�Z!d�Z"ed���Z#ed ���Z$ed!���Z%ed"���Z&ed#���Z'ed$���Z(dS)&rpz}A generic IP network object.

    This IP class contains the version independent methods which are
    used by networks.
    c�@�|jj�dt|���d�Sr�r�rzs rr�z_BaseNetwork.__repr__�r�r
c�$�d|j|jfzS�N�%s/%d)rhr�rzs rr�z_BaseNetwork.__str__�s���$�.���?�?�?r
c#�K�t|j��}t|j��}t|dz|��D]}|�|��V��dS)z�Generate Iterator over usable hosts in a network.

        This is like __iter__ except it doesn't return the network
        or broadcast addresses.

        r6N�r�rhr^�range�_address_class�r{�network�	broadcastr�s    r�hostsz_BaseNetwork.hosts�sl�����d�*�+�+����.�/�/�	��w��{�I�.�.�	)�	)�A��%�%�a�(�(�(�(�(�(�	)�	)r
c#�K�t|j��}t|j��}t||dz��D]}|�|��V��dS�Nr6r�r�s    r�__iter__z_BaseNetwork.__iter__�sj�����d�*�+�+����.�/�/�	��w�	�A�
�.�.�	)�	)�A��%�%�a�(�(�(�(�(�(�	)�	)r
c�(�t|j��}t|j��}|dkr0||z|krtd���|�||z��S|dz
}||z|krtd���|�||z��S)Nrzaddress out of ranger6)r�rhr^�
IndexErrorr�)r{r�r�r�s    r�__getitem__z_BaseNetwork.__getitem__�s����d�*�+�+����.�/�/�	���6�6���{�Y�&�&� �!7�8�8�8��&�&�w��{�3�3�3�
��F�A��1�}�w�&�&� �!7�8�8�8��&�&�y�1�}�5�5�5r
c��t|t��stS|j|jkrt	|�d|�d����|j|jkr|j|jkS|j|jkr|j|jkSdSr�)rJrprsrerLrh�netmaskr�s  rr�z_BaseNetwork.__lt__�s����%��.�.�	"�!�!��=�E�N�*�*��!�T�T�5�5�5�*�+�+�
+���5�#8�8�8��'�%�*?�?�?��<�5�=�(�(��<�%�-�/�/��ur
c���	|j|jko9|j|jko)t|j��t|j��kS#t$r
t
cYSwxYwr�)rerhr�rrgrsr�s  rr�z_BaseNetwork.__eq__�su��	"��M�U�^�3�<��(�E�,A�A�<����%�%��U�]�);�);�;�
=���	"�	"�	"�!�!�!�!�	"���s�A	A�A �A c�n�tt|j��t|j��z��Sr�)r�r�rhrrzs rr�z_BaseNetwork.__hash__�s*���C��,�-�-��D�L�0A�0A�A�B�B�Br
c��|j|jkrdSt|t��rdS|j|jjz|jjkS�NF)rerJrpr9rrhr�s  r�__contains__z_BaseNetwork.__contains__�sM���=�E�N�*�*��5��e�\�*�*�	L��5��9�t�|�/�/�4�3G�3K�K�Kr
c�J�|j|vp|j|vp|j|vp|j|vS)z*Tell if self is partly contained in other.�rhr^r�s  r�overlapsz_BaseNetwork.overlaps�sB���#�u�,�7��"�e�+�
6��%��-�5��+�t�3�	7r
c�z�|�t|j��t|j��z��Sr�)r�r�rh�hostmaskrzs rr^z_BaseNetwork.broadcast_address�s9���"�"�3�t�';�#<�#<�#&�t�}�#5�#5�$6�7�7�	7r
c�`�|�t|j��|jz��Sr�)r�r�rrOrzs rrz_BaseNetwork.hostmask�s'���"�"�3�t�|�#4�#4�t�~�#E�F�F�Fr
c�$�d|j|jfzSr�)rhrfrzs r�with_prefixlenz_BaseNetwork.with_prefixlen�s���$�.���@�@�@r
c�$�|j�d|j��S�Nr.)rhrrzs r�with_netmaskz_BaseNetwork.with_netmasks���.�.�.����=�=r
c�$�|j�d|j��Sr)rhrrzs r�
with_hostmaskz_BaseNetwork.with_hostmasks���.�.�.��
�
�>�>r
c�Z�t|j��t|j��z
dzS)z&Number of hosts in the current subnet.r6)r�r^rhrzs r�
num_addressesz_BaseNetwork.num_addressess*���4�)�*�*�S��1E�-F�-F�F��J�Jr
c�F�dt|��fz}t|���)Nz%%200s has no associated address classr�r�s  rr�z_BaseNetwork._address_classs$��
6��d���
�E��!�#�&�&�&r
c��|jSr�)rfrzs rr�z_BaseNetwork.prefixlens
����r
c#�K�|j|jkst|�d|�d����t|t��std|z���|�|��st|�d|�����||krdS|�|j�d|j����}|�	��\}}||kr�||kr�|�|��r|V�|�	��\}}nI|�|��r|V�|�	��\}}ntd|�d|�d	|�����||kr||k��||kr|V�dS||kr|V�dStd|�d|�d	|�����)
a�Remove an address from a larger block.

        For example:

            addr1 = ip_network('192.0.2.0/28')
            addr2 = ip_network('192.0.2.1/32')
            list(addr1.address_exclude(addr2)) =
                [IPv4Network('192.0.2.0/32'), IPv4Network('192.0.2.2/31'),
                 IPv4Network('192.0.2.4/30'), IPv4Network('192.0.2.8/29')]

        or IPv6:

            addr1 = ip_network('2001:db8::1/32')
            addr2 = ip_network('2001:db8::1/128')
            list(addr1.address_exclude(addr2)) =
                [ip_network('2001:db8::1/128'),
                 ip_network('2001:db8::2/127'),
                 ip_network('2001:db8::4/126'),
                 ip_network('2001:db8::8/125'),
                 ...
                 ip_network('2001:db8:8000::/33')]

        Args:
            other: An IPv4Network or IPv6Network object of the same type.

        Returns:
            An iterator of the IPv(4|6)Network objects which is self
            minus other.

        Raises:
            TypeError: If self and other are of differing address
              versions, or if other is not a network object.
            ValueError: If other is not completely contained by self.

        rGrHz%s is not a network objectz not contained in Nr.z Error performing exclusion: s1: z s2: z other: )rerLrJrp�	subnet_ofrr�rhr�r`�AssertionError)r{r��s1�s2s    r�address_excludez_BaseNetwork.address_excludes�����H�}���.�.��!�T�T�5�5�5�*�+�+�
+��%��.�.�	B��8�5�@�A�A�A����t�$�$�	G�������E�F�F�F��D�=�=��F����5�+@�+@�+@�+0�?�?�!<�=�=���������B��E�k�k�b�E�k�k����r�"�"�

6������������B�B�����$�$�
6������������B�B�%�n�&(�b�b�"�"�"�e�e�&5�6�6�6��E�k�k�b�E�k�k���;�;��H�H�H�H�H�
�5�[�[��H�H�H�H�H�!�.�"$�"�"�b�b�b�%�%�"1�2�2�
2r
c���|j|jkrt|�d|�d����|j|jkrdS|j|jkrdS|j|jkrdS|j|jkrdSdS)a�Compare two IP objects.

        This is only concerned about the comparison of the integer
        representation of the network addresses.  This means that the
        host bits aren't considered at all in this method.  If you want
        to compare host bits, you can easily enough do a
        'HostA._ip < HostB._ip'

        Args:
            other: An IP object.

        Returns:
            If the IP versions of self and other are the same, returns:

            -1 if self < other:
              eg: IPv4Network('192.0.2.0/25') < IPv4Network('192.0.2.128/25')
              IPv6Network('2001:db8::1000/124') <
                  IPv6Network('2001:db8::2000/124')
            0 if self == other
              eg: IPv4Network('192.0.2.0/24') == IPv4Network('192.0.2.0/24')
              IPv6Network('2001:db8::1000/124') ==
                  IPv6Network('2001:db8::1000/124')
            1 if self > other
              eg: IPv4Network('192.0.2.128/25') > IPv4Network('192.0.2.0/25')
                  IPv6Network('2001:db8::2000/124') >
                      IPv6Network('2001:db8::1000/124')

          Raises:
              TypeError if the IP versions are different.

        rGz are not of the same typerdr6r)rerLrhrr�s  r�compare_networksz_BaseNetwork.compare_networksgs���B�=�E�N�*�*��!�T�T�5�5�5�*�+�+�
+���%�"7�7�7��2���%�"7�7�7��1��<�%�-�'�'��2��<�%�-�'�'��1��qr
c�*�|j|j|jfS)z�Network-only key function.

        Returns an object that identifies this address' network and
        netmask. This function is a suitable "key" argument for sorted()
        and list.sort().

        )rerhrrzs rrqz_BaseNetwork._get_networks_key�s���
�t�3�T�\�B�Br
r6Nc#�K�|j|jkr|V�dS|�9||jkrtd���|dkrtd���||jz
}|dkrtd���|j|z}||jkrtd||fz���t|j��}t|j��dz}t|j��dz|z	}t|||��D]}|�||f��}|V��dS)a�The subnets which join to make the current subnet.

        In the case that self contains only one IP
        (self._prefixlen == 32 for IPv4 or self._prefixlen == 128
        for IPv6), yield an iterator with just ourself.

        Args:
            prefixlen_diff: An integer, the amount the prefix length
              should be increased by. This should not be set if
              new_prefix is also set.
            new_prefix: The desired new prefix length. This must be a
              larger number (smaller prefix) than the existing prefix.
              This should not be set if prefixlen_diff is also set.

        Returns:
            An iterator of IPv(4|6) objects.

        Raises:
            ValueError: The prefixlen_diff is too small or too large.
                OR
            prefixlen_diff and new_prefix are both set or new_prefix
              is a smaller number than the current prefix (smaller
              number means a larger network)

        Nznew prefix must be longerr6�(cannot set prefixlen_diff and new_prefixrzprefix length diff must be > 0z0prefix length diff %d is invalid for netblock %s)	rfrNrr�rhr^rr�r�)	r{�prefixlen_diff�
new_prefix�
new_prefixlen�start�end�step�new_addr�currents	         rr`z_BaseNetwork.subnets�sM����4�?�d�1�1�1��J�J�J��F��!��D�O�+�+� �!<�=�=�=���"�"� �!K�L�L�L�'�$�/�9�N��A����=�>�>�>���.�8�
��4�.�.�.��B�!�4�F)�)�*�*�
*��D�(�)�)���$�(�)�)�A�-���D�M�"�"�Q�&�>�9���e�S�$�/�/�	�	�H��n�n�h�
�%>�?�?�G��M�M�M�M�	�	r
c�f�|jdkr|S|�9||jkrtd���|dkrtd���|j|z
}|j|z
}|dkrtd|j|fz���|�t	|j��t	|j��|zz|f��S)a�The supernet containing the current network.

        Args:
            prefixlen_diff: An integer, the amount the prefix length of
              the network should be decreased by.  For example, given a
              /24 network and a prefixlen_diff of 3, a supernet with a
              /21 netmask is returned.

        Returns:
            An IPv4 network object.

        Raises:
            ValueError: If self.prefixlen - prefixlen_diff < 0. I.e., you have
              a negative prefix length.
                OR
            If prefixlen_diff and new_prefix are both set or new_prefix is a
              larger number than the current prefix (larger number means a
              smaller network)

        rNznew prefix must be shorterr6r#z;current prefixlen is %d, cannot have a prefixlen_diff of %d)rfrr�r�r�rhr)r{r$r%r&s    rrYz_BaseNetwork.supernet�s���*�?�a����K��!��D�O�+�+� �!=�>�>�>���"�"� �!K�L�L�L�!�_�z�9�N����7�
��1����M����0�1�2�2�
2��~�~���$�%�%��T�\�):�):�n�)L�M�����	r
c�2�|jjo|jjS�z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is a multicast address.
            See RFC 2373 2.7 for details.

        )rh�is_multicastr^rzs rr/z_BaseNetwork.is_multicast�s ���$�1�4��&�3�	5r
c���	|j|jkrt|�d|�d����|j|jko|j|jkS#t$rtd|�d|�����wxYw)NrGrHz*Unable to test subnet containment between )rerLrhr^rg)�ar�s  r�
_is_subnet_ofz_BaseNetwork._is_subnet_ofs���	4��z�Q�Z�'�'��1� J� J�1� J� J� J�K�K�K��%��):�:�?��'�1�+>�>�
@���	4�	4�	4��3�'(�3�3�/0�3�3�4�4�
4�	4���s�AA� A'c�.�|�||��S)z1Return True if this network is a subnet of other.�r2r�s  rrz_BaseNetwork.subnet_ofs���!�!�$��.�.�.r
c�.�|�||��S)z3Return True if this network is a supernet of other.r4r�s  r�supernet_ofz_BaseNetwork.supernet_ofs���!�!�%��.�.�.r
c�2�|jjo|jjS)��Test if the address is otherwise IETF reserved.

        Returns:
            A boolean, True if the address is within one of the
            reserved IPv6 Network ranges.

        )rh�is_reservedr^rzs rr9z_BaseNetwork.is_reserved� ���$�0�3��&�2�	4r
c�2�|jjo|jjS�z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is reserved per RFC 4291.

        )rh�
is_link_localr^rzs rr=z_BaseNetwork.is_link_local+s ���$�2�5��&�4�	6r
c���t�fd��jjD����o$t�fd��jjD����S)z�Test if this network belongs to a private range.

        Returns:
            A boolean, True if the network is reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        c3�<�K�|]}�j|vo�j|vV��dSr�r	)�.0�priv_networkr{s  �r�	<genexpr>z*_BaseNetwork.is_private.<locals>.<genexpr>?sW�����J�J�#��'�<�7�:��)�\�9�J�J�J�J�J�Jr
c3�<�K�|]}�j|vo�j|vV��dSr�r	)r@r�r{s  �rrBz*_BaseNetwork.is_private.<locals>.<genexpr>AsY�����R�R� ��(��7�:��*�'�9�R�R�R�R�R�Rr
��any�
_constants�_private_networks�all�_private_networks_exceptionsrzs`r�
is_privatez_BaseNetwork.is_private6s�����J�J�J�J�'+��'H�J�J�J�J�J��NQ�R�R�R�R�$(�?�#O�R�R�R�O�O�	r
c��|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry or iana-ipv6-special-registry.

        �rJrzs r�	is_globalz_BaseNetwork.is_globalGs���?�"�"r
c�2�|jjo|jjS)��Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 2373 2.5.2.

        )rh�is_unspecifiedr^rzs rrPz_BaseNetwork.is_unspecifiedRs ���$�3�6��&�5�	7r
c�2�|jjo|jjS)��Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback address as defined in
            RFC 2373 2.5.3.

        )rh�is_loopbackr^rzs rrSz_BaseNetwork.is_loopback^r:r
)r6N))rr	r
rr�r�r�r�rr�r�r�rr
�	functools�cached_propertyr^rr�rrrrr�r�rr rqr`rYr/�staticmethodr2rr6r9r=rJrMrPrSrr
rrprp�s���������?�?�?�@�@�@�
)�
)�
)�)�)�)�6�6�6�
�
�
�"�"�"�C�C�C�
L�
L�
L�7�7�7���7�7���7���G�G���G��A�A��X�A��>�>��X�>��?�?��X�?��K�K��X�K��'�'��X�'�����X��I2�I2�I2�V.�.�.�`C�C�C�3�3�3�3�j'�'�'�'�R�	5�	5��X�	5��	4�	4��\�	4�/�/�/�/�/�/��	4�	4��X�	4��6�6��X�6�����X�� �#�#��X�#��	7�	7��X�	7��	4�	4��X�	4�	4�	4r
rpc��eZdZgZdS)�_BaseConstantsN)rr	r
rGrr
rrXrXks���������r
rXc���eZdZdZdZdZdezdz
ZeZiZ	d�Z
ed���Zed���Z
ed	���Zed
���Zd�Zed���Zed
���ZdS)�_BaseV4zyBase IPv4 object.

    The following methods are used by IPv4 objects in both single IP
    addresses and networks.

    rr$r/r6c� �t|��Sr�r~rzs rryz$_BaseV4._explode_shorthand_ip_string�s���4�y�y�r
c��||jvr�t|t��r,|}d|cxkr|jksn|�|��n<	|�|��}n%#t$r|�|��}YnwxYwt|�	|����}||f|j|<|j|S�aMake a (netmask, prefix_len) tuple from the given argument.

        Argument can be:
        - an integer (the prefix length)
        - a string representing the prefix length (e.g. "24")
        - a string representing the prefix netmask (e.g. "255.255.255.0")
        r)
�_netmask_cacherJr�rNr�r�rr�rr��r��argr�rs    r�
_make_netmaskz_BaseV4._make_netmask�s����c�(�(�(��#�s�#�#�
@��	��Y�<�<�<�<�#�*<�<�<�<�<��/�/�	�:�:�:��@� #� >� >�s� C� C�I�I��(�@�@�@�!$� :� :�3� ?� ?�I�I�I�@����"�#�"9�"9�)�"D�"D�E�E�G�&-�y�&8�C��s�#��!�#�&�&s�A"�"B�Bc�D�|std���|�d��}t|��dkrtd|z���	t�t|j|��d��S#t$r}t|�d|����d�d}~wwxYw)aTurn the given IP string into an integer for comparison.

        Args:
            ip_str: A string, the IP ip_str.

        Returns:
            The IP ip_str as an integer.

        Raises:
            AddressValueError: if ip_str isn't a valid IPv4 Address.

        �Address cannot be empty�.r$zExpected 4 octets in %rr�� in N)rr1r2r��
from_bytes�map�_parse_octetr)r�r��octets�excs    rr�z_BaseV4._ip_int_from_string�s����	?�#�$=�>�>�>����c�"�"���v�;�;�!���#�$=��$F�G�G�G�	J��>�>�#�c�&6��"?�"?��G�G�G���	J�	J�	J�#�#�#�#�v�v�$>�?�?�T�I�����	J���s�
-A;�;
B�B�Bc��|std���|���r|���sd}t||z���t|��dkrd}t||z���|dkr |ddkrd}t||z���t	|d��}|d	krtd
|z���|S)aConvert a decimal octet into an integer.

        Args:
            octet_str: A string, the number to parse.

        Returns:
            The octet as an integer.

        Raises:
            ValueError: if the octet isn't strictly a decimal from [0..255].

        zEmpty octet not permittedz#Only decimal digits permitted in %r�z$At most 3 characters permitted in %rr�rz%Leading zeros are not permitted in %r�
�zOctet %d (> 255) not permitted)rr�r�r2r�)r��	octet_strr��	octet_ints    rrhz_BaseV4._parse_octet�s����	:��8�9�9�9��!�!�#�#�	.�	�(9�(9�(;�(;�	.�7�C��S�9�_�-�-�-��y�>�>�A���8�C��S�9�_�-�-�-�����	�!��� 3� 3�9�C��S�9�_�-�-�-��	�2�&�&�	��s�?�?��=�	�I�J�J�J��r
c	�z�d�tt|�dd������S)z�Turns a 32-bit integer into dotted decimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            The IP address as a string in dotted decimal notation.

        rdr$r�)�joinrgr0r&)r�r�s  rr�z_BaseV4._string_from_ip_int�s.���x�x��C�����E�!:�!:�;�;�<�<�<r
c��t|���d��ddd�}d�|��dzS)z�Return the reverse DNS pointer name for the IPv4 address.

        This implements the method described in RFC1035 3.5.

        rdNrdz
.in-addr.arpa)r0r1rr)r{�reverse_octetss  rr�z_BaseV4._reverse_pointer�s=���T������-�-�d�d��d�3���x�x��'�'�/�9�9r
c��|jSr��rNrzs r�
max_prefixlenz_BaseV4.max_prefixlen�����"�"r
c��|jSr�r�rzs rrMz_BaseV4.version��
���}�r
N)rr	r
rr�re�
IPV4LENGTHrOrNr^ryr�rar�rhr�r�r�rwrMrr
rrZrZss���������I��H��J��!�#�I��N��N�����'�'��[�'�2�J�J��[�J�2�!�!��[�!�F�
=�
=��[�
=�:�:�:��#�#��X�#�����X���r
rZc� �eZdZdZdZd�Zed���Zed���Zee	j
��d�����Zee	j
��d�����Zed���Z
ed	���Zed
���Zed���ZdS)
rz/Represent and manipulate single IPv4 Addresses.)r9�__weakref__c��t|t��r|�|��||_dSt|t��r7|�|d��t�|��|_dSt|��}d|vrtd|�����|�	|��|_dS)a�
        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv4Address('192.0.2.1') == IPv4Address(3221225985).
              or, more generally
              IPv4Address(int(IPv4Address('192.0.2.1'))) ==
                IPv4Address('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.

        Nr$r.�Unexpected '/' in )
rJr�r�r9r�r�rfr0rr��r{r�addr_strs   r�__init__zIPv4Address.__init__s���"�g�s�#�#�	��#�#�G�,�,�,��D�H��F��g�u�%�%�	��&�&�w��2�2�2��~�~�g�.�.�D�H��F��w�<�<���(�?�?�#�$D��$D�$D�E�E�E��+�+�H�5�5����r
c�*�t|j��S�z*The binary representation of this address.)r(r9rzs r�packedzIPv4Address.packed)��� ���)�)�)r
c��||jjvS)z�Test if the address is otherwise IETF reserved.

         Returns:
             A boolean, True if the address is within the
             reserved IPv4 Network range.

        )rF�_reserved_networkrzs rr9zIPv4Address.is_reserved.s���t��8�8�8r
c���t�fd��jjD����o$t�fd��jjD����S)��``True`` if the address is defined as not globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exceptions:

        * ``is_private`` is ``False`` for ``100.64.0.0/10``
        * For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
            semantics of the underlying IPv4 addresses and the following condition holds
            (see :attr:`IPv6Address.ipv4_mapped`)::

                address.is_private == address.ipv4_mapped.is_private

        ``is_private`` has value opposite to :attr:`is_global`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        c3� �K�|]}�|vV��	dSr�r�r@rTr{s  �rrBz)IPv4Address.is_private.<locals>.<genexpr>K�'�����I�I�����I�I�I�I�I�Ir
c3� �K�|]}�|vV��	dSr�rr�s  �rrBz)IPv4Address.is_private.<locals>.<genexpr>L�'�����\�\��D��O�\�\�\�\�\�\r
rDrzs`rrJzIPv4Address.is_private9sZ���$
�I�I�I�I�t��'H�I�I�I�I�I�
]��\�\�\�\�t��/[�\�\�\�\�\�	
r
c�.�||jjvo|jS�ar``True`` if the address is defined as globally reachable by
        iana-ipv4-special-registry_ (for IPv4) or iana-ipv6-special-registry_
        (for IPv6) with the following exception:

        For IPv4-mapped IPv6-addresses the ``is_private`` value is determined by the
        semantics of the underlying IPv4 addresses and the following condition holds
        (see :attr:`IPv6Address.ipv4_mapped`)::

            address.is_global == address.ipv4_mapped.is_global

        ``is_global`` has value opposite to :attr:`is_private`, except for the ``100.64.0.0/10``
        IPv4 range where they are both ``False``.
        )rF�_public_networkrJrzs rrMzIPv4Address.is_globalOs�� �4�?�:�:�R�4�?�?R�Rr
c��||jjvS)z�Test if the address is reserved for multicast use.

        Returns:
            A boolean, True if the address is multicast.
            See RFC 3171 for details.

        �rF�_multicast_networkrzs rr/zIPv4Address.is_multicasta����t��9�9�9r
c�"�||jjkS)z�Test if the address is unspecified.

        Returns:
            A boolean, True if this is the unspecified address as defined in
            RFC 5735 3.

        )rF�_unspecified_addressrzs rrPzIPv4Address.is_unspecifiedls���t��;�;�;r
c��||jjvS)z�Test if the address is a loopback address.

        Returns:
            A boolean, True if the address is a loopback per RFC 3330.

        )rF�_loopback_networkrzs rrSzIPv4Address.is_loopbackws���t��8�8�8r
c��||jjvS)z�Test if the address is reserved for link-local.

        Returns:
            A boolean, True if the address is link-local per RFC 3927.

        �rF�_linklocal_networkrzs rr=zIPv4Address.is_link_local�����t��9�9�9r
N)rr	r
rr�r�r�r�r9rT�	lru_cacherJrMr/rPrSr=rr
rrrs6������9�9�&�I�!6�!6�!6�F�*�*��X�*��9�9��X�9���Y����
�
����X�
�(��Y����S�S����X�S� �:�:��X�:��<�<��X�<��9�9��X�9��:�:��X�:�:�:r
rc��eZdZd�Zejd���Zd�Zd�Zd�Z	d�Z
ejZe
d���Ze
d���Ze
d	���Ze
d
���ZdS)r c���|�|��\}}t�||��t||fd���|_|jj|_|jj|_dS�NF)r)r�rr�rr�rrf�r{rr3�masks    rr�zIPv4Interface.__init__��c���,�,�W�5�5�
��d����T�4�(�(�(�"�D�$�<��>�>�>����|�+����,�1����r
c��|jjSr��r�rrzs rrzIPv4Interface.hostmask��
���|�$�$r
c�J�d|�|j��|jfzSr��r�r9rfrzs rr�zIPv4Interface.__str__�s+���$�2�2�4�8�<�<��/�+�+�	+r
c��t�||��}|tus|s|S	|j|jkS#t$rYdSwxYwr)rr�rsr�rg�r{r��
address_equals   rr�zIPv4Interface.__eq__��e��#�*�*�4��7�7�
��N�*�*�-�*� � �	��<�5�=�0�0���	�	�	��5�5�		�����:�
A�Ac��t�||��}|turtS	|j|jkp|j|jko|S#t$rYdSwxYwr)rr�rsr�rg�r{r��address_lesss   rr�zIPv4Interface.__lt__�sz��"�)�)�$��6�6���>�)�)�!�!�	��L�5�=�0�C��L�E�M�1�B�l�
D���	�	�	��5�5�	���s�!A�
A�Ac�h�t|j|jt|jj��f��Sr��r�r9rfr�r�rhrzs rr�zIPv4Interface.__hash__��(���T�X�t���D�L�4P�0Q�0Q�R�S�S�Sr
c�*�t|j��Sr�)rr9rzs rr>zIPv4Interface.ip�����4�8�$�$�$r
c�J�|�|j���d|j��Srr�rzs rrzIPv4Interface.with_prefixlen��,���2�2�4�8�<�<�<�<��/�/�+�	+r
c�J�|�|j���d|j��Sr�r�r9rrzs rrzIPv4Interface.with_netmask��,���2�2�4�8�<�<�<�<��,�,�(�	(r
c�J�|�|j���d|j��Sr�r�r9rrzs rrzIPv4Interface.with_hostmask��,���2�2�4�8�<�<�<�<��-�-�)�	)r
N)rr	r
r�rTrUrr�r�r�r�rwr�r�r>rrrrr
rr r �s�������2�2�2���%�%���%�+�+�+�
�
�
�
�
�
�T�T�T� �*�J�
�%�%��X�%��+�+��X�+��(�(��X�(��)�)��X�)�)�)r
r c�^�eZdZdZeZdd�Zeej	��d�����Z
dS)raeThis class represents and manipulates 32-bit IPv4 network + addresses..

    Attributes: [examples for IPv4Network('192.0.2.0/27')]
        .network_address: IPv4Address('192.0.2.0')
        .hostmask: IPv4Address('0.0.0.31')
        .broadcast_address: IPv4Address('192.0.2.32')
        .netmask: IPv4Address('255.255.255.224')
        .prefixlen: 27

    Tc���|�|��\�}t���|_|�|��\|_|_t
|j��}|t
|j��z|kr=|rtd|z���t|t
|j��z��|_|j|jdz
kr|j	|_
dS|j|jkr�fd�|_
dSdS)aInstantiate a new IPv4 network object.

        Args:
            address: A string or integer representing the IP [& network].
              '192.0.2.0/24'
              '192.0.2.0/255.255.255.0'
              '192.0.2.0/0.0.0.255'
              are all functionally the same in IPv4. Similarly,
              '192.0.2.1'
              '192.0.2.1/255.255.255.255'
              '192.0.2.1/32'
              are also functionally equivalent. That is to say, failing to
              provide a subnetmask will create an object with a mask of /32.

              If the mask (portion after the / in the argument) is given in
              dotted quad form, it is treated as a netmask if it starts with a
              non-zero field (e.g. /255.0.0.0 == /8) and as a hostmask if it
              starts with a zero field (e.g. 0.255.255.255 == /8), with the
              single exception of an all-zero mask which is treated as a
              netmask == /0. If no mask is given, a default of /32 is used.

              Additionally, an integer can be passed, so
              IPv4Network('192.0.2.1') == IPv4Network(3221225985)
              or, more generally
              IPv4Interface(int(IPv4Interface('192.0.2.1'))) ==
                IPv4Interface('192.0.2.1')

        Raises:
            AddressValueError: If ipaddress isn't a valid IPv4 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv4 address.
            ValueError: If strict is True and a network address is not
              supplied.
        �%s has host bits setr6c�$��t���gSr�)r�r3s�r�<lambda>z&IPv4Network.__init__.<locals>.<lambda>����+�d�"3�"3�!4�r
N)r�rrhrarrfr�rrNr�r��r{rrr�r�r3s     @rr�zIPv4Network.__init__�s	���F�,�,�W�5�5�
��d�*�4�0�0���(,�(:�(:�4�(@�(@�%���d�o��T�)�*�*���C���%�%�%��/�/��
F� �!7�$�!>�?�?�?�'2�6�36�t�|�3D�3D�4E�(F�(F��$��?�t�2�Q�6�7�7���D�J�J�J�
�_��!4�
5�
5�4�4�4�4�D�J�J�J�6�
5r
c�l�|jtd��vo|jtd��vo|jS)z�Test if this address is allocated for public networks.

        Returns:
            A boolean, True if the address is not reserved per
            iana-ipv4-special-registry.

        �
100.64.0.0/10)rhrr^rJrzs rrMzIPv4Network.is_globalsH���)�[��-I�-I�I�K��*�k�/�.J�.J�J�L�$��O�#�	%r
N�T)rr	r
rrr�r�r�rTr�rMrr
rrr�sk������	�	�!�N�25�25�25�25�h��Y����
%�
%����X�
%�
%�
%r
rc���eZdZed��Zed��Zed��Zed��Zed��ed��ed��ed��ed��ed��ed	��ed
��ed��ed��ed
��ed��ed��ed��gZed��ed��gZ	ed��Z
ed��ZdS)�_IPv4Constantsz169.254.0.0/16z127.0.0.0/8z224.0.0.0/4r�z	0.0.0.0/8z
10.0.0.0/8z
172.16.0.0/12z192.0.0.0/24z192.0.0.170/31z192.0.2.0/24z192.168.0.0/16z
198.18.0.0/15z198.51.100.0/24z203.0.113.0/24z240.0.0.0/4z255.255.255.255/32z192.0.0.9/32z
192.0.0.10/32z0.0.0.0N)
rr	r
rr�r�r�r�rGrIr�rr�rr
rr�r�!s\������$��%5�6�6��#��M�2�2��$��]�3�3��!�k�/�2�2�O�
	��K� � ���L�!�!���M�"�"���$�%�%���O�$�$���N�#�#���$�%�%���N�#�#���$�%�%���O�$�$���%�&�&���$�%�%���M�"�"���(�)�)�
��$	��N�#�#���O�$�$�$� �
$��M�2�2��&�;�y�1�1���r
r�c�
�eZdZdZdZdZdezdz
ZdZe	d��Z
eZiZe
d���Ze
d	���Ze
d
���Ze
d���Ze
dd
���Zd�Zd�Zed���Zed���Zed���ZdS)�_BaseV6zyBase IPv6 object.

    The following methods are used by IPv6 objects in both single IP
    addresses and networks.

    rrIr/r6r��0123456789ABCDEFabcdefc�6�||jvr�t|t��r,|}d|cxkr|jksn|�|��n|�|��}t
|�|����}||f|j|<|j|Sr])r^rJr�rNr�r�rr�r_s    rraz_BaseV6._make_netmask_s����c�(�(�(��#�s�#�#�
@��	��Y�<�<�<�<�#�*<�<�<�<�<��/�/�	�:�:�:���:�:�3�?�?�	�!�#�"9�"9�)�"D�"D�E�E�G�&-�y�&8�C��s�#��!�#�&�&r
c��|std���|�d��}d}t|��|krd||fz}t|���d|dvr�	t|�����j}n'#t$r}t|�d|����d�d}~wwxYw|�d	|d
z	dzz��|�d	|dzz��|jdz}t|��|krd
|dz
|fz}t|���d}tdt|��dz
��D]"}	||	s|�d|z}t|���|	}�#|��|}
t|��|z
dz
}|ds|
dz}
|
rd}t||z���|ds|dz}|rd}t||z���|j|
|zz
}|dkrd}t||jdz
|fz���n~t|��|jkrd}t||j|fz���|dsd}t||z���|dsd}t||z���t|��}
d}d}	d}
t|
��D]%}	|
d
z}
|
|�	||	��z}
�&|
d
|zz}
t|d��D]%}	|
d
z}
|
|�	||	��z}
�&|
S#t$r}t|�d|����d�d}~wwxYw)z�Turn an IPv6 ip_str into an integer.

        Args:
            ip_str: A string, the IPv6 ip_str.

        Returns:
            An int, the IPv6 address

        Raises:
            AddressValueError: if ip_str isn't a valid IPv6 Address.

        rc�:rlz At least %d parts expected in %rrdrdreN�%xr+�r6z!At most %d colons permitted in %rz At most one '::' permitted in %rrz0Leading ':' only permitted as part of '::' in %rz1Trailing ':' only permitted as part of '::' in %rz/Expected at most %d other parts with '::' in %rz,Exactly %d parts expected without '::' in %r)rr1r2rrXr9r[�
_HEXTET_COUNTr��
_parse_hextetr)r�r��parts�
_min_partsr��ipv4_intrj�
_max_parts�
skip_index�i�parts_hi�parts_lo�
parts_skippedr�s              rr�z_BaseV6._ip_int_from_stringss����	?�#�$=�>�>�>����S�!�!���
��u�:�:�
�"�"�4�
�F�7K�K�C�#�C�(�(�(��%��)���
N�&�u�y�y�{�{�3�3�7����$�
N�
N�
N�'�c�c�c�6�6�(B�C�C��M�����
N�����L�L��(�b�.�F�!:�;�<�<�<��L�L���F�!2�3�4�4�4�
�&��*�
��u�:�:�
�"�"�5��A��v�8N�N�C�#�C�(�(�(��
��q�#�e�*�*�q�.�)�)�	�	�A���8�
��)�<�v�E�C�+�C�0�0�0��
���!�!�H��5�z�z�J�.��2�H���8�
:��A�
���:�L�C�+�C�&�L�9�9�9���9�
:��A�
���:�M�C�+�C�&�L�9�9�9��-��H�1D�E�M��q� � �G��'��s�/@��/B�F�.K�(K�L�L�L�!��5�z�z�S�.�.�.�D��'��s�/@�&�.I�(I�J�J�J���8�
6�H��'��f��5�5�5���9�
6�I��'��f��5�5�5��5�z�z�H��H��M�	J��F��8�_�_�
6�
6���2�
���#�+�+�E�!�H�5�5�5����r�M�)�)�F��H�9�a�(�(�
6�
6���2�
���#�+�+�E�!�H�5�5�5����M���	J�	J�	J�#�#�#�#�v�v�$>�?�?�T�I�����	J���s1�&B�
B(�B#�#B(�/A7K'�'
L�1L�Lc���|j�|��std|z���t|��dkrd}t||z���t	|d��S)a&Convert an IPv6 hextet string into an integer.

        Args:
            hextet_str: A string, the number to parse.

        Returns:
            The hextet as an integer.

        Raises:
            ValueError: if the input isn't strictly a hex number from
              [0..FFFF].

        zOnly hex digits permitted in %rr$z$At most 4 characters permitted in %rr+)�_HEX_DIGITS�
issupersetrr2r�)r��
hextet_strr�s   rr�z_BaseV6._parse_hextet�sl�� ��)�)�*�5�5�	M��>��K�L�L�L��z�?�?�Q���8�C��S�:�-�.�.�.��:�r�"�"�"r
c���d}d}d}d}t|��D]'\}}|dkr|dz
}|dkr|}||kr|}|}�#d}d}�(|dkr2||z}|t|��kr|dgz
}dg|||�<|dkrdg|z}|S)a�Compresses a list of hextets.

        Compresses a list of strings, replacing the longest continuous
        sequence of "0" in the list with "" and adding empty strings at
        the beginning or at the end of the string such that subsequently
        calling ":".join(hextets) will produce the compressed version of
        the IPv6 address.

        Args:
            hextets: A list of strings, the hextets to compress.

        Returns:
            A list of strings.

        rdrr�r6�)�	enumerater2)	r��hextets�best_doublecolon_start�best_doublecolon_len�doublecolon_start�doublecolon_len�index�hextet�best_doublecolon_ends	         r�_compress_hextetsz_BaseV6._compress_hextets�s���""$�� ������&�w�/�/�	'�	'�M�E�6���}�}��1�$��$��*�*�(-�%�"�%9�9�9�+:�(�->�*��"#��$&�!�!��!�#�#�$:�$8�%9� �$�s�7�|�|�3�3��B�4���DF�4�G�*�+?�?�@�%��*�*��$��.���r
Nc���|�t|j��}||jkrtd���d|z��fd�t	ddd��D��}|�|��}d�|��S)	a,Turns a 128-bit integer into hexadecimal notation.

        Args:
            ip_int: An integer, the IP address.

        Returns:
            A string, the hexadecimal representation of the address.

        Raises:
            ValueError: The address is bigger than 128 bits of all ones.

        NzIPv6 address is too large�%032xc	�L��g|] }dt�||dz�d��z��!S)r�r$r+)r��r@r��hex_strs  �r�
<listcomp>z/_BaseV6._string_from_ip_int.<locals>.<listcomp>:s4���K�K�K�a�4�#�g�a��!��e�n�b�1�1�1�K�K�Kr
rrr$r�)r�r9rOrr�r�rr)r�r�r�r�s   @rr�z_BaseV6._string_from_ip_int%s�����>����\�\�F��C�M�!�!��8�9�9�9��F�"��K�K�K�K�5��B��?�?�K�K�K���'�'��0�0���x�x�� � � r
c����t|t��rt|j��}n9t|t��rt|j��}nt|��}|�|��}d|z��fd�tddd��D��}t|ttf��rdd�	|��|j
fzSd�	|��S)z�Expand a shortened IPv6 address.

        Args:
            ip_str: A string, the IPv6 address.

        Returns:
            A string, the expanded IPv6 address.

        r�c�*��g|]}�||dz���S)r$rr�s  �rr�z8_BaseV6._explode_shorthand_ip_string.<locals>.<listcomp>Rs%���9�9�9�A���1�Q�3���9�9�9r
rrr$r�r�)rJrr0rhr!r>r�r�rprrrf)r{r�r�r�r�s    @rryz$_BaseV6._explode_shorthand_ip_string?s�����d�K�(�(�	���-�.�.�F�F�
��m�
,�
,�	����\�\�F�F���Y�Y�F��)�)�&�1�1���F�"��9�9�9�9��q�"�a���9�9�9���d�\�=�9�:�:�	@��c�h�h�u�o�o�t��?�?�?��x�x����r
c�z�|jddd��dd��}d�|��dzS)z�Return the reverse DNS pointer name for the IPv6 address.

        This implements the method described in RFC3596 2.5.

        Nrdr�r�rdz	.ip6.arpa)r|�replacerr)r{�
reverse_charss  rr�z_BaseV6._reverse_pointerWs=���
�d�d��d�+�3�3�C��<�<�
��x�x�
�&�&��4�4r
c�v�|�d��\}}}|sd}n|rd|vrtd|z���||fS)z�Helper function to parse IPv6 string address with scope id.

        See RFC 4007 for details.

        Args:
            ip_str: A string, the IPv6 address.

        Returns:
            (addr, scope_id) tuple.

        �%NzInvalid IPv6 address: "%r")�	partitionr)r�r3�sep�scope_ids    r�_split_scope_idz_BaseV6._split_scope_id`s]��%�.�.�s�3�3���c�8��	K��H�H��	K�S�H�_�_�#�$@�6�$I�J�J�J��X�~�r
c��|jSr�rvrzs rrwz_BaseV6.max_prefixlentrxr
c��|jSr�r�rzs rrMz_BaseV6.versionxrzr
r�)rr	r
rr�re�
IPV6LENGTHrOr��	frozensetr�rNr^r�rar�r�r�r�ryr�rVrr�rwrMrr
rr�r�KsZ���������I��H��J��!�#�I��M��)�4�5�5�K��N��N��'�'��[�'�&�eJ�eJ��[�eJ�N�#�#��[�#�2�-�-��[�-�^�!�!�!��[�!�2���05�5�5�����\��&�#�#��X�#�����X���r
r�c���eZdZdZdZd�Z�fd�Zd�Z�fd�Zd�Z	e
d���Ze
d	���Ze
d
���Z
e
d���Ze
d���Ze
d
���Ze
ej��d�����Ze
d���Ze
d���Ze
d���Ze
d���Ze
d���Ze
d���Z�xZS)rz/Represent and manipulate single IPv6 Addresses.)r9�	_scope_idr}c���t|t��r%|�|��||_d|_dSt|t
��r?|�|d��t�|d��|_d|_dSt|��}d|vrtd|�����|�
|��\}|_|�|��|_dS)aInstantiate a new IPv6 address object.

        Args:
            address: A string or integer representing the IP

              Additionally, an integer can be passed, so
              IPv6Address('2001:db8::') ==
                IPv6Address(42540766411282592856903984951653826560)
              or, more generally
              IPv6Address(int(IPv6Address('2001:db8::'))) ==
                IPv6Address('2001:db8::')

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.

        Nr+r�r.r)rJr�r�r9rr�r�rfr0rrr�r�s   rr�zIPv6Address.__init__�s���$�g�s�#�#�	��#�#�G�,�,�,��D�H�!�D�N��F��g�u�%�%�	��&�&�w��3�3�3��~�~�g�u�5�5�D�H�!�D�N��F��w�<�<���(�?�?�#�$D��$D�$D�E�E�E�#'�#7�#7��#A�#A� ��$�.��+�+�H�5�5����r
c�p��t�����}|jr
|dz|jzn|S)Nr�)r�r�r)r{r�r�s  �rr�zIPv6Address.__str__�s3��������"�"��04��J�v��|�d�n�,�,�F�Jr
c�8�t|j|jf��Sr�)r�r9rrzs rr�zIPv6Address.__hash__�s���T�X�t�~�.�/�/�/r
c���t���|��}|turtS|sdS|jt	|dd��kS)NFr)r�r�rsr�getattr)r{r�r�r�s   �rr�zIPv6Address.__eq__�sO��������u�-�-�
��N�*�*�!�!��	��5��~����T�!B�!B�B�Br
c�0�|jt|��ffSr�r�rzs rr�zIPv6Address.__reduce__�s�����T����-�-r
c��|jS)z�Identifier of a particular zone of the address's scope.

        See RFC 4007 for details.

        Returns:
            A string identifying the zone of the address if specified, else None.

        )rrzs rr�zIPv6Address.scope_id�s���~�r
c�*�t|j��Sr�)r,r9rzs rr�zIPv6Address.packed�r�r
c��||jjvSr.r�rzs rr/zIPv6Address.is_multicast�r�r
c�N��t�fd��jjD����S)r8c3� �K�|]}�|vV��	dSr�r)r@r�r{s  �rrBz*IPv6Address.is_reserved.<locals>.<genexpr>�s'�����I�I��4�1�9�I�I�I�I�I�Ir
)rErF�_reserved_networksrzs`rr9zIPv6Address.is_reserved�s-����I�I�I�I�d�o�&H�I�I�I�I�I�Ir
c��||jjvSr<r�rzs rr=zIPv6Address.is_link_local�r�r
c��||jjvS�a`Test if the address is reserved for site-local.

        Note that the site-local address space has been deprecated by RFC 3879.
        Use is_private to test if this address is in the space of unique local
        addresses as defined by RFC 4193.

        Returns:
            A boolean, True if the address is reserved per RFC 3513 2.5.6.

        )rF�_sitelocal_networkrzs r�
is_site_localzIPv6Address.is_site_local�s���t��9�9�9r
c����j}|�|jSt�fd��jjD����o$t�fd��jjD����S)r�Nc3� �K�|]}�|vV��	dSr�rr�s  �rrBz)IPv6Address.is_private.<locals>.<genexpr>r�r
c3� �K�|]}�|vV��	dSr�rr�s  �rrBz)IPv6Address.is_private.<locals>.<genexpr>r�r
)�ipv4_mappedrJrErFrGrHrI)r{rs` rrJzIPv6Address.is_private�sq���"�&���"��)�)��I�I�I�I�t��'H�I�I�I�I�I�
]��\�\�\�\�t��/[�\�\�\�\�\�	
r
c��|jSr�rLrzs rrMzIPv6Address.is_globals���?�"�"r
c��|jdkS)rOrr�rzs rrPzIPv6Address.is_unspecified&����x�1�}�r
c��|jdkS)rRr6r�rzs rrSzIPv6Address.is_loopback1rr
c�P�|jdz	dkrdSt|jdz��S)z�Return the IPv4 mapped address.

        Returns:
            If the IPv6 address is a v4 mapped address, return the
            IPv4 mapped address. Return None otherwise.

        rr�N����r9rrzs rrzIPv6Address.ipv4_mapped<s/��
�H��N�v�%�%��4��4�8�j�0�1�1�1r
c��|jdz	dkrdSt|jdz	dz��t|jdz��fS)z�Tuple of embedded teredo IPs.

        Returns:
            Tuple of the (server, client) IPs or None if the address
            doesn't appear to be a teredo address (doesn't start with
            2001::/32)

        �`i N�@r!r"rzs r�teredozIPv6Address.teredoIsN��
�H��N�z�)�)��4��T�X��^�z�9�:�:��T�X�I�
�2�3�3�5�	5r
c�V�|jdz	dkrdSt|jdz	dz��S)z�Return the IPv4 6to4 embedded address.

        Returns:
            The IPv4 6to4-embedded address if present or None if the
            address doesn't appear to contain a 6to4 embedded address.

        �pi N�Pr!r"rzs r�	sixtofourzIPv6Address.sixtofourXs3��
�H��O��&�&��4��D�H��N�j�8�9�9�9r
)rr	r
rr�r�r�r�r�r�r�r�r�r/r9r=rrTr�rJrMrPrSrr&r*r�r�s@rrr}s�������9�9�3�I�&6�&6�&6�PK�K�K�K�K�0�0�0�C�C�C�C�C�.�.�.��	�	��X�	��*�*��X�*��:�:��X�:��J�J��X�J��:�:��X�:��:�:��X�:���Y����
�
����X�
�.�#�#��X�#� ����X������X���
2�
2��X�
2��5�5��X�5��
:�
:��X�
:�
:�
:�
:�
:r
rc����eZdZd�Zejd���Z�fd�Zd�Zd�Z	d�Z
ejZe
d���Ze
d���Ze
d	���Ze
d
���Ze
d���Ze
d���Z�xZS)
r!c���|�|��\}}t�||��t||fd���|_|jj|_|jj|_dSr�)r�rr�rr�rrfr�s    rr�zIPv6Interface.__init__hr�r
c��|jjSr�r�rzs rrzIPv6Interface.hostmaskpr�r
c�X��dt�����|jfzSr�)r�r�rf)r{r�s �rr�zIPv6Interface.__str__ts*����%�'�'�/�/�+�+��/�+�+�	+r
c��t�||��}|tus|s|S	|j|jkS#t$rYdSwxYwr)rr�rsr�rgr�s   rr�zIPv6Interface.__eq__xr�r�c��t�||��}|tur|S	|j|jkp|j|jko|S#t$rYdSwxYwr)rr�rsr�rgr�s   rr�zIPv6Interface.__lt__�sz��"�)�)�$��6�6���>�)�)���	��L�5�=�0�C��L�E�M�1�B�l�
D���	�	�	��5�5�	���s�!A
�

A�Ac�h�t|j|jt|jj��f��Sr�r�rzs rr�zIPv6Interface.__hash__�r�r
c�*�t|j��Sr�)rr9rzs rr>zIPv6Interface.ip�r�r
c�J�|�|j���d|j��Srr�rzs rrzIPv6Interface.with_prefixlen�r�r
c�J�|�|j���d|j��Srr�rzs rrzIPv6Interface.with_netmask�r�r
c�J�|�|j���d|j��Srr�rzs rrzIPv6Interface.with_hostmask�r�r
c�0�|jdko|jjS)Nr)r9r�rPrzs rrPzIPv6Interface.is_unspecified�s���x�1�}�<���!<�<r
c�0�|jdko|jjSr�)r9r�rSrzs rrSzIPv6Interface.is_loopback�s���x�1�}�9���!9�9r
)rr	r
r�rTrUrr�r�r�r�rwr�r�r>rrrrPrSr�r�s@rr!r!fs@�������2�2�2���%�%���%�+�+�+�+�+�
�
�
�
�
�
�T�T�T� �*�J�
�%�%��X�%��+�+��X�+��(�(��X�(��)�)��X�)��=�=��X�=��:�:��X�:�:�:�:�:r
r!c�:�eZdZdZeZdd�Zd�Zed���Z	dS)ravThis class represents and manipulates 128-bit IPv6 networks.

    Attributes: [examples for IPv6('2001:db8::1000/124')]
        .network_address: IPv6Address('2001:db8::1000')
        .hostmask: IPv6Address('::f')
        .broadcast_address: IPv6Address('2001:db8::100f')
        .netmask: IPv6Address('ffff:ffff:ffff:ffff:ffff:ffff:ffff:fff0')
        .prefixlen: 124

    Tc���|�|��\�}t���|_|�|��\|_|_t
|j��}|t
|j��z|kr=|rtd|z���t|t
|j��z��|_|j|jdz
kr|j	|_
dS|j|jkr�fd�|_
dSdS)a�Instantiate a new IPv6 Network object.

        Args:
            address: A string or integer representing the IPv6 network or the
              IP and prefix/netmask.
              '2001:db8::/128'
              '2001:db8:0000:0000:0000:0000:0000:0000/128'
              '2001:db8::'
              are all functionally the same in IPv6.  That is to say,
              failing to provide a subnetmask will create an object with
              a mask of /128.

              Additionally, an integer can be passed, so
              IPv6Network('2001:db8::') ==
                IPv6Network(42540766411282592856903984951653826560)
              or, more generally
              IPv6Network(int(IPv6Network('2001:db8::'))) ==
                IPv6Network('2001:db8::')

            strict: A boolean. If true, ensure that we have been passed
              A true network address, eg, 2001:db8::1000/124 and not an
              IP address on a network, eg, 2001:db8::1/124.

        Raises:
            AddressValueError: If address isn't a valid IPv6 address.
            NetmaskValueError: If the netmask isn't valid for
              an IPv6 address.
            ValueError: If strict was True and a network address was not
              supplied.
        r�r6c�$��t���gSr�)rr�s�rr�z&IPv6Network.__init__.<locals>.<lambda>�r�r
N)r�rrhrarrfr�rrNr�r�r�s     @rr�zIPv6Network.__init__�s���>�,�,�W�5�5�
��d�*�4�0�0���(,�(:�(:�4�(@�(@�%���d�o��T�)�*�*���C���%�%�%��/�/��
F� �!7�$�!>�?�?�?�'2�6�36�t�|�3D�3D�4E�(F�(F��$��?�t�2�Q�6�7�7���D�J�J�J�
�_�� 3�
3�
3�4�4�4�4�D�J�J�J�4�
3r
c#�K�t|j��}t|j��}t|dz|dz��D]}|�|��V��dS)z�Generate Iterator over usable hosts in a network.

          This is like __iter__ except it doesn't return the
          Subnet-Router anycast address.

        r6Nr�r�s    rr�zIPv6Network.hosts�sp�����d�*�+�+����.�/�/�	��w��{�I��M�2�2�	)�	)�A��%�%�a�(�(�(�(�(�(�	)�	)r
c�2�|jjo|jjSr)rhrr^rzs rrzIPv6Network.is_site_local�s ���$�2�5��&�4�	6r
Nr�)
rr	r
rrr�r�r�r�rrr
rrr�sd������	�	�!�N�.5�.5�.5�.5�`
)�
)�
)��6�6��X�6�6�6r
rc���eZdZed��Zed��Zed��ed��ed��ed��ed��ed��ed	��ed
��ed��ed��g
Zed��ed
��ed��ed��ed��ed��gZed��ed��ed��ed��ed��ed��ed��ed��ed��ed��ed��ed��ed��ed��ed ��gZed!��Z	d"S)#�_IPv6Constantsz	fe80::/10zff00::/8z::1/128z::/128z
::ffff:0:0/96z64:ff9b:1::/48z100::/64z	2001::/23z
2001:db8::/32z	2002::/16zfc00::/7z
2001:1::1/128z
2001:1::2/128z2001:3::/32z2001:4:112::/48z2001:20::/28z2001:30::/28z::/8z100::/8z200::/7z400::/6z800::/5z1000::/4z4000::/3z6000::/3z8000::/3zA000::/3zC000::/3zE000::/4zF000::/5zF800::/6zFE00::/9z	fec0::/10N)
rr	r
rr�r�rGrIrrrr
rr>r>
	s�������$��[�1�1��$��Z�0�0��
	��I�����H�����O�$�$���$�%�%���J�����K� � ���O�$�$���K� � ���J�����K� � �
��	��O�$�$���O�$�$���M�"�"���%�&�&���N�#�#���N�#�#�
$� �	��F���[�[��3�3���I�����I� 6� 6���I�����J� 7� 7���J�����Z�!8�!8���J�����Z�!8�!8���J�����Z�!8�!8���J�����Z�!8�!8���J���	��%��[�1�1���r
r>r�)%r�__version__rTr{rrrrrrr"r(r,r4r?rErUrbrnrurwr��total_orderingrKrprXrFrZrr rr�r�rr!rr>rr
r�<module>rAs]����������
�
�
�
�0�0�0�0�0�
�0�0�0�0�0�0�0�0�
�0�0�0�S�S�S�:S�S�S�S�:U�U�U�DC�C�C�(
C�
C�
C� ������(
:�
:�
:� 4�4�4�n.�.�.�b36�36�36�l���2o,�o,�o,�o,�o,�o,�o,�o,�d��
��hN�hN�hN�hN�hN�>�hN�hN���hN�V��H4�H4�H4�H4�H4�>�H4�H4���H4�V��������
)���J�J�J�J�J�J�J�J�ZI:�I:�I:�I:�I:�'�<�I:�I:�I:�X@)�@)�@)�@)�@)�K�@)�@)�@)�FO%�O%�O%�O%�O%�'�<�O%�O%�O%�d#2�#2�#2�#2�#2�#2�#2�#2�L(���'���o�o�o�o�o�o�o�o�d	f:�f:�f:�f:�f:�'�<�f:�f:�f:�RH:�H:�H:�H:�H:�K�H:�H:�H:�VY6�Y6�Y6�Y6�Y6�'�<�Y6�Y6�Y6�x*2�*2�*2�*2�*2�*2�*2�*2�Z(���'����r

?>