AlkantarClanX12
Current Path : /proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/ |
Current File : //proc/self/root/opt/alt/python39/lib64/python3.9/__pycache__/ipaddress.cpython-39.opt-1.pyc |
a R�f+0 � @ s� d Z dZddlZdZdZG dd� de�ZG dd � d e�Zd d� Zd=d d�Z dd� Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� Zdd� Zdd � Zd!d"� ZG d#d$� d$�ZdaejG d%d&� d&e��ZejG d'd(� d(e��ZG d)d*� d*�ZG d+d,� d,ee�ZG d-d.� d.e�ZG d/d0� d0ee�ZG d1d2� d2�Zee_G d3d4� d4�ZG d5d6� d6ee�Z G d7d8� d8e �Z!G d9d:� d:ee�Z"G d;d<� d<�Z#e#e _dS )>z�A fast, lightweight IPv4/IPv6 manipulation library in Python. This library is used to create/poke/manipulate IPv4 and IPv6 addresses and networks. z1.0� N� � c @ s e Zd ZdZdS )�AddressValueErrorz%A Value Error related to the address.N��__name__� __module__�__qualname__�__doc__� r r �./opt/alt/python39/lib64/python3.9/ipaddress.pyr s r c @ s e Zd ZdZdS )�NetmaskValueErrorz%A Value Error related to the netmask.Nr r r r r r s r c C sV z t | �W S ttfy Y n0 z t| �W S ttfyB Y n0 t| �d���dS )a� Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Address or IPv6Address object. Raises: ValueError: if the *address* passed isn't either a v4 or a v6 address z. does not appear to be an IPv4 or IPv6 addressN)�IPv4Addressr r �IPv6Address� ValueError��addressr r r � ip_address s r Tc C sZ zt | |�W S ttfy" Y n0 zt| |�W S ttfyF Y n0 t| �d���dS )a� Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP network. Either IPv4 or IPv6 networks may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Network or IPv6Network object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Or if the network has host bits set. z. does not appear to be an IPv4 or IPv6 networkN)�IPv4Networkr r �IPv6Networkr )r �strictr r r � ip_network8 s r c C sV z t | �W S ttfy Y n0 z t| �W S ttfyB Y n0 t| �d���dS )ag Take an IP string/int and return an object of the correct type. Args: address: A string or integer, the IP address. Either IPv4 or IPv6 addresses may be supplied; integers less than 2**32 will be considered to be IPv4 by default. Returns: An IPv4Interface or IPv6Interface object. Raises: ValueError: if the string passed isn't either a v4 or a v6 address. Notes: The IPv?Interface classes describe an Address on a particular Network, so they're basically a combination of both the Address and Network classes. z0 does not appear to be an IPv4 or IPv6 interfaceN)� IPv4Interfacer r � IPv6Interfacer r r r r �ip_interfaceU s r c C s. z| � dd�W S ty( td��Y n0 dS )a` Represent an address as 4 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv4 IP address. Returns: The integer address packed as 4 bytes in network (big-endian) order. Raises: ValueError: If the integer is negative or too large to be an IPv4 IP address. � �bigz&Address negative or too large for IPv4N��to_bytes� OverflowErrorr r r r r �v4_int_to_packedw s r c C s. z| � dd�W S ty( td��Y n0 dS )z�Represent an address as 16 packed bytes in network (big-endian) order. Args: address: An integer representation of an IPv6 IP address. Returns: The integer address packed as 16 bytes in network (big-endian) order. � r z&Address negative or too large for IPv6Nr r r r r �v6_int_to_packed� s r! c C s, t | ��d�}t|�dkr(td| ����|S )zAHelper to split the netmask and raise AddressValueError if needed�/� zOnly one '/' permitted in )�str�split�lenr )r �addrr r r �_split_optional_netmask� s r( c c sN t | �}t|� }}|D ]&}|j|jd kr:||fV |}|}q||fV dS )z�Find a sequence of sorted deduplicated IPv#Address. Args: addresses: a list of IPv#Address objects. Yields: A tuple containing the first and last IP addresses in the sequence. � N)�iter�next�_ip)� addresses�it�first�last�ipr r r �_find_address_range� s r2 c C s$ | dkr|S t || | d @ �� �S )z�Count the number of zero bits on the right hand side. Args: number: an integer. bits: maximum number of bits to count. Returns: The number of zero bits on the right hand side of the number. r r) )�min� bit_length)Znumber�bitsr r r �_count_righthand_zero_bits� s r6 c c s� t | t�rt |t�std��| j|jkr8td| |f ��| |krHtd��| jdkrXt}n| jdkrht}ntd��| j}| j}|j}||kr�t t ||�|| d �� d �}|||| f�}|V |d|>