Your IP : 3.15.10.117


Current Path : /usr/lib/python3.6/site-packages/dns/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/dns/__pycache__/ttl.cpython-36.opt-1.pyc

3

�b�W��@s8dZddlZddlmZGdd�dejj�Zdd�ZdS)	zDNS TTL conversion.�N�)�longc@seZdZdZdS)�BadTTLz!DNS TTL value is not well-formed.N)�__name__�
__module__�__qualname__�__doc__�r	r	�/usr/lib/python3.6/ttl.pyrsrcCs*|j�rt|�}n�|dj�s"t�td�}td�}x�|D]�}|j�rZ|d9}|t|�7}q8|j�}|dkr|||td�7}nl|dkr�||td�7}nR|dkr�||td�7}n8|d	kr�||td
�7}n|dkr�||7}ntd|��d}q8W|dk�std
��|td�k�s|td�k�r&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.

    @param text: the textual TTL
    @type text: string
    @raises dns.ttl.BadTTL: the TTL is not well-formed
    @rtype: int
    r�
�wi�:	�di�Q�hi�m�<�szunknown unit '%s'ztrailing integeri���z0TTL should be between 0 and 2^31 - 1 (inclusive))�isdigitrr�lower)�textZtotalZcurrent�cr	r	r
�	from_texts8



r)	rZ
dns.exceptionZdnsZ_compatrZ	exception�SyntaxErrorrrr	r	r	r
�<module>s

?>