
    g	                     n    S r SSKrSSKJr  SSKrS\S\4S jrS\\\4   S\4S jr	S\\\4   S\4S	 jr
g)
zIPv4 helper functions.    N)Unionaddressreturnc                 ~    [        U 5      S:w  a  [        R                  R                  eSU S   U S   U S   U S   4-  $ )zConvert 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    A/home/matz/Project1/venv/lib/python3.13/site-packages/dns/ipv4.py	inet_ntoar      sD     7|qmm'''GAJ
GAJ
KKK    textc                 p   [        U [        5      (       d  U R                  5       nOU nUR                  S5      n[	        U5      S:w  a  [
        R                  R                  eU Ho  nUR                  5       (       d  [
        R                  R                  e[	        U5      S:  d  MC  US   [        S5      :X  d  MW  [
        R                  R                  e    U Vs/ s H  n[        U5      PM     nn[        R                  " S/UQ76 $ s  snf ! [         a    [
        R                  R                  ef = f)zConvert 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%   '   s     dE""KKE
5zQmm'''||~~--+++t9q=T!WC0--+++ (#()54SY5){{6&A&& * (mm'''(s   D D2D D %D5c                 z    [         R                  R                  [         R                  R                  U 5      5      $ )zVerify that *address* is a valid text form IPv4 address and return its
canonical text form.

*text*, a ``str`` or ``bytes``, the IPv4 address in textual form.

Raises ``dns.exception.SyntaxError`` if the text is not valid.
)r   ipv4r   r%   )r   s    r   canonicalizer(   C   s(     88chh00677r   )__doc__r   typingr   dns.exceptionr   r   strr   r%   r(    r   r   <module>r.      sa   $    
Lu 
L 
L(E#u*% (% (8
8uS%Z( 
8S 
8r   