%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/netaddr/contrib/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/netaddr/contrib/__pycache__/subnet_splitter.cpython-312.pyc

�

 �^���.�ddlmZmZmZGd�de�Zy)�)�	IPNetwork�cidr_exclude�
cidr_mergec�*�eZdZdZd�Zdd�Zd�Zd�Zy)�SubnetSplitterz�
    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�8�tt|�g�|_y)z�
        Constructor.

        :param base_cidr: an IPv4 or IPv6 address with a CIDR prefix.
            (see IPNetwork.__init__ for full details).
        N)�setr�_subnets)�self�	base_cidrs  �A/usr/lib/python3/dist-packages/netaddr/contrib/subnet_splitter.py�__init__zSubnetSplitter.__init__s���Y�y�1�2�3��
�Nc��|j�D]t}t|j||���}|s�"|j|�|jjt
t|t|�d���|_|cSgS)z;Extract 1 or more subnets of size specified by CIDR prefix.)�countr)	�available_subnets�list�subnet�
remove_subnetr
�unionr	rr)r�prefixr�cidr�subnetss     r
�extract_subnetzSubnetSplitter.extract_subnets����*�*�,�
	�D��4�;�;�v�U�;�;�<�G������t�$� �M�M�/�/�� ��z�'�':�1�'=�>���D�M�
�N�
	��	rc�4�t|jd�d��S)z2Returns a list of the currently available subnets.c��|jS�N)�	prefixlen)�xs r
�<lambda>z2SubnetSplitter.available_subnets.<locals>.<lambda>*s
��1�;�;�rT)�key�reverse)�sortedr
)rs r
rz SubnetSplitter.available_subnets(s���d�m�m�)>��M�Mrc�:�|jj|�y)z:Remove a specified IPNetwork from available address space.N)r
�remove)r�
ip_networks  r
rzSubnetSplitter.remove_subnet,s���
�
���Z�(rr)�__name__�
__module__�__qualname__�__doc__rrrr�rr
rr	s���4�
�N�)rrN)�
netaddr.iprrr�objectrr+rr
�<module>r.s��;�:�%)�V�%)r

Zerion Mini Shell 1.0