File: //lib/python3.10/__pycache__/ipaddress.cpython-310.pyc
o
    E�h�/ �                   @   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                   @   �   e Zd ZdZdS )�AddressValueErrorz%A Value Error related to the address.N��__name__�
__module__�__qualname__�__doc__� r   r   � /usr/lib/python3.10/ipaddress.pyr      �    r   c                   @   r   )�NetmaskValueErrorz%A Value Error related to the netmask.Nr   r   r   r   r   r      r
   r   c              	   C   �R   zt | �W S  ttfy   Y nw zt| �W S  ttfy!   Y nw t| �d���)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 address)�IPv4Addressr   r   �IPv6Address�
ValueError��addressr   r   r   �
ip_address   s   
�
�r   Tc              	   C   sV   zt | |�W S  ttfy   Y nw zt| |�W S  ttfy#   Y nw t| �d���)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 network)�IPv4Networkr   r   �IPv6Networkr   )r   �strictr   r   r   �
ip_network9   s   ��r   c              	   C   r   )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 interface)�
IPv4Interfacer   r   �
IPv6Interfacer   r   r   r   r   �ip_interfaceV   s   
�
�r   c                 C   �&