%PDF- %PDF-
Direktori : /lib/python3/dist-packages/netaddr/ip/__pycache__/ |
Current File : //lib/python3/dist-packages/netaddr/ip/__pycache__/sets.cpython-312.pyc |
� ���^�g � �f � d Z ddlZddlmZmZmZmZmZm Z ddl mZmZm Z d� Zd� Z G d� de� Zy) z2Set based operations for IP addresses and subnets.� N)� IPNetwork� IPAddress�IPRange� cidr_merge�cidr_exclude�iprange_to_cidrs)�_sys_maxint� _dict_keys� _int_typec �, � | j j }|| }|j | j kD r+|j || j |j dz f� |dz }|}|t |� k rk|| }|| vrna|j dz |j k( rn.|j ||j dz |j dz f� |dz }|}|t |� k r�k|j dz }| j } || k r|j ||| f� |S )a� 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). � )�_module�version�first�append�len�last) �supernet�subnets� subnet_idx�rangesr �subnet�prev_subnet� cur_subnetr r s �1/usr/lib/python3/dist-packages/netaddr/ip/sets.py� _subtractr s � � ���&�&�G� �Z� �F� �|�|�h�n�n�$�� � �w�������q�0@�A�B��!�O�J��K� �s�7�|� #��Z�(� ��X�%�����a��:�#3�#3�3���M�M�7�K�$4�$4�q�$8�*�:J�:J�Q�:N�O�P��a�� � �� �s�7�|� #� ���q� �E��=�=�D���}�� � �w��t�,�-��� c # �� K � | sy| d \ }}}| dd D ]6 \ }}}||dz k( r||k( r|}�t ||� t ||� f�� |}|}|}�8 t ||� t ||� f�� y�w)aq 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. Nr r )r )� sorted_ranges�current_version� current_start�current_stop�next_version� next_start� next_stops r �_iter_merged_rangesr&