/usr/lib/python2.6/site-packages/netaddr/ip
Edit: /usr/lib/python2.6/site-packages/netaddr/ip/sets.pyc (21678B)
Ñò
}DVc @ sˆ d Z d d k Z d d k l Z l Z l Z l Z l Z l Z d d k
l Z l Z l
Z
d „ Z d „ Z d e f d „ ƒ YZ d S( s2 Set based operations for IP addresses and subnets.iÿÿÿÿN( t IPNetworkt IPAddresst IPRanget
cidr_merget cidr_excludet iprange_to_cidrs( t _sys_maxintt
_dict_keyst _int_typec
C s$ | i i } | | } | i | i j o$ | i | | i | i d f ƒ n | d 7} | } xƒ | t | ƒ j oo | | } | | j o Pn | i d | i j o n% | i | | i d | i d f ƒ | d 7} | } q` W| i d } | i } | | j o | 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 _modulet versiont firstt appendt lent last(
t supernett subnetst
subnet_idxt rangesR
t subnett prev_subnett
cur_subnetR R ( ( s0 /tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt _subtract s*
$
$
c c s¸ | p d S| d \ } } } xu | d D]i \ } } } | | d j o | | j o
| } q* n t | | ƒ t | | ƒ f V| } | } | } q* Wt | | ƒ t | | ƒ f Vd S( sq 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.
Ni i ( R ( t
sorted_rangest current_versiont
current_startt current_stopt next_versiont
next_startt next_stop( ( s0 /tmp/pip-build-lt8jXN/netaddr/netaddr/ip/sets.pyt _iter_merged_ranges8 s
t IPSetc B s‚ e Z d Z d$ Z d% 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&