
    0                     0    S r SSKrSSKrSSKJr  S rS rg)zIPv4 helper functions.    N   )binary_typec                     [        U 5      S:w  a  [        R                  R                  e[	        U [
        5      (       d  [        U 5      n SU S   U S   U S   U S   4-  $ )zConvert an IPv4 address in binary form to text form.

*address*, a ``binary``, the IPv4 address in binary form.

Returns a ``text``.
   z%u.%u.%u.%ur   r         )lendns	exceptionSyntaxError
isinstance	bytearray)addresss    lib/third_party/dns/ipv4.py	inet_ntoar      sb     7|qmm'''gy))G$WQZ$QZ5 5 6    c                 F   [        U [        5      (       d  U R                  5       n U R                  S5      n[	        U5      S:w  a  [
        R                  R                  eU Hf  nUR                  5       (       d  [
        R                  R                  e[	        U5      S:  d  MC  US   S:X  d  MN  [
        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 !   [
        R                  R                  e= f)zConvert an IPv4 address in text form to binary form.

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

Returns a ``binary``.
   .r   r   r   0BBBB)r   r   encodesplitr	   r
   r   r   isdigitintstructpack)textpartspartbytess       r   	inet_atonr!   (   s     dK(({{}JJtE
5zQmm'''||~~--+++t9q=T!W^--+++ (',-utTu-{{6*E** .(mm'''s   D C?&D ?D D )__doc__r   dns.exceptionr
   _compatr   r   r!    r   r   <module>r&      s   $     6(r   