
    Eqg                         d Z ddlmZ ddlZdZ G d dej        j                  Zde	de
fd	Zd
ee
e	f         de
fdZdS )zDNS TTL conversion.    )UnionNl    c                       e Zd ZdZdS )BadTTLz!DNS TTL value is not well-formed.N)__name__
__module____qualname____doc__     9/var/www/html/env/lib/python3.11/site-packages/dns/ttl.pyr   r       s        ++++r   r   textreturnc                 V   |                                  rt          |           }nt          |           dk    rt          d}d}d}| D ]}|                                 r|dz  }|t          |          z  }d}0|rt          |                                }|dk    r	||dz  z  }nL|dk    r	||dz  z  }n=|d	k    r	||d
z  z  }n.|dk    r	||dz  z  }n|dk    r||z  }nt          d| d          d}d}|dk    st          d          |dk     s|t
          k    rt          d          |S )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!   $   sz    ||~~  -D			Ta
 	" 	"Ayy{{ "23q66!"

 ! LGGII88Wv--EE#XXWu_,EE#XXWt^+EE#XXWr\)EE#XXW$EE !6!!6!6!6777!

!||+,,,qyyEGOOHIIILr   valuec                     t          | t                    r| S t          | t                    rt          j                            |           S t          d          )Nzcannot convert value to TTL)
isinstancer   strdnsttlr!   
ValueError)r"   s    r   maker)   V   sP    % 8	E3		 8w  '''6777r   )r	   typingr   dns.exceptionr&   r   	exceptionSyntaxErrorr   r%   r   r!   r)   r
   r   r   <module>r.      s   $             , , , , ,S]& , , ,/C /C / / / /d8c3h 8C 8 8 8 8 8 8r   