
    Eqg	                     v    d Z ddlZddlmZ ddlZdedefdZdeeef         defdZ	deeef         defd	Z
dS )
zIPv4 helper functions.    N)Unionaddressreturnc                     t          |           dk    rt          j        j        d| d         | d         | d         | d         fz  S )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    :/var/www/html/env/lib/python3.11/site-packages/dns/ipv4.py	inet_ntoar      sD     7||qm''GAJ
GAJ
KKK    textc                    t          | t                    s|                                 }n| }|                    d          }t	          |          dk    rt
          j        j        |D ]d}|                                st
          j        j        t	          |          dk    r*|d         t          d          k    rt
          j        j        e	 d |D             }t          j        dg|R  S # t          $ r t
          j        j        w xY w)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   0c                 ,    g | ]}t          |          S  )int).0parts     r   
<listcomp>zinet_aton.<locals>.<listcomp>=   s    )))4SYY)))r   BBBB)
isinstancebytesencodesplitr   r   r   r   isdigitordstructpack	Exception)r   btextpartsr   bs        r   	inet_atonr)   '   s    dE"" KKE
5zzQm'' , ,||~~ 	,-++t99q==T!WC00-++())5))){6&A&&&& ( ( (m''(s   C, ,Dc                 z    t           j                            t           j                            |                     S )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*     8ch0066777r   )__doc__r#   typingr   dns.exceptionr   r   strr   r)   r,   r   r   r   <module>r1      s   $             
Lu 
L 
L 
L 
L 
L(E#u*% (% ( ( ( (8
8uS%Z( 
8S 
8 
8 
8 
8 
8 
8r   