
    g                         S r SSKJr  SSKrSr " S S\R                  R                  5      rS\	S\
4S	 jrS
\\
\	4   S\
4S jrg)zDNS TTL conversion.    )UnionNl    c                       \ rS rSrSrSrg)BadTTL    z!DNS TTL value is not well-formed. N)__name__
__module____qualname____firstlineno____doc____static_attributes__r       @/home/matz/Project1/venv/lib/python3.13/site-packages/dns/ttl.pyr   r       s    +r   r   textreturnc                 &   U R                  5       (       a  [        U 5      nO[        U 5      S:X  a  [        eSnSnSnU  H  nUR                  5       (       a  US-  nU[        U5      -  nSnM/  U(       a  [        eUR	                  5       nUS:X  a  XS-  -  nODUS:X  a  XS-  -  nO6US	:X  a  XS
-  -  nO(US:X  a  XS-  -  nOUS:X  a  X-  nO[        SU S35      eSnSnM     US:X  d  [        S5      eUS:  d
  U[
        :  a  [        S5      eU$ )zConvert the text form of a TTL to an integer.

The BIND 8 units syntax for TTLs (e.g. '1w6d4h3m10s') is supported.

*text*, a ``str``, the textual TTL.

Raises ``dns.ttl.BadTTL`` if the TTL is not well-formed.

Returns an ``int``.
r   T
   Fwi:	 diQ hi  m<   szunknown unit ''ztrailing integerz1TTL should be between 0 and 2**32 - 1 (inclusive))isdigitintlenr   lowerMAX_TTL)r   totalcurrent
need_digitcs        r   	from_textr$   $   s(    ||~~D		Ta
Ayy{{23q6!"
 LGGI8v--E#Xu_,E#Xt^+E#Xr\)E#X$E >!A!677!
- . !|+,,qyEGOHIILr   valuec                     [        U [        5      (       a  U $ [        U [        5      (       a  [        R                  R                  U 5      $ [        S5      e)Nzcannot convert value to TTL)
isinstancer   strdnsttlr$   
ValueError)r%   s    r   maker,   V   sB    %	E3		ww  ''677r   )r   typingr   dns.exceptionr)   r   	exceptionSyntaxErrorr   r(   r   r$   r,   r   r   r   <module>r1      s\   $    ,S]]&& ,/C /C /d8c3h 8C 8r   