📁 File Manager Pro
v10.0.3 | PHP: 8.1.34
Server: Apache
2026-06-21 16:27:41
📂
/ (Root)
/
lib
/
python3.6
/
site-packages
/
netaddr
/
ip
/
__pycache__
📍 /lib/python3.6/site-packages/netaddr/ip/__pycache__
🔄 Refresh
✏️
Editing: sets.cpython-36.opt-1.pyc
Read Only
3 ��]�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|| j|jd f� |d7 }|}x\|t|�k r�|| }|| kr`P |jd |jkrrn|j||jd |jd f� |d7 }|}qBW |jd }| j} || kr�|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) �supernetZsubnetsZ subnet_idxZrangesr ZsubnetZprev_subnetZ cur_subnetr r � r �/usr/lib/python3.6/sets.py� _subtract s( r c c s� | sdS | d \}}}xV| dd� D ]F\}}}||d krH||krH|}q$t ||�t ||�fV |}|}|}q$W 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_rangesZcurrent_versionZ current_startZcurrent_stopZnext_versionZ next_startZ next_stopr r r �_iter_merged_ranges8 s r c @ sH e Zd ZdZdGZdHdd�Zdd� Zd d � Zdd� Zd d� Z dd� Z dd� Zdd� ZeZ dd� Zdd� ZdIdd�ZdJdd�Zdd� Zdd � Zd!d"� ZdKd#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 )L�IPSetz[ Represents an unordered collection (set) of unique IP addresses and subnets. �_cidrsNr c C s� t |t�r|jdi| _n�t |t�r@tjt|d |d �d�| _nzt |t�r^tj|j � d�| _n\i | _|dk r�g }x,|D ]$}t |t �r�t||d�}|j|� qvW xt |�D ]}d| j|<