f hdZddlZddlmZddlZdedefdZdeeefdefdZ deeefdefd Z y) zIPv4 helper functions.N)Unionaddressreturnc|t|dk7rtjjd|d|d|d|dfzS)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)lendns exception SyntaxError)rs Q/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/dns/ipv4.py inet_ntoarsD 7|qmm''' GAJ GAJ K KKtextcFt|ts|j}n|}|jd}t |dk7rt j j|D]f}|jst j jt |dkDs<|dtdk(sNt j j |Dcgc] }t|}}tjdg|Scc}w#t$rt j jwxYw)zConvert an IPv4 address in text form to binary form. *text*, a ``str`` or ``bytes``, the IPv4 address in textual form. Returns a ``bytes``. .rrr0BBBB) isinstancebytesencodesplitr r r risdigitordintstructpack Exception)rbtextpartspartbs r inet_atonr%'s dE "  KK E 5zQmm'''||~--++ + t9q=T!WC0--++ +  (#( )4SY ) ){{6&A&& * (mm'''(s C< C7C<7C<<$D cztjjtjj|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 ipv4rr%)rs r canonicalizer(Cs( 88  chh006 77r) __doc__rtypingr dns.exceptionr rstrrr%r(rrr.sa$  Lu L L(E#u*%(%(8 8uS%Z( 8S 8r