XylotrechusZ
�
ǒ�g� � �h � d Z ddlZddlmZ ddlZdedefd�Zdeeef defd�Z deeef defd �Z
y)
zIPv4 helper functions.� N)�Union�address�returnc �| � t | � dk7 rt j j �d| d | d | d | d fz S )z�Convert an IPv4 address in binary form to text form.
*address*, a ``bytes``, the IPv4 address in binary form.
Returns a ``str``.
� z%u.%u.%u.%ur � � � )�len�dns� exception�SyntaxError)r s �7/opt/hc_python/lib/python3.12/site-packages/dns/ipv4.py� inet_ntoar sD � � �7�|�q���m�m�'�'�'��G�A�J���
�G�A�J���
�K�K�K� �textc �F � t | t � s| j � }n| }|j d� }t |� dk7 rt
j j �|D ]f }|j � st
j j �t |� dkD s�<|d t d� k( s�Nt
j j � |D �cg c]
}t |� �� }}t j dg|��� S c c}w # t $ r t
j j �w xY w)z�Convert an IPv4 address in text form to binary form.
*text*, a ``str`` or ``bytes``, the IPv4 address in textual form.
Returns a ``bytes``.
� .r r r �0�BBBB)�
isinstance�bytes�encode�splitr r r
r �isdigit�ord�int�struct�pack� Exception)r �btext�parts�part�bs r � inet_atonr% '