HEX
Server: Apache
System: Linux 95-217-38-122.cprapid.com 5.14.0-427.33.1.el9_4.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 30 09:45:56 EDT 2024 x86_64
User: targetplatform (1004)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3.9/site-packages/dns/__pycache__/ttl.cpython-39.opt-1.pyc
a

�M�e��@s\dZddlmZddlZdZGdd�dejj�Ze	e
d�dd	�Zee
e	fe
d
�dd�ZdS)
zDNS TTL conversion.�)�UnionNl��c@seZdZdZdS)�BadTTLz!DNS TTL value is not well-formed.N)�__name__�
__module__�__qualname__�__doc__�rr�+/usr/lib/python3.9/site-packages/dns/ttl.pyr sr)�text�returncCs|��rt|�}n�t|�dkr$t�n�d}d}d}|D]�}|��rZ|d9}|t|�7}d}q4|rbt�|��}|dkr�||d7}n`|dkr�||d7}nJ|d	kr�||d
7}n4|dkr�||d7}n|d
kr�||7}ntd|��d}d}q4|dks�td��|dk�s|tk�rtd��|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�currentZ
need_digit�crrr	�	from_text$sB

r)�valuercCs0t|t�r|St|t�r$tj�|�Std��dS)Nzcannot convert value to TTL)�
isinstancer�str�dnsZttlr�
ValueError)rrrr	�makeVs


r!)
r�typingrZ
dns.exceptionrr�	exception�SyntaxErrorrrrrr!rrrr	�<module>s2