Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/netaddr/ip/__pycache__/sets.cpython-39.pyc
Ðазад
a ^�h�g � @ sd d Z ddlZddlmZmZmZmZmZm Z ddl mZmZm Z dd� Zdd� ZG d d � d e�ZdS )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 C s� | j j}|| }|j| jkr4|�|| j|jd f� |d7 }|}|t|�k r�|| }|| vr^q�|jd |jkrpn|�||jd |jd f� |d7 }|}q@|jd }| j} || kr�|�||| 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�subnetsZ subnet_idx�rangesr ZsubnetZprev_subnetZ cur_subnetr r � r �/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/netaddr/ip/sets.py� _subtract s( r c c s� | sdS | d \}}}| dd� D ]F\}}}||d krF||krF|}q"t ||�t ||�fV |}|}|}q"t ||�t ||�fV dS )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_versionZ current_startZcurrent_stopZnext_versionZ next_startZ next_stopr r r �_iter_merged_ranges8 s ��r c @ sH e Zd ZdZdZdGdd�Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� ZeZ dd� Zdd� ZdHdd�ZdIdd�Zdd� Zdd � Zd!d"� ZdJd#d$�Zd%d&� Zd'd(� Zd)d*� Zd+d,� Zd-d.� ZeZd/d0� Zd1d2� ZeZd3d4� ZeZ d5d6� Z!e!Z"d7d8� Z#e#Z$d9d:� Z%e%Z&d;d<� Z'e(d=d>� �Z)d?d@� Z*e*Z+dAdB� Z,dCdD� Z-dEdF� Z.dS )K�IPSetz[ Represents an unordered collection (set) of unique IP addresses and subnets. )�_cidrs�__weakref__Nr c C s� t |t�r|jdi| _n�t |t�r@t�t|d |d �d�| _nrt |t�r^t�|� � d�| _nTi | _|dur�g }|D ]$}t |t �r�t||d�}|�|� qtt |�D ]}d| j|<