+
    4if                     \    R t ^ RIt^ RIt^ RIHtHtHtH	t	H
t
Ht R tR t ! R R]4      tR# )z2Set based operations for IP addresses and subnets.N)	IPNetwork	IPAddressIPRange
cidr_mergecidr_excludeiprange_to_cidrsc                b   V P                   P                  pW,          pVP                  V P                  8  d/   VP                  W@P                  VP                  ^,
          34       V^,          pTpV\	        V4      8  du   W,          pWp9  d   MeVP
                  ^,           VP                  8X  d   M5VP                  WFP
                  ^,           VP                  ^,
          34       V^,          pTpK  VP
                  ^,           pV P
                  p	W8:  d   VP                  WHV	34       V# )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 F||hnn$wq0@AB!OJK
s7|
#(
%a:#3#33MM7$4$4q$8*:J:JQ:NOPa
 q E==D}wt,-    c              #     "   V '       g   R# V ^ ,          w  rpV R,           F;  w  rEpWS^,           8X  d   WA8X  d   TpK  \        W!4      \        W14      3x  TpTpTpK=  	  \        W!4      \        W14      3x  R# 5i)aY  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.
N:   NN)r   )sorted_rangescurrent_versioncurrent_startcurrent_stopnext_version
next_start	next_stops   &      r   _iter_merged_rangesr"   6   s      3@3C0OL/<R/@/@+)))l.M$L8)L:bcc" & 0A ]4i6^
__s   A9A;c                   $  a  ] tR t^Qt o RtR%tR&R ltR tR tR t	R t
R tR	 tR
 tR tR tR'R ltR'R ltR tR tR tR'R ltR tR tR tR tR t]tR tR t]tR t]t R t!]!t"R t#]#t$R t%]%t&R t'](R 4       t)R  t*]*t+R! t,R" t-R# t.R$t/V t0R# )(IPSetzO
Represents an unordered collection (set) of unique IP addresses and
subnets.

Nc                L   \        V\        4      '       d   VP                  R/V n        R# \        V\        4      '       d6   \
        P                  \        V^ ,          VR,          4      R4      V n        R# \        V\        4      '       d,   \
        P                  VP                  4       R4      V n        R# / V n        Veb   . pV F6  p\        V\        4      '       d   \        WBR7      pVP                  V4       K8  	  \        V4       F  pRV P                  V&   K  	  R# R# )a  
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 :class:`IPAddress` documentation
    for supported constant values.

TNflags)
isinstancer   cidr_cidrsr   dictfromkeysr   r$   
iter_cidrsintr   r   r   selfiterabler'   	mergeableaddrr*   s   &&&   r   __init__IPSet.__init__Z   s     h	**#==$/DK'**--(8!hrl(SUYZDK%((--(;(;(=tDDKDK#	$D!$,,(;$$T* %
 'y1D(,DKK% 2 $r   c                p    \        V P                   Uu. uF  qP                  4       NK  	  up4      # u upi )z.:return: Pickled state of an ``IPSet`` object.)tupler+   __getstate__r1   r*   s   & r   r9   IPSet.__getstate__x   s*    dkkBkd'')kBCCBs   3c                J    \         P                  R V 4       R4      V n        R# )zB
:param state: data used to unpickle a pickled ``IPSet`` object.

c              3   D   "   T F  w  rp\        W3VR 7      x  K  	  R# 5i))r
   N)r   ).0value	prefixlenr
   s   &   r   	<genexpr>%IPSet.__setstate__.<locals>.<genexpr>   s%     c]b@YRYY)7;;]bs    TN)r,   r-   r+   )r1   states   &&r   __setstate__IPSet.__setstate__|   s     
 mmc]bc
r   c                T   VP                   pVP                  pVP                  pVP                  VP                  P
                  8X  d9   VP                  4        F#  pWPP                  9   g   K  V P                  V  R# 	  M. pV P                   F  pVP                  P                  V8w  g   Wq8X  d   K&  VP                   pVP                  p	W8  d   W8:  d   VP                  V4       K]  W8:  g   Ke  W8  g   Km  V P                  V V'       d   Q h R# 	  V F  p
V P                  V
 K  	  VP                  P
                  VP                  ,
          pVP                  ^ 8w  d   VP                  V,	          ^,          pV'       d   VP                  4       pMVP                  4       pWP                  9  d   R# V P                  V V P                  V V;P                  ^,          un	        V^,          pVP                  V,	          V,          Vn
        RV P                  V&   K  R# )z
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.
NT)r   r   r
   
_prefixlenr	   widthr   r+   r   r@   _valuepreviousnext)r1   added_networkadded_first
added_lastadded_versionpotential_supernet	to_remover*   r   r   itemshift_widththe_bit	candidates   &&            r   _compact_single_networkIPSet._compact_single_network   s    $))"''
%-- ##}'<'<'B'BB '4&<&<&>"%4M2 '? I<<''=8D<Q

yy'D,>$$T*)d.@M2  )(= $  "KK% " $++11M4K4KK%%*$++{:a?G)224	)..0	+I&M*##q(# 1K$1$8$8K$GK#WM )-DKK&) +r   c                f    \        V P                  4      p\        P                  VR4      V n        R# )zB
Compact internal list of `IPNetwork` objects using a CIDR merge.
TN)r   r+   r,   r-   r1   cidrss   & r   compactIPSet.compact   s$     4;;'mmE40r   c                    \        R4      h)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r1   s   &r   __hash__IPSet.__hash__   s     122r   c                    \        V4      pW P                  9   d   R# VP                  '       d.   V;P                  ^,          un        W P                  9   g   K=  R# R# )zl
:param ip: An IP address or subnet.

:return: ``True`` if IP address or subnet is a member of this IP set.
TF)r   r+   rG   )r1   ipr   s   && r   __contains__IPSet.__contains__   sG     R={{"!!!1$;;&r   c                ,    \        V P                  4      # )z9Return True if IPSet contains at least one IP, else False)boolr+   r_   s   &r   __bool__IPSet.__bool__   s    DKK  r   c                P    \         P                  ! \        V P                  4      !  # )z@
:return: an iterator over the IP addresses within this IP set.
)
_itertoolschainsortedr+   r_   s   &r   __iter__IPSet.__iter__   s     !455r   c                ,    \        V P                  4      # )zE
:return: an iterator over individual IP subnets within this IP set.
)rm   r+   r_   s   &r   r.   IPSet.iter_cidrs   s     dkk""r   c                   \        V\        4      '       d\   \        P                  \	        V^ ,          VR,          4      R4      pV P
                  P                  V4       V P                  4        R# \        V\        4      '       d   VP                  pM7\        V\        4      '       d   \        \        WR7      4      pM\        V4      pRV P
                  V&   V P                  V4       R# )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 :class:`IPAddress` documentation
    for supported constant values.

TNr&   r(   )r)   r   r,   r-   r   r+   updater[   r   r*   r/   r   rV   )r1   r4   r'   	new_cidrss   &&& r   add	IPSet.add  s      dG$$&6tAwR&I4PIKKy)LLNdI&&99Dc""Yt9:DT?D D$$T*r   c                   \        V\        4      '       d7   \        V^ ,          VR,          4      pV F  pV P                  V4       K  	  R# \        V\        4      '       d   \        WR7      pM\        V4      pV P                  V4       RpRpV P                   F  pW9   g   K  \        WA4      pTp M	  Ve(   V P                  V V F  pRV P                  V&   K  	  R# R# )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 :class:`IPAddress` documentation
    for supported constant values.

Nr&   Tr(   )
r)   r   r   remover/   r   r   ru   r+   r   )r1   r4   r'   rZ   r*   	remaindermatching_cidrs   &&&    r   rx   IPSet.remove#  s    & dG$$$T!Wd2h7ED! dC  T/DT?D 		 KKD|(4	 $	    M*!$(D! " !r   c                D    V P                   P                  4       ^ ,          # )zl
Removes and returns an arbitrary IP address or subnet from this IP
set.

:return: An IP address or subnet.
)r+   popitemr_   s   &r   pop	IPSet.pop[  s     {{""$Q''r   c                2    V P                  V4      pV'       * # )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)r1   otherresults   && r   
isdisjointIPSet.isdisjointd  s     ""5)zr   c                p    V P                  4       pVP                  P                  V P                  4       V# )z':return: a shallow copy of this IP set.)	__class__r+   rs   )r1   obj_copys   & r   copy
IPSet.copyo  s)    >>#t{{+r   c           
        \        V\        4      '       ds   \        P                  R \	        \
        P                  ! V P                  P                  4       VP                  P                  4       4      4       4       R4      V n        R# \        V\        \        34      '       d   V P                  V4       R# \        VR4      '       g   \        R4      h. pV F6  p\        V\        4      '       d   \        WBR7      pVP!                  V4       K8  	  \	        \
        P                  ! V P                  P                  4       V4      4       F  pRV P                  V&   K  	  V P#                  4        R# )aB  
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 :class:`IPAddress` documentation
    for supported constant values.

c              3   &   "   T F  pVx  K	  	  R # 5i)N )r>   rc   s   & r   rA   IPSet.update.<locals>.<genexpr>  s       s   TNrn   zan iterable was expected!r&   )r)   r$   r,   r-   r   rk   rl   r+   keysr   r   ru   hasattrr^   r/   r   r   r[   r0   s   &&&   r   rs   IPSet.updateu  s    h&&--("(()9)9);X__=Q=Q=ST DK 9g"677HHXx,,788	D$$$ 3T" 
 z//0@0@0BINOD $DKK P 	r   c                    / V n         R# )z5Remove all IP addresses and subnets from this IP set.Nr+   r_   s   &r   clearIPSet.clear  s	    r   c                d     V P                   VP                   8H  #   \         d
    \        u # i ; i)z{
:param other: an IP set

:return: ``True`` if this IP set is equivalent to the ``other`` IP set,
    ``False`` otherwise.
r+   AttributeErrorNotImplementedr1   r   s   &&r   __eq__IPSet.__eq__  /    	";;%,,.. 	"!!	"    //c                d     V P                   VP                   8g  #   \         d
    \        u # i ; i)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__IPSet.__ne__  r   r   c                    \        VR4      '       g   \        # V P                  VP                  8  ;'       d    V P                  V4      # )zw
: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__IPSet.__lt__  s;     uh''!!yy5::%>>$--*>>r   c                >    V P                    F  pW!9  g   K   R# 	  R# )zz
:param other: an IP set.

:return: ``True`` if every IP address and subnet in this IP set
    is found within ``other``.
FTr   r1   r   r*   s   && r   r   IPSet.issubset  s      KKD    r   c                    \        VR4      '       g   \        # V P                  VP                  8  ;'       d    V P                  V4      # )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__IPSet.__gt__  s;     uh''!!yy5::%@@$//%*@@r   c                n    \        VR4      '       g   \        # VP                   F  pW 9  g   K   R# 	  R# )zz
: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   IPSet.issuperset  s3     uh''!!LLD ! r   c                H    V P                  4       pVP                  V4       V# )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   rs   )r1   r   ip_sets   && r   unionIPSet.union  s      er   c                   / p\        V P                  4      p\        VP                  4      p^ p^ p\        V4      p\        V4      pWW8  d{   Wh8  du   W5,          p	WF,          p
W8X  d   RW)&   V^,          pV^,          pK:  W9   d   RW)&   V^,          pKO  W9   d   RW*&   V^,          pKd  W8  d   V^,          pKu  V^,          pK  \        4       pW+n        V# )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).
T)rm   r+   r   r$   )r1   r   result_cidrsown_nets
other_netsown_idx	other_idxown_len	other_lenown_cur	other_curr   s   &&          r   r   IPSet.intersection  s     $++&ELL)
	h-
O	I$9'G"-I#(,%1Q	%(,%1%*.'Q	 &qLGNI $r   c                t   . p\        V P                  4      p\        VP                  4      p^ p^ p\        V4      p\        V4      pWW8  Ed    Wh8  d   W5,          p	WF,          p
W8X  d   V^,          pV^,          pK7  W9   d   \        WWR4      pV^,          pKT  W9   d   \        WWb4      pV^,          pKq  W8  dH   VP	                  V	P
                  P                  V	P                  V	P                  34       V^,          pK  VP	                  V
P
                  P                  V
P                  V
P                  34       V^,          pEK  WW8  dP   W5,          p	VP	                  V	P
                  P                  V	P                  V	P                  34       V^,          pKU  Wh8  dP   WF,          p
VP	                  V
P
                  P                  V
P                  V
P                  34       V^,          pKU  \        4       p\        V4       F(  w  r\        W4      pV F  pRVP                  V&   K  	  K*  	  V# )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).
T)rm   r+   r   r   r   r	   r
   r   r   r$   r"   r   )r1   r   result_rangesr   r   r   r   r   r   r   r   r   startstoprZ   r*   s   &&              r   symmetric_differenceIPSet.symmetric_difference*  s    $++&ELL)
	h-
O	I$9'G"-I#1Q	%#IPQ	%%g9T	1 &!(('//*A*A7==RYR^R^)_`qLG!(("**22IOOY^^T NI 'G  '//"9"97==',,!WXqLG #"-I  )"3"3";";Y__inn!]^NI.}=KE$U1E&*d#  > r   c                J   . p/ p\        V P                  4      p\        VP                  4      p^ p^ p\        V4      p\        V4      p	Wh8  d   Wy8  dy   WF,          p
WW,          pW8X  d   V^,          pV^,          pK6  W9   d   V^,          pKG  W9   d   \        WWr4      pV^,          pKd  W8  d   RW:&   V^,          pKy  V^,          pK  Wh8  d   RW4V,          &   V^,          pK  \	        V4       F  w  r\        W4       F  pRW>&   K	  	  K  	  \        4       pW?n        V# )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.)
T)rm   r+   r   r   r"   r   r$   )r1   r   r   r   r   r   r   r   r   r   r   r   r   r   r*   r   s   &&              r   
differenceIPSet.differencel  s    $++&ELL)
	h-
O	I$9'G"-I#1Q	%1%%g9T	1 &,0L)qLGNI .2L'*+qLG.}=KE(5%)" 6 > $r   c                    V P                   pV\        P                  8  d!   \        R\        P                  ,          4      hV# )z
:return: the cardinality of this IP set (i.e. sum of individual IP             addresses). Raises ``IndexError`` if size > maxsize (a Python             limitation). Use the .size property for subnets of any size.
zVrange contains more than %d (sys.maxsize) IP addresses!Use the .size property instead.)r   _sysmaxsize
IndexError)r1   r   s   & r   __len__IPSet.__len__  s?     yy$,,248LLA  r   c                h    \        V P                   Uu. uF  qP                  NK  	  up4      # u upi )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   
IPSet.size  s'     $++6+$II+6776s   /c                v    R\        V P                  4       Uu. uF  p\        V4      NK  	  up,          # u upi )z8:return: Python statement to create an equivalent objectz	IPSet(%r))rm   r+   str)r1   cs   & r   __repr__IPSet.__repr__  s.    fT[[.AB.Ac!f.ABBBBs   6c                    V P                  4       p\        V4      ^8  d;   V^ ,          ^ ,          pV F$  pV^ ,          V8w  d    R# VR,          ^,           pK&  	  R# )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.
FTr(   )r.   r   )r1   rZ   rJ   r*   s   &   r   iscontiguousIPSet.iscontiguous  sS     !u:>Qx{H7h& 8a<  r   c                    V P                  4       '       dC   V P                  4       pV'       g   R# \        V^ ,          ^ ,          VR,          R,          4      # \        R4      h)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.
NzIPSet is not contiguousr(   )r   r.   r   
ValueErrorrY   s   & r   iprangeIPSet.iprange  sN     OO%E58A;b	"66677r   c              #     "   V P                  4        Uu. uF/  qP                  P                  VP                  VP                  3NK1  	  pp\        V4       F  w  r4\        W44      x  K  	  R# u upi 5i)zGenerate 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)r.   r	   r
   r   r   r"   r   )r1   r*   r   r   r   s   &    r   iter_iprangesIPSet.iter_ipranges  sg      GKooFW
FWd\\!!4::tyy9FW 	 
 /}=KE%&& >	
s   A45A/
*A4r   )r+   __weakref__)N    )r   )1__name__
__module____qualname____firstlineno____doc__	__slots__r5   r9   rD   rV   r[   r`   rd   rh   rn   r.   ru   rx   r~   r   r   rs   r   r   r   r   r   __le__r   r   __ge__r   __or__r   __and__r   __xor__r   __sub__r   propertyr   r   __str__r   r   r   __static_attributes____classdictcell__)__classdict__s   @r   r$   r$   Q   s     *I-<D
H.T13&!6#+@4)p(	'R
"
"
?
 F
A F	 F(T G>@ #G1f G 8 8C G 8"' 'r   r$   )r   	itertoolsrk   sysr   
netaddr.ipr   r   r   r   r   r   r   r"   objectr$   r   r   r   <module>r      s0    9   ` `%P`6Y
'F Y
'r   