/usr/lib/python2.6/site-packages/netaddr/ip
NameSizeModeActions
glob.py104740644editdlrm
glob.pyc98900644editdlrm
iana.py136210755editdlrm
iana.pyc145780644editdlrm
ipv4-address-space.xml534390644editdlrm
ipv6-address-space.xml75600644editdlrm
ipv6-unicast-address-assignments.xml145730644editdlrm
multicast-addresses.xml1322140644editdlrm
nmap.py40660644editdlrm
nmap.pyc37520644editdlrm
rfc1924.py17500644editdlrm
rfc1924.pyc21670644editdlrm
sets.py265610644editdlrm
sets.pyc216780644editdlrm
__init__.py660220644editdlrm
__init__.pyc640090644editdlrm
Edit: /usr/lib/python2.6/site-packages/netaddr/ip/sets.pyc (21678B)
Ñò }DVc@sˆdZddkZddklZlZlZlZlZl Z ddk l Z l Z l Z d„Zd„Zdefd„ƒYZdS( s2Set based operations for IP addresses and subnets.iÿÿÿÿN(t IPNetworkt IPAddresstIPRanget cidr_merget cidr_excludetiprange_to_cidrs(t _sys_maxintt _dict_keyst _int_typec Cs$|ii}||}|i|ijo$|i||i|idfƒn|d7}|}xƒ|t|ƒjoo||}||joPn|id|ijon%|i||id|idfƒ|d7}|}q`W|id}|i} || jo|i||| fƒn|S(s®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). i(t_moduletversiontfirsttappendtlentlast( tsupernettsubnetst subnet_idxtrangesR tsubnett prev_subnett cur_subnetR R((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt _subtracts*  $   $     ccs¸|pdS|d\}}}xu|dD]i\}}}||djo||jo |}q*nt||ƒt||ƒfV|}|}|}q*Wt||ƒt||ƒfVdS(sqIterate 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. Nii(R(t sorted_rangestcurrent_versiont current_startt current_stopt next_versiont next_startt next_stop((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt_iter_merged_ranges8s     tIPSetcBs‚eZdZd$Zd%dd„Zd„Zd„Zd„Zd„Z d„Z d „Z d „Z e Z d „Zd „Zdd „Zdd„Zd„Zd„Zd„Zdd„Zd„Zd„Zd„Zd„Zd„ZeZd„Zd„ZeZd„ZeZ 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.RS(&s[ Represents an unordered collection (set) of unique IP addresses and subnets. t_cidrsicCst|tƒoht|i6|_nòt|tƒo*tit|d|dƒtƒ|_n¸t|t ƒoti|i ƒtƒ|_n‰h|_|dj org}xA|D]9}t|t ƒot |d|ƒ}n|i|ƒq³Wx%t|ƒD]}t|i|†s N(R%R&R#R (R)tstate((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt __setstate__€scCs|i}|i}|i}|i|iijo:x|iƒD]%}||ijo|i|=dSq>WnÒg}x­|iD]¢}|ii|jp ||joq{n|i}|i} ||jo| |jo|i|ƒq{||jo+| |jo|i|=| pt ‚dSq{Wx|D]} |i| =q(W|ii|i } x¬|i djo›|i | ?d@} | o|i ƒ} n |i ƒ} | |ijodS|i| =|i|=|i d8_ | d7} |i | ?| >|_ t|i|Šs NRSsan iterable was expected!R!(R"RR%R&RRR R#RRRVthasattrRIRRR RH(R)R*R!R+R,R$((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyRT|s(   cCs h|_dS(s5Remove all IP addresses and subnets from this IP set.N(R (R)((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pytclearŸscCs/y|i|ijSWntj otSXdS(s› :param other: an IP set :return: ``True`` if this IP set is equivalent to the ``other`` IP set, ``False`` otherwise. N(R tAttributeErrortNotImplemented(R)R]((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt__eq__£scCs/y|i|ijSWntj otSXdS(s› :param other: an IP set :return: ``False`` if this IP set is equivalent to the ``other`` IP set, ``True`` otherwise. N(R ReRf(R)R]((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt__ne__¯scCs5t|dƒptS|i|ijo |i|ƒS(s— :param other: an IP set :return: ``True`` if this IP set is less than the ``other`` IP set, ``False`` otherwise. R (RcRftsizetissubset(R)R]((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt__lt__»scCs*x#|iD]}||jotSq WtS(sš :param other: an IP set. :return: ``True`` if every IP address and subnet in this IP set is found within ``other``. (R RKR#(R)R]R$((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyRjÇs    cCs5t|dƒptS|i|ijo |i|ƒS(s› :param other: an IP set. :return: ``True`` if this IP set is greater than the ``other`` IP set, ``False`` otherwise. R (RcRfRit issuperset(R)R]((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt__gt__ÕscCs?t|dƒptSx#|iD]}||jotSqWtS(sš :param other: an IP set. :return: ``True`` if every IP address and subnet in other IP set is found within this one. R (RcRfR RKR#(R)R]R$((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyRlás   cCs|iƒ}|i|ƒ|S(s± :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). (RbRT(R)R]tip_set((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pytunionòs  c Cs2h}t|iƒ}t|iƒ}d}d}t|ƒ}t|ƒ}xÑ||joÃ||jo¶||} ||} | | jo"t|| <|d7}|d7}qK| | jot|| <|d7}qK| | jot|| <|d7}qK| | jo|d7}qK|d7}qKWtƒ} || _| S(sµ :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). ii(RRR R R#R( R)R]t result_cidrstown_netst other_netstown_idxt other_idxtown_lent other_lentown_curt other_curR^((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyR\ÿs6              cCsYg}t|iƒ}t|iƒ}d}d}t|ƒ}t|ƒ}x!||jo||jo||} ||} | | jo|d7}|d7}qK| | jo#t| |||ƒ}|d7}qK| | jo#t| |||ƒ}|d7}qK| | jo0|i| ii| i| ifƒ|d7}qK|i| ii| i| ifƒ|d7}qKWxH||jo:||} |i| ii| i| ifƒ|d7}qoWxH||jo:||} |i| ii| i| ifƒ|d7}qºWt ƒ} xGt |ƒD]9\} } t | | ƒ}x|D]}t | i|t|ƒD]0\} } x!t| | ƒD]}t|| maxint (a Python limitation). Use the .size property for subnets of any size. sUrange contains more than %d (sys.maxint) IP addresses!Use the .size property instead.(RiRt IndexError(R)Ri((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt__len__¥s   cCs+tg}|iD]}||iq~ƒS(s˜ The cardinality of this IP set (based on the number of individual IP addresses including those implicitly defined in subnets). (tsumR Ri(R)R0R$((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyRi²scCs2dg}t|iƒD]}|t|ƒq~S(s8:return: Python statement to create an equivalent objects IPSet(%r)(RRR tstr(R)R0tc((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt__repr__ºscCsj|iƒ}t|ƒdjoG|dd}x6|D]*}|d|jotS|dd}q4WntS(sÆ 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. iiiÿÿÿÿ(R'R RKR#(R)RGR:R$((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt iscontiguousÀs cCsS|iƒo6|iƒ}|pdSt|dd|ddƒStdƒ‚dS(sì 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. iiÿÿÿÿsIPSet is not contiguousN(R„R'R(Rt ValueError(R)RG((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pytiprangeÐs  ccskg}|iƒD]"}||ii|i|ifq~}x(t|ƒD]\}}t||ƒVqIWdS(sù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(R'R R R RRR(R)R0R$RRzR{((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt iter_iprangesás 5 (s_cidrsN(/t__name__t __module__t__doc__t __slots__R(R-R/R5RFRHRJRMROt__bool__RSR'RVRWR[R_RbRTRdRgRhRkRjt__le__RmRlt__ge__Rot__or__R\t__and__R|t__xor__R}t__sub__RtpropertyRiRƒt__str__R„R†R‡(((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyRUsV  J      ! 8  #     * B 4    (RŠt itertoolsRPt netaddr.ipRRRRRRtnetaddr.compatRRRRRtobjectR(((s0/tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyts  . (