
    ,h                         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y)zDNS TTL conversion.    )UnionNl    c                       e Zd ZdZy)BadTTLz!DNS TTL value is not well-formed.N)__name__
__module____qualname____doc__     I/var/www/html/Resume-Scraper/venv/lib/python3.12/site-packages/dns/ttl.pyr   r       s    +r   r   textreturnc                    | j                         rt        |       }nt        |       dk(  rt        d}d}d}| D ]  }|j                         r|dz  }|t        |      z  }d})|rt        |j	                         }|dk(  r	||dz  z  }nD|dk(  r	||dz  z  }n6|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
        kD  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!   $   s3    ||~D		Ta
 	"Ayy{23q6!"
 LGGI8Wv--E#XWu_,E#XWt^+E#XWr\)E#XW$E >!A!677!
-	". !|+,,qyEGOHIILr   valuec                     t        | t              r| S t        | t              rt        j                  j                  |       S t        d      )Nzcannot convert value to TTL)
isinstancer   strdnsttlr!   
ValueError)r"   s    r   maker)   V   s<    %	E3	ww  ''6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 8r   