File manager - Edit - /opt/imh-python/lib/python2.7/site-packages/netaddr/ip/sets.pyo
Back
� �܌Uc @ s� 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 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 | j j } | | } | j | j k rK | j | | j | j d f � n | d 7} | } x} | t | � k r� | | } | | k r� Pn | j d | j k r� n$ | j | | j d | j d f � | d 7} | } q^ W| j d } | j } | | k r| j | | | 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 ( ( s>