Ë
    øÕñ^Úg  ã                   óf   — d Z ddlZddlmZmZmZmZmZm	Z	 ddl
mZmZmZ d„ Zd„ Z G d„ de«      Zy)	z2Set based operations for IP addresses and subnets.é    N)Ú	IPNetworkÚ	IPAddressÚIPRangeÚ
cidr_mergeÚcidr_excludeÚiprange_to_cidrs)Ú_sys_maxintÚ
_dict_keysÚ	_int_typec                 ó,  — | j                   j                  }||   }|j                  | j                  kD  r+|j                  || j                  |j                  dz
  f«       |dz  }|}|t	        |«      k  rk||   }|| vrna|j
                  dz   |j                  k(  rn.|j                  ||j
                  dz   |j                  dz
  f«       |dz  }|}|t	        |«      k  rŒk|j
                  dz   }| j
                  }	||	k  r|j                  |||	f«       |S )a®  Calculate IPSet([supernet]) - IPSet(subnets).

    Assumptions: subnets is sorted, subnet_idx points to the first
    element in subnets that is a subnet of supernet.

    Results are appended to the ranges parameter as tuples of in format
    (version, first, last). Return value is the first subnet_idx that
    does not point to a subnet of supernet (or len(subnets) if all
    subsequents items are a subnet of supernet).
    é   )Ú_moduleÚversionÚfirstÚappendÚlenÚlast)
ÚsupernetÚsubnetsÚ
subnet_idxÚrangesr   ÚsubnetÚprev_subnetÚ
cur_subnetr   r   s
             ú1/usr/lib/python3/dist-packages/netaddr/ip/sets.pyÚ	_subtractr      s  € ð ×Ñ×&Ñ&€GØ�ZÑ €FØ‡|�|�h—n‘nÒ$Ø�‰�w §¡°·±¸qÑ0@ÐAÔBà�!�O€JØ€KØ
”s˜7“|Ò
#Ø˜ZÑ(ˆ
à˜XÑ%ØØ×Ñ˜aÑ :×#3Ñ#3Ò3àà�M‰M˜7 K×$4Ñ$4°qÑ$8¸*×:JÑ:JÈQÑ:NÐOÔPà�a‰ˆ
Ø ˆð ”s˜7“|Ó
#ð ×Ñ˜qÑ €EØ�=‰=€DØ�‚}Ø�‰�w  tÐ,Ô-àÐó    c              #   óÔ   K  — | sy| d   \  }}}| dd D ]6  \  }}}||dz   k(  r||k(  r|}Œt        ||«      t        ||«      f–— |}|}|}Œ8 t        ||«      t        ||«      f–— y­w)aq  Iterate over sorted_ranges, merging where possible

    Sorted ranges must be a sorted iterable of (version, first, last) tuples.
    Merging occurs for pairs like [(4, 10, 42), (4, 43, 100)] which is merged
    into (4, 10, 100), and leads to return value
    ( IPAddress(10, 4), IPAddress(100, 4) ), which is suitable input for the
    iprange_to_cidrs function.
    Nr   r   )r   )Úsorted_rangesÚcurrent_versionÚcurrent_startÚcurrent_stopÚnext_versionÚ
next_startÚ	next_stops          r   Ú_iter_merged_rangesr&   8   s¥   è ø€ ñ Øà3@ÀÑ3CÑ0€O�] Là/<¸Q¸RÐ/@ò 
'Ñ+ˆ�j )Ø˜¨Ñ)Ò)¨l¸oÒ.Mà$ˆLØä˜¨Ó8Ü˜ Ó7ð9ò 	9à"ˆØ ˆØ&‰ð
'ô �] OÓ4Ü�\ ?Ó3ð5ó 5ùs   ‚A&A(c                   ó  — e Zd ZdZdZd%d„Zd„ Zd„ Zd„ Zd„ Z	d	„ Z
d
„ Zd„ ZeZd„ Zd„ Zd&d„Zd&d„Zd„ Zd„ Zd„ Zd&d„Zd„ Zd„ Zd„ Zd„ Zd„ ZeZd„ Zd„ ZeZd„ ZeZ d„ Z!e!Z"d„ Z#e#Z$d„ Z%e%Z&d„ Z'e(d „ «       Z)d!„ Z*e*Z+d"„ Z,d#„ Z-d$„ Z.y)'ÚIPSetz[
    Represents an unordered collection (set) of unique IP addresses and
    subnets.

    )Ú_cidrsÚ__weakref__Nc                 óø  — t        |t        «      r|j                  di| _        yt        |t        «      r,t
        j                  t        |d   |d   «      d«      | _        yt        |t        «      r*t
        j                  |j                  «       d«      | _        yi | _        |�Wg }|D ]0  }t        |t        «      rt        ||¬«      }|j                  |«       Œ2 t        |«      D ]  }d| j                  |<   Œ yy)aL  
        Constructor.

        :param iterable: (optional) an iterable containing IP addresses,
            subnets or ranges.

        :param flags: decides which rules are applied to the interpretation
            of the addr value. See the netaddr.core namespace documentation
            for supported constant values.

        Tr   éÿÿÿÿN©Úflags)Ú
isinstancer   Úcidrr)   r   ÚdictÚfromkeysr   r(   Ú
iter_cidrsr   r   r   r   ©ÚselfÚiterabler.   Ú	mergeableÚaddrr0   s         r   Ú__init__zIPSet.__init__]   sà   € ô �h¤	Ô*Ø#Ÿ=™=¨$Ð/ˆD�KÜ˜¤'Ô*ÜŸ-™-Ü  ¨!¡¨h°r©lÓ;¸TóCˆD�Kä˜¤%Ô(ÜŸ-™-¨×(;Ñ(;Ó(=¸tÓDˆD�KàˆDŒKØÐ#Ø�	Ø$ò +�DÜ! $¬	Ô2Ü(¨°UÔ;˜Ø×$Ñ$ TÕ*ð+ô
 ' yÓ1ò -�DØ(,�D—K‘K Ò%ñ-ð $r   c                 ón   — t        | j                  D �cg c]  }|j                  «       ‘Œ c}«      S c c}w )z.:return: Pickled state of an ``IPSet`` object.)Útupler)   Ú__getstate__©r5   r0   s     r   r<   zIPSet.__getstate__|   s(   € ä°d·k±kÖB¨d�d×'Ñ'Õ)ÒBÓCÐCùÒBs   ”2c                 óH   — t         j                  d„ |D «       d«      | _        y)zR
        :param state: data used to unpickle a pickled ``IPSet`` object.

        c              3   óB   K  — | ]  \  }}}t        ||f|¬ «      –— Œ y­w))r   N)r   )Ú.0ÚvalueÚ	prefixlenr   s       r   ú	<genexpr>z%IPSet.__setstate__.<locals>.<genexpr>†   s-   è ø€ ò 5Ù*�˜	 7ô ˜˜yÐ)°7×;Ð;ñ 5ùs   ‚TN)r1   r2   r)   )r5   Ústates     r   Ú__setstate__zIPSet.__setstate__€   s$   € ô
 —m‘mñ5Ø.3ô5àóˆ�r   c                 óê  — |j                   }|j                  }|j                  }|j                  |j                  j
                  k(  r3|j                  «       D ]  }|| j                  v sŒ| j                  |=  y n˜g }| j                  D ]s  }|j                  j                  |k7  s||k(  rŒ"|j                   }|j                  }	||k\  r|	|k  r|j                  |«       ŒV||k  sŒ\|	|k\  sŒb| j                  |= |rJ ‚ y |D ]  }
| j                  |
= Œ |j                  j
                  |j                  z
  }|j                  dk7  r¯|j                  |z	  dz  }|r|j                  «       }n|j                  «       }|| j                  vry| j                  |= | j                  |= |xj                  dz  c_	        |dz  }|j                  |z	  |z  |_
        d| j                  |<   |j                  dk7  rŒ®yy)a  
        Same as compact(), but assume that added_network is the only change and
        that this IPSet was properly compacted before added_network was added.
        This allows to perform compaction much faster. added_network must
        already be present in self._cidrs.
        Nr   r   T)r   r   r   Ú
_prefixlenr   Úwidthr   r)   r   rB   Ú_valueÚpreviousÚnext)r5   Úadded_networkÚadded_firstÚ
added_lastÚadded_versionÚpotential_supernetÚ	to_remover0   r   r   ÚitemÚshift_widthÚthe_bitÚ	candidates                 r   Ú_compact_single_networkzIPSet._compact_single_networkŠ   sû  € ð $×)Ñ)ˆØ"×'Ñ'ˆ
Ø%×-Ñ-ˆð ×#Ñ# }×'<Ñ'<×'BÑ'BÒBð '4×&<Ñ&<Ó&>ò Ð"Ø%¨¯©Ò4ØŸ™ MÐ2Ùñð ˆIØŸ™ò �Ø—L‘L×(Ñ(¨MÒ9¸TÀ]Ò=RàØŸ
™
�Ø—y‘y�Ø˜KÒ'¨D°JÒ,>à×$Ñ$ TÕ*Ø˜kÓ)¨d°jÓ.@àŸ™ MÐ2ñ !*Ð*˜MÙðð  "ò &�Ø—K‘K Ñ%ð&ð $×+Ñ+×1Ñ1°M×4KÑ4KÑKˆØ×%Ñ%¨Ò*à$×+Ñ+¨{Ñ:¸aÑ?ˆGÙØ)×2Ñ2Ó4‘	à)×.Ñ.Ó0�	à §¡Ñ+àà—‘˜IÐ&Ø—‘˜MÐ*Ø×#Ò# qÑ(Õ#ð ˜1ÑˆKØ$1×$8Ñ$8¸KÑ$GÈKÑ#WˆMÔ Ø)-ˆD�K‰K˜Ñ&ð) ×%Ñ%¨Õ*r   c                 ód   — t        | j                  «      }t        j                  |d«      | _        y)zR
        Compact internal list of `IPNetwork` objects using a CIDR merge.
        TN)r   r)   r1   r2   ©r5   Úcidrss     r   ÚcompactzIPSet.compactÔ   s$   € ô ˜4Ÿ;™;Ó'ˆÜ—m‘m E¨4Ó0ˆ�r   c                 ó   — t        d«      ‚)zÁ
        Raises ``TypeError`` if this method is called.

        .. note:: IPSet objects are not hashable and cannot be used as             dictionary keys or as members of other sets.         zIP sets are unhashable!)Ú	TypeError©r5   s    r   Ú__hash__zIPSet.__hash__Û   s   € ô Ð1Ó2Ð2r   c                 ó²   — t        |«      }|| j                  v ry|j                  r1|xj                  dz  c_        || j                  v ry|j                  rŒ1y)z„
        :param ip: An IP address or subnet.

        :return: ``True`` if IP address or subnet is a member of this IP set.
        Tr   F)r   r)   rG   )r5   Úipr   s      r   Ú__contains__zIPSet.__contains__ä   sU   € ô ˜R“=ˆØ�t—{‘{Ñ"ØØ×!Ò!Ø×Ò 1Ñ$ÕØ˜4Ÿ;™;Ñ&Øð ×!Ó!ð r   c                 ó,   — t        | j                  «      S )z9Return True if IPSet contains at least one IP, else False)Úboolr)   r]   s    r   Ú__nonzero__zIPSet.__nonzero__÷   s   € ä�D—K‘KÓ Ð r   c                 óL   — t        j                  t        | j                  «      Ž S )zP
        :return: an iterator over the IP addresses within this IP set.
        )Ú
_itertoolsÚchainÚsortedr)   r]   s    r   Ú__iter__zIPSet.__iter__ý   s   € ô ×Ñ¤¨¯©Ó!4Ð5Ð5r   c                 ó,   — t        | j                  «      S )zU
        :return: an iterator over individual IP subnets within this IP set.
        )rh   r)   r]   s    r   r3   zIPSet.iter_cidrs  s   € ô �d—k‘kÓ"Ð"r   c                 ó¦  — t        |t        «      rRt        j                  t	        |d   |d   «      d«      }| j
                  j                  |«       | j                  «        yt        |t        «      r|j                  }n2t        |t        «      rt        t        ||¬«      «      }nt        |«      }d| j
                  |<   | j                  |«       y)a<  
        Adds an IP address or subnet or IPRange to this IP set. Has no effect if
        it is already present.

        Note that where possible the IP address or subnet is merged with other
        members of the set to form more concise CIDR blocks.

        :param addr: An IP address or subnet in either string or object form, or
            an IPRange object.

        :param flags: decides which rules are applied to the interpretation
            of the addr value. See the netaddr.core namespace documentation
            for supported constant values.

        r   r,   TNr-   )r/   r   r1   r2   r   r)   ÚupdaterZ   r   r0   r   r   rV   )r5   r8   r.   Ú	new_cidrss       r   Úaddz	IPSet.add	  s¡   € ô  �dœGÔ$ÜŸ™Ü   a¡¨$¨r©(Ó3°Tó;ˆIà�K‰K×Ñ˜yÔ)Ø�L‰LŒNØÜ�dœIÔ&à—9‘9‰DÜ˜œiÔ(ÜœY t°5Ô9Ó:‰Dä˜T“?ˆDà ˆ�‰�DÑØ×$Ñ$ TÕ*r   c                 óŒ  — t        |t        «      r+t        |d   |d   «      }|D ]  }| j                  |«       Œ yt        |t        «      rt        ||¬«      }nt        |«      }| j                  |«       d}d}| j                  D ]  }||v sŒt        ||«      }|} n |�$| j                  |= |D ]  }d| j                  |<   Œ yy)a  
        Removes an IP address or subnet or IPRange from this IP set. Does
        nothing if it is not already a member.

        Note that this method behaves more like discard() found in regular
        Python sets because it doesn't raise KeyError exceptions if the
        IP address or subnet is question does not exist. It doesn't make sense
        to fully emulate that behaviour here as IP sets contain groups of
        individual IP addresses as individual set members using IPNetwork
        objects.

        :param addr: An IP address or subnet, or an IPRange.

        :param flags: decides which rules are applied to the interpretation
            of the addr value. See the netaddr.core namespace documentation
            for supported constant values.

        r   r,   Nr-   T)
r/   r   r   Úremover   r   r   rn   r)   r   )r5   r8   r.   rY   r0   Ú	remainderÚmatching_cidrs          r   rp   zIPSet.remove*  sÜ   € ô& �dœGÔ$Ü$ T¨!¡W¨d°2©hÓ7ˆEØò "�Ø—‘˜DÕ!ð"àä�dœIÔ&Ü˜T¨Ô/‰Dä˜T“?ˆDð 	�‰�Œàˆ	Øˆð —K‘Kò 	ˆDØ�tŠ|Ü(¨¨tÓ4�	Ø $�Ùð		ð Ð Ø—‘˜MÐ*Ø!ò )�Ø$(�—‘˜DÒ!ñ)ð !r   c                 ó<   — | j                   j                  «       d   S )zŒ
        Removes and returns an arbitrary IP address or subnet from this IP
        set.

        :return: An IP address or subnet.
        r   )r)   Úpopitemr]   s    r   Úpopz	IPSet.popb  s   € ð �{‰{×"Ñ"Ó$ QÑ'Ð'r   c                 ó*   — | j                  |«      }| S )zÑ
        :param other: an IP set.

        :return: ``True`` if this IP set has no elements (IP addresses
            or subnets) in common with other. Intersection *must* be an
            empty set.
        )Úintersection)r5   ÚotherÚresults      r   Ú
isdisjointzIPSet.isdisjointk  s   € ð ×"Ñ" 5Ó)ˆØˆzÐr   c                 óp   — | j                  «       }|j                  j                  | j                  «       |S )z':return: a shallow copy of this IP set.)Ú	__class__r)   rl   )r5   Úobj_copys     r   Úcopyz
IPSet.copyv  s)   € à—>‘>Ó#ˆØ�‰×Ñ˜tŸ{™{Ô+Øˆr   c           	      óD  — t        |t        «      rUt        j                  d„ t	        t        | j                  «      t        |j                  «      z   «      D «       d«      | _        yt        |t        t        f«      r| j                  |«       yt        |d«      st        d«      ‚g }|D ]0  }t        |t        «      rt        ||¬«      }|j                  |«       Œ2 t	        t        | j                  «      |z   «      D ]  }d| j                  |<   Œ | j                  «        y)a~  
        Update the contents of this IP set with the union of itself and
        other IP set.

        :param iterable: an iterable containing IP addresses, subnets or ranges.

        :param flags: decides which rules are applied to the interpretation
            of the addr value. See the netaddr.core namespace documentation
            for supported constant values.

        c              3   ó    K  — | ]  }|–— Œ y ­w)N© )r@   r`   s     r   rC   zIPSet.update.<locals>.<genexpr>Š  s   è ø€ ò I˜”ñ Iùs   ‚TNri   zan iterable was expected!r-   )r/   r(   r1   r2   r   r
   r)   r   r   rn   Úhasattrr\   r   r   r   rZ   r4   s         r   rl   zIPSet.update|  s  € ô �h¤Ô&ÜŸ-™-ñIœj¬°D·K±KÓ)@Ü+5°h·o±oÓ+Fñ*Gó Hô IØJNóPˆDŒKð Ü˜¤9¬gÐ"6Ô7Ø�H‰H�XÔØä�x Ô,ÜÐ7Ó8Ð8àˆ	Øò 	#ˆDÜ˜$¤	Ô*Ü  ¨UÔ3�Ø×Ñ˜TÕ"ð	#ô
 œz¨$¯+©+Ó6¸ÑBÓCò 	%ˆDØ $ˆD�K‰K˜Òð	%ð 	�‰�r   c                 ó   — i | _         y)z5Remove all IP addresses and subnets from this IP set.N©r)   r]   s    r   ÚclearzIPSet.clearŸ  s	   € àˆ�r   c                 ó`   — 	 | j                   |j                   k(  S # t        $ r	 t        cY S w xY w)z›
        :param other: an IP set

        :return: ``True`` if this IP set is equivalent to the ``other`` IP set,
            ``False`` otherwise.
        ©r)   ÚAttributeErrorÚNotImplemented©r5   rx   s     r   Ú__eq__zIPSet.__eq__£  ó/   € ð	"Ø—;‘; %§,¡,Ñ.Ð.øÜò 	"Ü!Ò!ð	"úó   ‚ ›-¬-c                 ó`   — 	 | j                   |j                   k7  S # t        $ r	 t        cY S w xY w)z›
        :param other: an IP set

        :return: ``False`` if this IP set is equivalent to the ``other`` IP set,
            ``True`` otherwise.
        r‡   rŠ   s     r   Ú__ne__zIPSet.__ne__¯  rŒ   r�   c                 ó~   — t        |d«      st        S | j                  |j                  k  xr | j                  |«      S )z—
        :param other: an IP set

        :return: ``True`` if this IP set is less than the ``other`` IP set,
            ``False`` otherwise.
        r)   )r‚   r‰   ÚsizeÚissubsetrŠ   s     r   Ú__lt__zIPSet.__lt__»  s5   € ô �u˜hÔ'Ü!Ð!à�y‰y˜5Ÿ:™:Ñ%Ò>¨$¯-©-¸Ó*>Ð>r   c                 ó2   — | j                   D ]  }||vsŒ y y)zš
        :param other: an IP set.

        :return: ``True`` if every IP address and subnet in this IP set
            is found within ``other``.
        FTr„   ©r5   rx   r0   s      r   r’   zIPSet.issubsetÇ  s'   € ð —K‘Kò 	ˆDØ˜5Ò Ùð	ð r   c                 ó~   — t        |d«      st        S | j                  |j                  kD  xr | j                  |«      S )z›
        :param other: an IP set.

        :return: ``True`` if this IP set is greater than the ``other`` IP set,
            ``False`` otherwise.
        r)   )r‚   r‰   r‘   Ú
issupersetrŠ   s     r   Ú__gt__zIPSet.__gt__Õ  s5   € ô �u˜hÔ'Ü!Ð!à�y‰y˜5Ÿ:™:Ñ%Ò@¨$¯/©/¸%Ó*@Ð@r   c                 óV   — t        |d«      st        S |j                  D ]  }|| vsŒ y y)zš
        :param other: an IP set.

        :return: ``True`` if every IP address and subnet in other IP set
            is found within this one.
        r)   FT)r‚   r‰   r)   r•   s      r   r—   zIPSet.issupersetá  s7   € ô �u˜hÔ'Ü!Ð!à—L‘Lò 	ˆDØ˜4ÒÙð	ð r   c                 óH   — | j                  «       }|j                  |«       |S )z±
        :param other: an IP set.

        :return: the union of this IP set and another as a new IP set
            (combines IP addresses and subnets from both sets).
        )r~   rl   )r5   rx   Úip_sets      r   ÚunionzIPSet.unionò  s    € ð —‘“ˆØ�‰�eÔØˆr   c                 óx  — i }t        | j                  «      }t        |j                  «      }d}d}t        |«      }t        |«      }||k  r]||k  rX||   }	||   }
|	|
k(  rd||	<   |dz  }|dz  }n.|	|
v rd||	<   |dz  }n|
|	v rd||
<   |dz  }n|	|
k  r|dz  }n|dz  }||k  r||k  rŒXt        «       }||_        |S )zµ
        :param other: an IP set.

        :return: the intersection of this IP set and another as a new IP set.
            (IP addresses and subnets common to both sets).
        r   Tr   )rh   r)   r   r(   )r5   rx   Úresult_cidrsÚown_netsÚ
other_netsÚown_idxÚ	other_idxÚown_lenÚ	other_lenÚown_curÚ	other_curry   s               r   rw   zIPSet.intersectionÿ  s   € ð ˆä˜$Ÿ+™+Ó&ˆÜ˜EŸL™LÓ)ˆ
ØˆØˆ	Ü�h“-ˆÜ˜
“Oˆ	Ø˜Ò I°	Ò$9Ø˜wÑ'ˆGØ" 9Ñ-ˆIà˜)Ò#Ø(,�˜WÑ%Ø˜1‘�Ø˜Q‘‘	Ø˜IÑ%Ø(,�˜WÑ%Ø˜1‘‘Ø˜gÑ%Ø*.�˜YÑ'Ø˜Q‘‘	ð ˜YÒ&Ø˜q‘L‘Gà ‘N�Ið' ˜Ò I°	Ó$9ô. “ˆØ$ˆŒØˆr   c                 ó"  — g }t        | j                  «      }t        |j                  «      }d}d}t        |«      }t        |«      }||k  râ||k  rÝ||   }	||   }
|	|
k(  r|dz  }|dz  }n¸|	|
v rt        |
|||«      }|dz  }n |
|	v rt        |	|||«      }|dz  }nˆ|	|
k  rB|j	                  |	j
                  j                  |	j                  |	j                  f«       |dz  }nA|j	                  |
j
                  j                  |
j                  |
j                  f«       |dz  }||k  r||k  rŒÝ||k  rL||   }	|j	                  |	j
                  j                  |	j                  |	j                  f«       |dz  }||k  rŒL||k  rL||   }
|j	                  |
j
                  j                  |
j                  |
j                  f«       |dz  }||k  rŒLt        «       }t        |«      D ]'  \  }}t        ||«      }|D ]  }d|j                  |<   Œ Œ) |S )zÜ
        :param other: an IP set.

        :return: the symmetric difference of this IP set and another as a new
            IP set (all IP addresses and subnets that are in exactly one
            of the sets).
        r   r   T)rh   r)   r   r   r   r   r   r   r   r(   r&   r   )r5   rx   Úresult_rangesrŸ   r    r¡   r¢   r£   r¤   r¥   r¦   ry   ÚstartÚstoprY   r0   s                   r   Úsymmetric_differencezIPSet.symmetric_difference+  sG  € ð ˆä˜$Ÿ+™+Ó&ˆÜ˜EŸL™LÓ)ˆ
ØˆØˆ	Ü�h“-ˆÜ˜
“Oˆ	Ø˜Ò I°	Ò$9Ø˜wÑ'ˆGØ" 9Ñ-ˆIà˜)Ò#Ø˜1‘�Ø˜Q‘‘	Ø˜IÑ%Ü# I¨x¸À-ÓP�Ø˜Q‘‘	Ø˜gÑ%Ü% g¨z¸9ÀmÓT�	Ø˜1‘‘ð ˜YÒ&Ø!×(Ñ(¨'¯/©/×*AÑ*AØ*1¯-©-¸¿¹ð*Gô Hà˜q‘L‘Gà!×(Ñ(¨)×*;Ñ*;×*CÑ*CØ*3¯/©/¸9¿>¹>ð*Kô Là ‘N�Ið- ˜Ò I°	Ó$9ð4 ˜ÒØ˜wÑ'ˆGØ× Ñ  '§/¡/×"9Ñ"9Ø")§-¡-°·±ð"?ô @à�q‰LˆGð	 ˜Óð ˜)Ò#Ø" 9Ñ-ˆIØ× Ñ  )×"3Ñ"3×";Ñ";Ø"+§/¡/°9·>±>ð"Cô Dà˜‰NˆIð	 ˜)Ó#ô “ˆÜ.¨}Ó=ò 	+‰KˆE�4Ü$ U¨DÓ1ˆEØò +�Ø&*�—‘˜dÒ#ñ+ð	+ð ˆr   c                 ó  — g }i }t        | j                  «      }t        |j                  «      }d}d}t        |«      }t        |«      }	||k  ra||	k  r\||   }
||   }|
|k(  r|dz  }|dz  }n7|
|v r|dz  }n-||
v rt        |
|||«      }|dz  }n|
|k  rd||
<   |dz  }n|dz  }||k  r||	k  rŒ\||k  rd|||   <   |dz  }||k  rŒt	        |«      D ]  \  }}t        ||«      D ]  }d||<   Œ	 Œ t        «       }||_        |S )zæ
        :param other: an IP set.

        :return: the difference between this IP set and another as a new IP
            set (all IP addresses and subnets that are in this IP set but
            not found in the other.)
        r   r   T)rh   r)   r   r   r&   r   r(   )r5   rx   r¨   rž   rŸ   r    r¡   r¢   r£   r¤   r¥   r¦   r©   rª   r0   ry   s                   r   Ú
differencezIPSet.differenceo  sj  € ð ˆØˆä˜$Ÿ+™+Ó&ˆÜ˜EŸL™LÓ)ˆ
ØˆØˆ	Ü�h“-ˆÜ˜
“Oˆ	Ø˜Ò I°	Ò$9Ø˜wÑ'ˆGØ" 9Ñ-ˆIà˜)Ò#Ø˜1‘�Ø˜Q‘‘	Ø˜IÑ%Ø˜1‘‘Ø˜gÑ%Ü% g¨z¸9Ø&3ó5�	à˜1‘‘ð ˜YÒ&Ø,0�L Ñ)Ø˜q‘L‘Gà ‘N�Ið' ˜Ò I°	Ó$9ð. ˜ÒØ.2ˆL˜ 'Ñ*Ñ+Ø�q‰LˆGð ˜Óô /¨}Ó=ò 	*‰KˆE�4Ü(¨°Ó5ò *�Ø%)�˜TÒ"ñ*ð	*ô “ˆØ$ˆŒØˆr   c                 óT   — | j                   }|t        kD  rt        dt        z  «      ‚|S )zæ
        :return: the cardinality of this IP set (i.e. sum of individual IP             addresses). Raises ``IndexError`` if size > maxint (a Python             limitation). Use the .size property for subnets of any size.
        zUrange contains more than %d (sys.maxint) IP addresses!Use the .size property instead.)r‘   r	   Ú
IndexError)r5   r‘   s     r   Ú__len__zIPSet.__len__¥  s9   € ð �y‰yˆØ”+ÒÜð2Ü4?ñ@óAð Að ˆr   c                 óf   — t        | j                  D �cg c]  }|j                  ‘Œ c}«      S c c}w )z˜
        The cardinality of this IP set (based on the number of individual IP
        addresses including those implicitly defined in subnets).
        )Úsumr)   r‘   r=   s     r   r‘   z
IPSet.size²  s%   € ô ¨$¯+©+Ö6 $�D—I“IÒ6Ó7Ð7ùÒ6s   ”.c                 ój   — dt        | j                  «      D �cg c]  }t        |«      ‘Œ c}z  S c c}w )z8:return: Python statement to create an equivalent objectz	IPSet(%r))rh   r)   Ústr)r5   Úcs     r   Ú__repr__zIPSet.__repr__º  s(   € à¬f°T·[±[Ó.AÖB¨œc !�fÒBÑBÐBùÒBs   ™0c                 ó‚   — | j                  «       }t        |«      dkD  r!|d   d   }|D ]  }|d   |k7  r y|d   dz   }Œ y)zÆ
        Returns True if the members of the set form a contiguous IP
        address range (with no gaps), False otherwise.

        :return: ``True`` if the ``IPSet`` object is contiguous.
        r   r   Fr,   T)r3   r   )r5   rY   rJ   r0   s       r   ÚiscontiguouszIPSet.iscontiguousÀ  sX   € ð —‘Ó!ˆÜˆu‹:˜Š>Ø˜Q‘x ‘{ˆHØò (�Ø˜‘7˜hÒ&Ù Ø ™8 a™<‘ð(ð r   c                 óŽ   — | j                  «       r+| j                  «       }|syt        |d   d   |d   d   «      S t        d«      ‚)zì
        Generates an IPRange for this IPSet, if all its members
        form a single contiguous sequence.

        Raises ``ValueError`` if the set is not contiguous.

        :return: An ``IPRange`` for all IPs in the IPSet.
        Nr   r,   zIPSet is not contiguous)r¸   r3   r   Ú
ValueErrorrX   s     r   ÚiprangezIPSet.iprangeÐ  sK   € ð ×ÑÔØ—O‘OÓ%ˆEÙØÜ˜5 ™8 A™;¨¨b©	°"©Ó6Ð6äÐ6Ó7Ð7r   c              #   óè   K  — | j                  «       D �cg c]/  }|j                  j                  |j                  |j                  f‘Œ1 }}t        |«      D ]  \  }}t        ||«      –— Œ yc c}w ­w)zùGenerate the merged IPRanges for this IPSet.

        In contrast to self.iprange(), this will work even when the IPSet is
        not contiguous. Adjacent IPRanges will be merged together, so you
        get the minimal number of IPRanges.
        N)r3   r   r   r   r   r&   r   )r5   r0   r   r©   rª   s        r   Úiter_iprangeszIPSet.iter_iprangesá  sq   è ø€ ð "&§¡Ó!2ö4Øð Ÿ,™,×.Ñ.°·
±
¸D¿I¹IÒFð 4ˆð 4ô /¨}Ó=ò 	'‰KˆE�4Ü˜% Ó&Ó&ñ	'ùò4ùs   ‚A2•4A-Á	)A2)Nr   )r   )/Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú	__slots__r9   r<   rE   rV   rZ   r^   ra   rd   Ú__bool__ri   r3   rn   rp   ru   rz   r~   rl   r…   r‹   r�   r“   r’   Ú__le__r˜   r—   Ú__ge__rœ   Ú__or__rw   Ú__and__r«   Ú__xor__r­   Ú__sub__r°   Úpropertyr‘   r¶   Ú__str__r¸   r»   r½   r�   r   r   r(   r(   U   s  „ ñð
 *€Ió-ò>DòòH.òT1ò3òò&!ð €Hò6ò#ó+óB4)òp(ò	òó!òFò
"ò
"ò
?ò
ð €Fò
Aòð €Fò	ð €Fò(ðT €Gò@ðD #€Gò2ðh €Gòð ñ8ó ð8òCð €Gòò 8ó"'r   r(   )rÁ   Ú	itertoolsrf   Ú
netaddr.ipr   r   r   r   r   r   Únetaddr.compatr	   r
   r   r   r&   Úobjectr(   r�   r   r   ú<module>rÐ      s8   ðñ 9ã ÷$÷ $÷ >Ñ =ò%òP5ô:W
'ˆFõ W
'r   