HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //home/arjun/projects/env/lib/python3.10/site-packages/dns/__pycache__/ttl.cpython-310.pyc
o

!we��@s`dZddlmZddlZdZGdd�dejj�Zde	de
fd	d
�Zdee
e	fde
fdd
�ZdS)zDNS TTL conversion.�)�UnionNl��c@seZdZdZdS)�BadTTLz!DNS TTL value is not well-formed.N)�__name__�
__module__�__qualname__�__doc__�rr�@/home/arjun/projects/env/lib/python3.10/site-packages/dns/ttl.pyr sr�text�returncCs|��r	t|�}nst|�dkrt�d}d}d}|D]Z}|��r,|d9}|t|�7}d}q|r0t�|��}|dkr?||d7}n0|dkrJ||d7}n%|d	krU||d
7}n|dkr`||d7}n|d
kri||7}ntd|��d}d}q|dks|td��|dks�|tkr�td��|S)z�Convert 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``.
    rT�
F�wi�:	�di�Q�hi�m�<�szunknown unit '%s'ztrailing integerz1TTL should be between 0 and 2**32 - 1 (inclusive))�isdigit�int�lenr�lower�MAX_TTL)r
�total�current�
need_digit�crrr	�	from_text$sB

r�valuecCs,t|t�r|St|t�rtj�|�Std��)Nzcannot convert value to TTL)�
isinstancer�str�dns�ttlr�
ValueError)rrrr	�makeVs


r#)
r�typingr�
dns.exceptionr r�	exception�SyntaxErrorrrrrr#rrrr	�<module>s2