
^Wc           @  s  d  Z  d d l m Z d d l Z d d l Z d Z e f Z y e e f Z Wn e	 k
 r` n Xy
 e
 Z Wn) e	 k
 r e Z e e k s t  n Xd d d k r d   Z n	 d   Z y e j Z Wn e k
 r d	   Z n Xd
   Z e e d  r
d   Z n	 d   Z d d  Z d e f d     YZ d Z d Z d e f d     YZ d e f d     YZ d   Z e d  Z  d   Z! d   Z" d   Z# d   Z$ d   Z% d   Z& d    Z' d!   Z( d"   Z) d#   Z* d$ e f d%     YZ+ d& e+ f d'     YZ, d( e+ f d)     YZ- d* e f d+     YZ. d, e. e, f d-     YZ/ d. e/ f d/     YZ0 d0 e. e- f d1     YZ1 d2 e f d3     YZ2 e2 e/ _3 d4 e f d5     YZ4 d6 e4 e, f d7     YZ5 d8 e5 f d9     YZ6 d: e4 e- f d;     YZ7 d< e f d=     YZ8 e8 e5 _3 d S(>   u   A fast, lightweight IPv4/IPv6 manipulation library in Python.

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

i(   t   unicode_literalsNu   1.0.16t    i    c         C  s   |  S(   N(    (   t   byt(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _compat_bytes_to_byte_vals   s    c         C  s'   g  |  D] } t  j d |  d ^ q S(   Ns   !Bi    (   t   structt   unpack(   R   t   b(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   "   s    c         C  sP   | d k s t   d } x1 |  D]) } t | t  s: t   | d >| } q W| S(   Nu   bigi    i   (   t   AssertionErrort
   isinstancet   _compat_int_types(   t   bytvalst	   endianesst   rest   bv(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _compat_int_from_byte_vals'   s    c         C  s   t  |  t  s t  | d k s' t  | d k rm |  d k  sK |  d k r] t j d   n  t j d |   S| d k r |  d k  s |  d k r t j d
   n  t j d |  d ?|  d @ St    d  S(   Nu   bigi   i    i   i    u(   integer out of range for 'I' format codes   !Ii   i   u)   integer out of range for 'QQ' format codes   !QQi@   l    I       l	                    (   R   R	   R   R   t   errort   packt   NotImplementedError(   t   intvalt   lengthR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _compat_to_bytes0   s    u
   bit_lengthc         C  s
   |  j    S(   N(   t
   bit_length(   t   i(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _compat_bit_length?   s    c         C  s/   x( t  j   D] } |  | ?d k r | Sq Wd  S(   Ni    (   t	   itertoolst   count(   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   B   s    i   c         c  s>   | d k s t   |  } x | | k  r9 | V| | 7} q Wd  S(   Ni    (   R   (   t   startt   endt   stepR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _compat_rangeH   s
    t   _TotalOrderingMixinc           B  sD   e  Z d Z d    Z d   Z d   Z d   Z d   Z d   Z RS(   c         C  s
   t   d  S(   N(   R   (   t   selft   other(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __eq__W   s    c         C  s$   |  j  |  } | t k r t S| S(   N(   R!   t   NotImplemented(   R   R    t   equal(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __ne__Z   s    c         C  s
   t   d  S(   N(   R   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __lt__`   s    c         C  s3   |  j  |  } | t k s" | r/ |  j |  S| S(   N(   R%   R"   R!   (   R   R    t   less(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __le__c   s    c         C  sI   |  j  |  } | t k r t S|  j |  } | t k r> t S| pG | S(   N(   R%   R"   R!   (   R   R    R&   R#   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __gt__i   s    c         C  s$   |  j  |  } | t k r t S| S(   N(   R%   R"   (   R   R    R&   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __ge__r   s    (    (	   t   __name__t
   __module__t	   __slots__R!   R$   R%   R'   R(   R)   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   P   s   						i    i   t   AddressValueErrorc           B  s   e  Z d  Z RS(   u%   A Value Error related to the address.(   R*   R+   t   __doc__(    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR-   }   s   t   NetmaskValueErrorc           B  s   e  Z d  Z RS(   u%   A Value Error related to the netmask.(   R*   R+   R.   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR/      s   c         C  s   y t  |   SWn t t f k
 r' n Xy t |   SWn t t f k
 rO n Xt |  t  rr t d |    n  t d |    d S(   u  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

    ux   %r does not appear to be an IPv4 or IPv6 address. Did you pass in a bytes (str in Python 2) instead of a unicode object?u0   %r does not appear to be an IPv4 or IPv6 addressN(   t   IPv4AddressR-   R/   t   IPv6AddressR   t   bytest
   ValueError(   t   address(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt
   ip_address   s    c         C  s   y t  |  |  SWn t t f k
 r* n Xy t |  |  SWn t t f k
 rU n Xt |  t  rx t d |    n  t d |    d S(   u  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.

    ux   %r does not appear to be an IPv4 or IPv6 network. Did you pass in a bytes (str in Python 2) instead of a unicode object?u0   %r does not appear to be an IPv4 or IPv6 networkN(   t   IPv4NetworkR-   R/   t   IPv6NetworkR   R2   R3   (   R4   t   strict(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt
   ip_network   s    c         C  sd   y t  |   SWn t t f k
 r' n Xy t |   SWn t t f k
 rO n Xt d |    d S(   ug  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 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.

    u2   %r does not appear to be an IPv4 or IPv6 interfaceN(   t   IPv4InterfaceR-   R/   t   IPv6InterfaceR3   (   R4   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   ip_interface   s    c         C  sA   y t  |  d d  SWn& t j t f k
 r< t d   n Xd S(   u`  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.

    i   u   bigu&   Address negative or too large for IPv4N(   R   R   R   t   OverflowErrorR3   (   R4   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   v4_int_to_packed   s    c         C  sA   y t  |  d d  SWn& t j t f k
 r< t d   n Xd S(   u   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.

    i   u   bigu&   Address negative or too large for IPv6N(   R   R   R   R=   R3   (   R4   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   v6_int_to_packed  s    
c         C  s>   t  |   j d  } t |  d k r: t d |    n  | S(   uA   Helper to split the netmask and raise AddressValueError if neededu   /i   u   Only one '/' permitted in %r(   t   _compat_strt   splitt   lenR-   (   R4   t   addr(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _split_optional_netmask  s    c         c  sl   t  |   } t |  } } x> | D]6 } | j | j d k rS | | f V| } n  | } q# W| | f Vd S(   u   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.

    i   N(   t   itert   nextt   _ip(   t	   addressest   itt   firstt   lastt   ip(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _find_address_range  s    
	
c         C  s,   |  d k r | St  | t |  |  d @  S(   u   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.

    i    i   (   t   minR   (   t   numbert   bits(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _count_righthand_zero_bits0  s    c         c  sK  t  |  t  o t  | t  s- t d   n  |  j | j k rX t d |  | f   n  |  | k rs t d   n  |  j d k r t } n$ |  j d k r t } n t d   |  j } |  j } | j } xz | | k rFt	 t
 | |  t | | d  d  } | | | | f  } | V| d | >7} | d | j k r Pq q Wd S(	   u  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.

    u1   first and last must be IP addresses, not networksu%   %s and %s are not of the same versionu*   last IP address must be greater than firsti   i   u   unknown IP versioni   N(   R   t   _BaseAddresst	   TypeErrort   versionR3   R6   R7   t   _max_prefixlenRG   RN   RQ   R   t	   _ALL_ONES(   RJ   RK   RL   t   ip_bitst	   first_intt   last_intt   nbitst   net(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   summarize_address_range@  s0    					c         c  s   t  |   } i  } xm | r | j   } | j   } | j |  } | d k r[ | | | <q | | k r | | =| j |  q q Wd } xL t | j    D]8 } | d k	 r | j | j k r q q n  | V| } q Wd S(   uu  Loops 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(	   t   listt   popt   supernett   gett   Nonet   appendt   sortedt   valuest   broadcast_address(   RH   t   to_merget   subnetsR[   R_   t   existingRK   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _collapse_addresses_internalw  s$    		c         C  s  g  } g  } g  } x2|  D]*} t  | t  rw | rg | d j | j k rg t d | | d f   n  | j |  q | j | j k r | r | d j | j k r t d | | d f   n  y | j | j  WqCt k
 r | j | j	  qCXq | r6| d j | j k r6t d | | d f   n  | j |  q Wt
 t |   } | rx3 t |  D]" \ } } | j t | |   qlWn  t | |  S(   u  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.

    iu%   %s and %s are not of the same version(   R   RR   t   _versionRS   Rb   t
   _prefixlenRU   RL   t   AttributeErrort   network_addressRc   t   setRM   t   extendR\   Ri   (   RH   t   addrst   ipst   netsRL   RJ   RK   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   collapse_addresses  s4    c         C  s6   t  |  t  r |  j   St  |  t  r2 |  j   St S(   u2  Return 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.

    (   R   t   _BaseNetworkt   _get_networks_keyRR   t   _get_address_keyR"   (   t   obj(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   get_mixed_type_key  s
    

t   _IPAddressBasec           B  s   e  Z d  Z d Z e d    Z e d    Z e d    Z e d    Z d   Z	 d   Z
 e d    Z e d    Z e d	    Z e d
    Z e d    Z d   Z RS(   u   The mother class.c         C  s
   |  j    S(   u:   Return the longhand version of the IP address as a string.(   t   _explode_shorthand_ip_string(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   exploded  s    c         C  s
   t  |   S(   u;   Return the shorthand version of the IP address as a string.(   R@   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt
   compressed  s    c         C  s
   |  j    S(   uI  The 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'

        (   t   _reverse_pointer(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   reverse_pointer  s    	c         C  s#   d t  |   f } t |   d  S(   Nu   %200s has no version specified(   t   typeR   (   R   t   msg(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRT     s    c         C  si   | d k  r. d } t  | | |  j f   n  | |  j k re d } t  | | |  j |  j f   n  d  S(   Ni    u-   %d (< 0) is not permitted as an IPv%d addressu2   %d (>= 2**%d) is not permitted as an IPv%d address(   R-   Rj   RV   RU   (   R   R4   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _check_int_address  s    c         C  sD   t  |  } | | k r@ d } t | | | | |  j f   n  d  S(   Nu~   %r (len %d != %d) is not permitted as an IPv%d address. Did you pass in a bytes (str in Python 2) instead of a unicode object?(   RB   R-   Rj   (   R   R4   t   expected_lent   address_lenR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _check_packed_address   s
    c         C  s   |  j  |  j  | ?AS(   u   Turn the prefix length into a bitwise netmask

        Args:
            prefixlen: An integer, the prefix length.

        Returns:
            An integer.

        (   RV   (   t   clst	   prefixlen(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _ip_int_from_prefix+  s    c   	      C  s   t  | |  j  } |  j | } | | ?} d | >d } | | k r{ |  j d } t | | d  } d } t | |   n  | S(   u  Return 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
        i   i   u   bigu&   Netmask pattern %r mixes zeroes & ones(   RQ   RU   R   R3   (	   R   t   ip_intt   trailing_zeroesR   t   leading_onest   all_onest   byteslent   detailsR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _prefix_from_ip_int8  s    
c         C  s   d | } t  |   d  S(   Nu   %r is not a valid netmask(   R/   (   R   t   netmask_strR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _report_invalid_netmaskQ  s    
c         C  s   t  j j |  s" |  j |  n  y t |  } Wn t k
 rR |  j |  n Xd | k om |  j k n s |  j |  n  | S(   u	  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
        i    (   t   _BaseV4t   _DECIMAL_DIGITSt
   issupersetR   t   intR3   RU   (   R   t   prefixlen_strR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _prefix_from_prefix_stringV  s    c         C  s   y |  j  |  } Wn t k
 r3 |  j |  n Xy |  j |  SWn t k
 rX n X| |  j N} y |  j |  SWn t k
 r |  j |  n Xd S(   u  Turn 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(   t   _ip_int_from_stringR-   R   R   R3   RV   (   R   t   ip_strR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _prefix_from_ip_stringo  s    c         C  s   |  j  t |   f f S(   N(   t	   __class__R@   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt
   __reduce__  s    (    (   R*   R+   R.   R,   t   propertyR{   R|   R~   RT   R   R   t   classmethodR   R   R   R   R   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRy     s   			"RR   c           B  sn   e  Z d  Z d Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d	   Z d
   Z RS(   u   A generic IP object.

    This IP class contains the version independent methods which are
    used by single IP addresses.
    c         C  s   |  j  S(   N(   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __int__  s    c         C  s?   y& |  j  | j  k o$ |  j | j k SWn t k
 r: t SXd  S(   N(   RG   Rj   Rl   R"   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR!     s
    c         C  s   t  | t  s t St  | t  s; t d |  | f   n  |  j | j k rf t d |  | f   n  |  j | j k r |  j | j k  St S(   Nu"   %s and %s are not of the same typeu%   %s and %s are not of the same version(   R   Ry   R"   RR   RS   Rj   RG   t   False(   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR%     s    c         C  s*   t  | t  s t S|  j t |   |  S(   N(   R   R	   R"   R   R   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __add__  s    c         C  s*   t  | t  s t S|  j t |   |  S(   N(   R   R	   R"   R   R   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __sub__  s    c         C  s   d |  j  j t |   f S(   Nu   %s(%r)(   R   R*   R@   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __repr__  s    c         C  s   t  |  j |  j   S(   N(   R@   t   _string_from_ip_intRG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __str__  s    c         C  s   t  t t |  j    S(   N(   t   hasht   hexR   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __hash__  s    c         C  s   |  j  |  f S(   N(   Rj   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRv     s    c         C  s   |  j  |  j f f S(   N(   R   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    (    (   R*   R+   R.   R,   R   R!   R%   R   R   R   R   R   Rv   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRR     s   									Rt   c           B  s  e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z e d    Z d   Z d   Z d   Z d d# d  Z d d# d  Z e d    Z d   Z d   Z e d    Z  e d    Z! e d    Z" e d     Z# e d!    Z$ e d"    Z% RS($   u~   A generic IP network object.

    This IP class contains the version independent methods which are
    used by networks.

    c         C  s   i  |  _  d  S(   N(   t   _cache(   R   R4   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __init__  s    c         C  s   d |  j  j t |   f S(   Nu   %s(%r)(   R   R*   R@   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   d |  j  |  j f S(   Nu   %s/%d(   Rm   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         c  sN   t  |  j  } t  |  j  } x) t | d |  D] } |  j |  Vq2 Wd S(   u   Generate Iterator over usable hosts in a network.

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

        i   N(   R   Rm   Re   R   t   _address_class(   R   t   networkt	   broadcastt   x(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   hosts  s    c         c  sN   t  |  j  } t  |  j  } x) t | | d  D] } |  j |  Vq2 Wd  S(   Ni   (   R   Rm   Re   R   R   (   R   R   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __iter__  s    c         C  s   t  |  j  } t  |  j  } | d k rT | | | k rC t  n  |  j | |  S| d 7} | | | k  rw t  n  |  j | |  Sd  S(   Ni    i   (   R   Rm   Re   t
   IndexErrorR   (   R   t   nR   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __getitem__  s    	
	c         C  s   t  | t  s t St  | t  s; t d |  | f   n  |  j | j k rf t d |  | f   n  |  j | j k r |  j | j k  S|  j | j k r |  j | j k  St S(   Nu"   %s and %s are not of the same typeu%   %s and %s are not of the same version(	   R   Ry   R"   Rt   RS   Rj   Rm   t   netmaskR   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR%     s    c         C  s]   yD |  j  | j  k oB |  j | j k oB t |  j  t | j  k SWn t k
 rX t SXd  S(   N(   Rj   Rm   R   R   Rl   R"   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR!     s     c         C  s    t  t |  j  t |  j  A S(   N(   R   R   Rm   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s`   |  j  | j  k r t St | t  r) t St |  j  t | j  k oY t |  j  k SSd  S(   N(   Rj   R   R   Rt   R   Rm   RG   Re   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   __contains__  s     c         C  s:   |  j  | k p9 |  j | k p9 | j  |  k p9 | j |  k S(   u*   Tell if self is partly contained in other.(   Rm   Re   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   overlaps)  s    c         C  sW   |  j  j d  } | d  k rS |  j t |  j  t |  j  B } | |  j  d <n  | S(   Nu   broadcast_address(   R   R`   Ra   R   R   Rm   t   hostmask(   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRe   0  s    c         C  sQ   |  j  j d  } | d  k rM |  j t |  j  |  j A } | |  j  d <n  | S(   Nu   hostmask(   R   R`   Ra   R   R   R   RV   (   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   9  s
    c         C  s   d |  j  |  j f S(   Nu   %s/%d(   Rm   Rk   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   with_prefixlenA  s    c         C  s   d |  j  |  j f S(   Nu   %s/%s(   Rm   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   with_netmaskE  s    c         C  s   d |  j  |  j f S(   Nu   %s/%s(   Rm   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   with_hostmaskI  s    c         C  s   t  |  j  t  |  j  d S(   u&   Number of hosts in the current subnet.i   (   R   Re   Rm   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   num_addressesM  s    c         C  s#   d t  |   f } t |   d  S(   Nu%   %200s has no associated address class(   R   R   (   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   R  s    c         C  s   |  j  S(   N(   Rk   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   Z  s    c         c  s  |  j  | j  k s+ t d |  | f   n  t | t  sM t d |   n  | j |   su t d | |  f   n  | |  k r d S| j d | j | j f  } |  j	   \ } } x | | k r?| | k r?| j |  r | V| j	   \ } } q | j |  r#| V| j	   \ } } q t
 d | | | f   q W| | k rT| Vn- | | k rh| Vn t
 d | | | f   d S(   u  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')
            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')
            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.

        u%   %s and %s are not of the same versionu   %s is not a network objectu   %s not contained in %sNu   %s/%su3   Error performing exclusion: s1: %s s2: %s other: %s(   Rj   RS   R   Rt   t	   subnet_ofR3   R   Rm   R   Rg   R   (   R   R    t   s1t   s2(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   address_exclude^  s6    $c         C  s   |  j  | j  k r+ t d |  | f   n  |  j | j k  rA d S|  j | j k rW d S|  j | j k  rm d S|  j | j k r d Sd S(   u  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.

        u"   %s and %s are not of the same typeii   i    (   Rj   RS   Rm   R   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   compare_networks  s    !c         C  s   |  j  |  j |  j f S(   u   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().

        (   Rj   Rm   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRu     s    i   c   	      c  s0  |  j  |  j k r |  Vd S| d k	 rp | |  j  k  rE t d   n  | d k r` t d   n  | |  j  } n  | d k  r t d   n  |  j  | } | |  j k r t d | |  f   n  t |  j  } t |  j  } t |  j  d | ?} x4 t | | |  D]  } |  j	 | | f  } | VqWd S(   u  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)

        Nu   new prefix must be longeri   u(   cannot set prefixlen_diff and new_prefixi    u   prefix length diff must be > 0u0   prefix length diff %d is invalid for netblock %s(
   Rk   RU   Ra   R3   R   Rm   Re   R   R   R   (	   R   t   prefixlen_difft
   new_prefixt   new_prefixlenR   R   R   t   new_addrt   current(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRg     s,    c         C  s   |  j  d k r |  S| d k	 rh | |  j  k r= t d   n  | d k rX t d   n  |  j  | } n  |  j | } | d k  r t d |  j | f   n  |  j t |  j  t |  j  | >@| f  S(   u  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)

        i    u   new prefix must be shorteri   u(   cannot set prefixlen_diff and new_prefixu;   current prefixlen is %d, cannot have a prefixlen_diff of %dN(   Rk   Ra   R3   R   R   R   Rm   R   (   R   R   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR_     s     c         C  s   |  j  j o |  j j S(   u   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.

        (   Rm   t   is_multicastRe   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   A  s    	c         C  sp   |  j  | j  k r t St | d  rV t | d  rV | j |  j k oU | j |  j k St d t |    d  S(   Nu   network_addressu   broadcast_addressu9   Unable to test subnet containment with element of type %s(   Rj   R   t   hasattrRm   Re   RS   R   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   M  s    c         C  sp   |  j  | j  k r t St | d  rV t | d  rV | j |  j k oU | j |  j k St d t |    d  S(   Nu   network_addressu   broadcast_addressu9   Unable to test subnet containment with element of type %s(   Rj   R   R   Rm   Re   RS   R   (   R   R    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   supernet_of[  s    c         C  s   |  j  j o |  j j S(   u   Test if the address is otherwise IETF reserved.

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

        (   Rm   t   is_reservedRe   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   i  s    	c         C  s   |  j  j o |  j j S(   u   Test if the address is reserved for link-local.

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

        (   Rm   t   is_link_localRe   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   u  s    c         C  s   |  j  j o |  j j S(   u   Test if this address is allocated for private networks.

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

        (   Rm   t
   is_privateRe   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   |  j  S(   u   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.

        (   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt	   is_global  s    	c         C  s   |  j  j o |  j j S(   u   Test if the address is unspecified.

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

        (   Rm   t   is_unspecifiedRe   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   |  j  j o |  j j S(   u   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.

        (   Rm   t   is_loopbackRe   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	N(&   R*   R+   R.   R   R   R   R   R   R   R%   R!   R   R   R   R   Re   R   R   R   R   R   R   R   R   R   Ru   Ra   Rg   R_   R   R   R   R   R   R   R   R   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRt     sD   													K	0	
5)		R   c        
   B  s   e  Z d  Z d Z d Z d e d Z e d  Z e d d d d d	 d
 d d d g	  Z	 e Z
 i  Z d   Z e d    Z e d    Z e d    Z e d    Z d   Z d   Z e d    Z e d    Z RS(   uy   Base IPv4 object.

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

    i   i   i   u
   0123456789i   i   i   i   i   i   i   i   i    c         C  s
   t  |   S(   N(   R@   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRz     s    c         C  s   | |  j  k r t | t  r' | } n6 y |  j |  } Wn  t k
 r\ |  j |  } n Xt |  j |   } | | f |  j  | <n  |  j  | S(   u  Make 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")
        (   t   _netmask_cacheR   R	   R   R/   R   R0   R   (   R   t   argR   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _make_netmask  s    		c         C  s   | s t  d   n  | j d  } t |  d k rI t  d |   n  y t t |  j |  d  SWn) t k
 r } t  d | | f   n Xd S(   u  Turn 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.

        u   Address cannot be emptyu   .i   u   Expected 4 octets in %ru   bigu   %s in %rN(   R-   RA   RB   R   t   mapt   _parse_octetR3   (   R   R   t   octetst   exc(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   | s t  d   n  |  j j |  s@ d } t  | |   n  t |  d k rk d } t  | |   n  t | d  } | d k r | d d k r d	 } t  | |   n  | d
 k r t  d |   n  | S(   u  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].

        u   Empty octet not permittedu#   Only decimal digits permitted in %ri   u$   At most 3 characters permitted in %ri
   i   i    u   0u3   Ambiguous (octal/decimal) value in %r not permittedi   u   Octet %d (> 255) not permitted(   R3   R   R   RB   R   (   R   t	   octet_strR   t	   octet_int(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s#   d j  d   t | d d  D  S(   u   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.

        u   .c         s  s@   |  ]6 } t  t | t  r1 t j d  |  d n |  Vq d S(   s   !Bi    N(   R@   R   R2   R   R   (   t   .0R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pys	   <genexpr>-  s   i   u   big(   t   joinR   (   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   "  s    c         C  s   | j  d  } y5 g  t t |  D] } | |  j k r" | ^ q" } Wn t k
 rX t SXt |  t |  k ru t S| d | d k  r t St S(   u   Test if the IP string is a hostmask (rather than a netmask).

        Args:
            ip_str: A string, the potential hostmask.

        Returns:
            A boolean, True if the IP string is a hostmask.

        u   .i    i(   RA   R   R   t   _valid_mask_octetsR3   R   RB   t   True(   R   R   RP   R   t   parts(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _is_hostmask2  s    
5c         C  s3   t  |   j d  d d d  } d j |  d S(   u   Return the reverse DNS pointer name for the IPv4 address.

        This implements the method described in RFC1035 3.5.

        u   .Niu   .in-addr.arpa(   R@   RA   R   (   R   t   reverse_octets(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR}   G  s    "c         C  s   |  j  S(   N(   RU   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   max_prefixlenP  s    c         C  s   |  j  S(   N(   Rj   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRT   T  s    (    (   R*   R+   R.   R,   Rj   t
   IPV4LENGTHRV   t	   frozensetR   R   RU   R   Rz   R   R   R   R   R   R   R}   R   R   RT   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s"   '	%			R0   c           B  s   e  Z d  Z d Z d   Z e d    Z e d    Z e d    Z e d    Z	 e d    Z
 e d	    Z e d
    Z RS(   u/   Represent and manipulate single IPv4 Addresses.u   _ipu   __weakref__c         C  s   t  | t  r) |  j |  | |  _ d St  | t  rj |  j | d  t |  } t | d  |  _ d St |  } d | k r t	 d |   n  |  j
 |  |  _ d S(   u  
        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.

        Ni   u   bigu   /u   Unexpected '/' in %r(   R   R	   R   RG   R2   R   R   R   R@   R-   R   (   R   R4   t   bvst   addr_str(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   _  s    	c         C  s   t  |  j  S(   u*   The binary representation of this address.(   R>   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   packed  s    c         C  s   |  |  j  j k S(   u   Test if the address is otherwise IETF reserved.

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

        (   t
   _constantst   _reserved_network(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c           s    t    f d     j j D  S(   u   Test if this address is allocated for private networks.

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

        c         3  s   |  ] }   | k Vq d  S(   N(    (   R   R[   (   R   (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pys	   <genexpr>  s    (   t   anyR   t   _private_networks(   R   (    (   R   sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   |  |  j  j k S(   u   Test if the address is reserved for multicast use.

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

        (   R   t   _multicast_network(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   |  |  j  j k S(   u   Test if the address is unspecified.

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

        (   R   t   _unspecified_address(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   |  |  j  j k S(   u   Test if the address is a loopback address.

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

        (   R   t   _loopback_network(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   |  |  j  j k S(   u   Test if the address is reserved for link-local.

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

        (   R   t   _linklocal_network(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    (   u   _ipu   __weakref__(   R*   R+   R.   R,   R   R   R   R   R   R   R   R   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR0   Y  s   	$
R:   c           B  sz   e  Z d    Z d   Z d   Z d   Z d   Z e j Z e	 d    Z
 e	 d    Z e	 d    Z e	 d    Z RS(	   c         C  s;  t  | t t f  rG t j |  |  t |  j  |  _ |  j |  _	 d  St  | t
  r t j |  | d  t |  d k r t | d  |  _	 n |  j |  _	 t | d t |  _ |  j j |  _ |  j j |  _ d  St |  } t j |  | d  t | d t |  _ |  j j	 |  _	 |  j j |  _ |  j j |  _ d  S(   Ni    i   R8   (   R   R2   R	   R0   R   R6   RG   R   RU   Rk   t   tupleRB   R   R   R   R   RD   (   R   R4   RC   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s(    c         C  s    d |  j  |  j  |  j j f S(   Nu   %s/%d(   R   RG   R   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  sV   t  j |  |  } | s% | t k r) | Sy |  j | j k SWn t k
 rQ t SXd  S(   N(   R0   R!   R"   R   Rl   R   (   R   R    t   address_equal(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR!     s    c         C  sO   t  j |  |  } | t k r" t Sy |  j | j k  SWn t k
 rJ t SXd  S(   N(   R0   R%   R"   R   Rl   R   (   R   R    t   address_less(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR%     s    c         C  s   |  j  |  j At |  j j  AS(   N(   RG   Rk   R   R   Rm   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   t  |  j  S(   N(   R0   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRL     s    c         C  s   d |  j  |  j  |  j f S(   Nu   %s/%s(   R   RG   Rk   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   d |  j  |  j  |  j f S(   Nu   %s/%s(   R   RG   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   d |  j  |  j  |  j f S(   Nu   %s/%s(   R   RG   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    (   R*   R+   R   R   R!   R%   R   Ry   R   R   RL   R   R   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR:     s   						R6   c           B  s/   e  Z d  Z e Z e d  Z e d    Z RS(   ue  This 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

    c         C  s  t  j |  |  t | t t f  rV t |  |  _ |  j |  j  \ |  _	 |  _
 d St | t  rt |  d k r | d } n	 |  j } t | d  |  _ |  j |  \ |  _	 |  _
 t |  j  } | t |  j	  @| k r| r t d |    qt | t |  j	  @ |  _ n  d St |  } t |  j | d   |  _ t |  d k rf| d } n	 |  j } |  j |  \ |  _	 |  _
 | rt t |  j  t |  j	  @ |  j k rt d |    qn  t t |  j  t |  j	  @ |  _ |  j
 |  j d k r|  j |  _ n  d S(   u  Instantiate 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.0.2/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.

        Ni   i    u   %s has host bits seti   (   Rt   R   R   R	   R2   R0   Rm   R   RU   R   Rk   R   RB   R   R3   RD   R   R   R   (   R   R4   R8   R   R   RC   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   *  sB    %		c         C  s3   |  j  t d  k o' |  j t d  k o2 |  j S(   u   Test if this address is allocated for public networks.

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

        u   100.64.0.0/10(   Rm   R6   Re   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	(	   R*   R+   R.   R0   R   R   R   R   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR6     s   Ut   _IPv4Constantsc           B  s   e  Z e d   Z e d  Z e d  Z e d  e d  e d  e d   e d  e d  e d  e d  e d	  e d
  e d  e d  e d  e d  g Z e d  Z e d  Z	 RS(   u   169.254.0.0/16u   127.0.0.0/8u   224.0.0.0/4u	   0.0.0.0/8u
   10.0.0.0/8u   172.16.0.0/12u   192.0.0.0/29u   192.0.0.170/31u   192.0.2.0/24u   192.168.0.0/16u   198.18.0.0/15u   198.51.100.0/24u   203.0.113.0/24u   240.0.0.0/4u   255.255.255.255/32u   0.0.0.0(
   R*   R+   R6   R   R   R   R   R   R0   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s&   													t   _BaseV6c           B  s   e  Z d  Z d Z d Z d e d Z d Z e d  Z	 e Z
 i  Z e d    Z e d    Z e d    Z e d	    Z e d d
   Z d   Z d   Z e d    Z e d    Z RS(   uy   Base IPv6 object.

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

    i   i   i   i   u   0123456789ABCDEFabcdefc         C  sl   | |  j  k ra t | t  r' | } n |  j |  } t |  j |   } | | f |  j  | <n  |  j  | S(   u  Make 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   R   R	   R   R1   R   (   R   R   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    		c         C  s  | s t  d   n  | j d  } d } t |  | k  r[ d | | f } t  |   n  d | d k r y t | j    j } Wn) t  k
 r } t  d | | f   n X| j d | d	 ?d
 @ | j d | d
 @ n  |  j d } t |  | k r#d | d | f } t  |   n  d } xY t	 d t |  d  D]> }	 | |	 sC| d k	 rxd | } t  |   n  |	 } qCqCW| d k	 r]| }
 t |  | d } | d s|
 d 8}
 |
 rd } t  | |   qn  | d s| d 8} | rd } t  | |   qn  |  j |
 | } | d k  rd } t  | |  j d | f   qn t |  |  j k rd } t  | |  j | f   n  | d sd } t  | |   n  | d sd } t  | |   n  t |  }
 d } d } y d } x5 t
 |
  D]' }	 | d	 K} | |  j | |	  O} qW| d	 | K} x9 t
 | d  D]' }	 | d	 K} | |  j | |	  O} qRW| SWn) t k
 r} t  d | | f   n Xd S(   u   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.

        u   Address cannot be emptyu   :i   u    At least %d parts expected in %ru   .iu   %s in %ru   %xi   i  i   u!   At most %d colons permitted in %ru    At most one '::' permitted in %ri    u0   Leading ':' only permitted as part of '::' in %ru1   Trailing ':' only permitted as part of '::' in %ru/   Expected at most %d other parts with '::' in %ru,   Exactly %d parts expected without '::' in %rN(   R-   RA   RB   R0   R^   RG   Rb   t   _HEXTET_COUNTRa   R   t   ranget   _parse_hextetR3   (   R   R   R   t
   _min_partsR   t   ipv4_intR   t
   _max_partst
   skip_indexR   t   parts_hit   parts_lot   parts_skippedR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s     





#



c         C  s]   |  j  j |  s% t d |   n  t |  d k rP d } t | |   n  t | d  S(   u&  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].

        u   Only hex digits permitted in %ri   u$   At most 4 characters permitted in %ri   (   t   _HEX_DIGITSR   R3   RB   R   (   R   t
   hextet_strR   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   =  s    c   	      C  s   d } d } d } d } xo t  |  D]a \ } } | d k rz | d 7} | d k r\ | } n  | | k r | } | } q q% d } d } q% W| d k r | | } | t |  k r | d g 7} n  d g | | | +| d k r d g | } q n  | S(   u  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.

        ii    u   0i   u    (   t	   enumerateRB   (	   R   t   hextetst   best_doublecolon_startt   best_doublecolon_lent   doublecolon_startt   doublecolon_lent   indext   hextett   best_doublecolon_end(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   _compress_hextetsW  s.    
	
c         C  s   | d	 k r t |  j  } n  | |  j k r< t d   n  d | } g  t d d d  D]$ } d t | | | d !d  ^ qY } |  j |  } d j |  S(
   u,  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.

        u   IPv6 address is too largeu   %032xi    i    i   u   %xi   u   :N(   Ra   R   RG   RV   R3   R   R  R   (   R   R   t   hex_strR   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    
=c         C  s   t  |  t  r! t |  j  } n- t  |  t  rB t |  j  } n t |   } |  j |  } d | } g  t d d d  D] } | | | d !^ qz } t  |  t t f  r d d j	 |  |  j
 f Sd j	 |  S(   u   Expand a shortened IPv6 address.

        Args:
            ip_str: A string, the IPv6 address.

        Returns:
            A string, the expanded IPv6 address.

        u   %032xi    i    i   u   %s/%du   :(   R   R7   R@   Rm   R;   RL   R   R   Rt   R   Rk   (   R   R   R   R  R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRz     s    

0c         C  s3   |  j  d d d  j d d  } d j |  d S(   u   Return the reverse DNS pointer name for the IPv6 address.

        This implements the method described in RFC3596 2.5.

        Niu   :u    u   .u	   .ip6.arpa(   R{   t   replaceR   (   R   t   reverse_chars(    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR}     s    "c         C  s   |  j  S(   N(   RU   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   |  j  S(   N(   Rj   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRT     s    (    N(   R*   R+   R.   R,   Rj   t
   IPV6LENGTHRV   R   R   R   RU   R   R   R   R   R   R  Ra   R   Rz   R}   R   R   RT   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s$   i0			R1   c           B  s   e  Z d  Z d Z d   Z e d    Z e d    Z e d    Z e d    Z	 e d    Z
 e d	    Z e d
    Z e d    Z e d    Z e d    Z e d    Z e d    Z RS(   u/   Represent and manipulate single IPv6 Addresses.u   _ipu   __weakref__c         C  s   t  | t  r) |  j |  | |  _ d St  | t  rj |  j | d  t |  } t | d  |  _ d St |  } d | k r t	 d |   n  |  j
 |  |  _ d S(   u  Instantiate 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.

        Ni   u   bigu   /u   Unexpected '/' in %r(   R   R	   R   RG   R2   R   R   R   R@   R-   R   (   R   R4   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   t  |  j  S(   u*   The binary representation of this address.(   R?   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   |  |  j  j k S(   u   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.

        (   R   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c           s    t    f d     j j D  S(   u   Test if the address is otherwise IETF reserved.

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

        c         3  s   |  ] }   | k Vq d  S(   N(    (   R   R   (   R   (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pys	   <genexpr>  s    (   R   R   t   _reserved_networks(   R   (    (   R   sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    	c         C  s   |  |  j  j k S(   u   Test if the address is reserved for link-local.

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

        (   R   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   |  |  j  j k S(   u`  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.

        (   R   t   _sitelocal_network(   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   is_site_local  s    c           s    t    f d     j j D  S(   u   Test if this address is allocated for private networks.

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

        c         3  s   |  ] }   | k Vq d  S(   N(    (   R   R[   (   R   (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pys	   <genexpr>2  s    (   R   R   R   (   R   (    (   R   sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   )  s    	c         C  s   |  j  S(   u   Test if this address is allocated for public networks.

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

        (   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   4  s    	c         C  s   |  j  d k S(   u   Test if the address is unspecified.

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

        i    (   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   ?  s    	c         C  s   |  j  d k S(   u   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.

        i   (   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   J  s    	c         C  s(   |  j  d ?d k r d St |  j  d @ S(   u   Return the IPv4 mapped address.

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

        i    i  I    N(   RG   Ra   R0   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   ipv4_mappedU  s    	c         C  s@   |  j  d ?d k r d St |  j  d ?d @ t |  j  d @ f S(   u   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`   i   i@   I    N(   RG   Ra   R0   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   teredob  s    
c         C  s,   |  j  d ?d k r d St |  j  d ?d @ S(   u   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.

        ip   i   iP   I    N(   RG   Ra   R0   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt	   sixtofourq  s    	(   u   _ipu   __weakref__(   R*   R+   R.   R,   R   R   R   R   R   R   R  R   R   R   R   R  R  R  (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR1     s   	%
R;   c           B  s   e  Z d    Z d   Z d   Z d   Z d   Z e j Z e	 d    Z
 e	 d    Z e	 d    Z e	 d    Z e	 d	    Z e	 d
    Z RS(   c         C  s;  t  | t t f  rG t j |  |  t |  j  |  _ |  j |  _	 d  St  | t
  r t j |  | d  t |  d k r t | d  |  _	 n |  j |  _	 t | d t |  _ |  j j |  _ |  j j |  _ d  St |  } t j |  | d  t | d t |  _ |  j j |  _ |  j j	 |  _	 |  j j |  _ d  S(   Ni    i   R8   (   R   R2   R	   R1   R   R7   RG   R   RU   Rk   R   RB   R   R   R   R   RD   (   R   R4   RC   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s(    c         C  s    d |  j  |  j  |  j j f S(   Nu   %s/%d(   R   RG   R   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  sV   t  j |  |  } | s% | t k r) | Sy |  j | j k SWn t k
 rQ t SXd  S(   N(   R1   R!   R"   R   Rl   R   (   R   R    R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR!     s    c         C  sO   t  j |  |  } | t k r" t Sy |  j | j k  SWn t k
 rJ t SXd  S(   N(   R1   R%   R"   R   Rl   R   (   R   R    R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR%     s    c         C  s   |  j  |  j At |  j j  AS(   N(   RG   Rk   R   R   Rm   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   t  |  j  S(   N(   R1   RG   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyRL     s    c         C  s   d |  j  |  j  |  j f S(   Nu   %s/%s(   R   RG   Rk   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   d |  j  |  j  |  j f S(   Nu   %s/%s(   R   RG   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   d |  j  |  j  |  j f S(   Nu   %s/%s(   R   RG   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   |  j  d k o |  j j S(   Ni    (   RG   R   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    c         C  s   |  j  d k o |  j j S(   Ni   (   RG   R   R   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     s    (   R*   R+   R   R   R!   R%   R   Ry   R   R   RL   R   R   R   R   R   (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR;     s   						R7   c           B  s8   e  Z d  Z e Z e d  Z d   Z e d    Z	 RS(   uv  This 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

    c         C  s  t  j |  |  t | t t f  rV t |  |  _ |  j |  j  \ |  _	 |  _
 d St | t  rt |  d k r | d } n	 |  j } |  j |  \ |  _	 |  _
 t | d  |  _ t |  j  } | t |  j	  @| k r| r t d |    qt | t |  j	  @ |  _ n  d St |  } t |  j | d   |  _ t |  d k rf| d } n	 |  j } |  j |  \ |  _	 |  _
 | rt t |  j  t |  j	  @ |  j k rt d |    qn  t t |  j  t |  j	  @ |  _ |  j
 |  j d k r|  j |  _ n  d S(   u  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.

        Ni   i    u   %s has host bits seti   (   Rt   R   R   R2   R	   R1   Rm   R   RU   R   Rk   R   RB   R   R3   RD   R   R   R   (   R   R4   R8   R   R   RC   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR     sB     		c         c  sR   t  |  j  } t  |  j  } x- t | d | d  D] } |  j |  Vq6 Wd S(   u   Generate Iterator over usable hosts in a network.

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

        i   N(   R   Rm   Re   R   R   (   R   R   R   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR   4	  s    c         C  s   |  j  j o |  j j S(   u`  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.

        (   Rm   R  Re   (   R   (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR  @	  s    (
   R*   R+   R.   R1   R   R   R   R   R   R  (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR7     s
   O	t   _IPv6Constantsc           B  s  e  Z e d   Z e d  Z e d  e d  e d  e d  e d  e d  e d  e d	  e d
  e d   g
 Z e d  e d  e d  e d  e d  e d  e d  e d  e d  e d  e d  e d  e d  e d  e d  g Z e d  Z RS(   u	   fe80::/10u   ff00::/8u   ::1/128u   ::/128u   ::ffff:0:0/96u   100::/64u	   2001::/23u   2001:2::/48u   2001:db8::/32u   2001:10::/28u   fc00::/7u   ::/8u   100::/8u   200::/7u   400::/6u   800::/5u   1000::/4u   4000::/3u   6000::/3u   8000::/3u   A000::/3u   C000::/3u   E000::/4u   F000::/5u   F800::/6u   FE00::/9u	   fec0::/10(   R*   R+   R7   R   R   R   R  R  (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyR  P	  s*   									(9   R.   t
   __future__R    R   R   t   __version__R   R	   t   longt	   NameErrort   unicodeR@   t   strR2   R   R   t
   from_bytesR   Rl   R   R   R   R   t   objectR   R   R
  R3   R-   R/   R5   R   R9   R<   R>   R?   RD   RM   RQ   R\   Ri   Rs   Rx   Ry   RR   Rt   R   R0   R:   R6   R   R   R   R1   R;   R7   R  (    (    (    sf   /private/var/folders/3n/6h2rwf155rn1m71wwyxn79n80000gn/T/pip-build-IcAT_k/pip/pip/_vendor/ipaddress.pyt   <module>	   sx   	
				)	$$	#						7	1	6	= pRr	 V{!