
    hy                     x    d Z ddlZdZ G d dej                  j
                        ZdedefdZ	d	eez  defd
Z
y)zDNS TTL conversion.    Nl    c                       e Zd ZdZy)BadTTLz!DNS TTL value is not well-formed.N)__name__
__module____qualname____doc__     E/var/www/html/eduruby.in/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                 r    t        | t              r| S t        | t              rt        |       S t	        d      )Nzcannot convert value to TTL)
isinstancer   strr    
ValueError)r!   s    r   maker&   T   s2    %	E3	677r
   )r   dns.exceptiondnsr   	exceptionSyntaxErrorr   r$   r   r    r&   r	   r
   r   <module>r+      sU   $   ,S]]&& ,/C /C /d8c	 8c 8r
   