|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /proc/self/root/usr/lib/python2.7/site-packages/netaddr/contrib/ |
Upload File : |
�
o�\c @ s6 d d l m Z m Z m Z d e f d � � YZ d S( i����( t IPNetworkt cidr_excludet
cidr_merget SubnetSplitterc B s5 e Z d Z d � Z d d � Z d � Z d � Z RS( s�
A handy utility class that takes a single (large) subnet and allows
smaller subnet within its range to be extracted by CIDR prefix. Any
leaving address space is available for subsequent extractions until
all space is exhausted.
c C s t t | � g � | _ d S( s�
Constructor.
:param base_cidr: an IPv4 or IPv6 address with a CIDR prefix.
(see IPNetwork.__init__ for full details).
N( t setR t _subnets( t selft base_cidr( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyt __init__ s c C s~ xw | j � D]i } t | j | d | �� } | s: q
n | j | � | j j t t | t | � d � � � | _ | SWg S( s; Extract 1 or more subnets of size specified by CIDR prefix.t counti ( t available_subnetst listt subnett
remove_subnetR t unionR R R ( R t prefixR t cidrt subnets( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyt extract_subnet s
"c C s t | j d d � d t �S( s2 Returns a list of the currently available subnets.t keyc S s | j S( N( t prefixlen( t x( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyt <lambda>* s t reverse( t sortedR t True( R ( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyR
( s c C s | j j | � d S( s: Remove a specified IPNetwork from available address space.N( R t remove( R t
ip_network( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyR
, s N( t __name__t
__module__t __doc__R t NoneR R
R
( ( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyR s
N( t
netaddr.ipR R R t objectR ( ( ( sB /tmp/pip-install-zM1pc4/netaddr/netaddr/contrib/subnet_splitter.pyt <module> s