3
bW @ s8 d Z ddlZddlmZ G dd dejjZdd ZdS ) zDNS TTL conversion. N )longc @ s e Zd ZdZdS )BadTTLz!DNS TTL value is not well-formed.N)__name__
__module____qualname____doc__ r r /usr/lib/python3.6/ttl.pyr s r c C s* | j rt| }n| d j s"ttd}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 }ntd| d}q8W |dkstd
|tdk s|tdkr&td|S )zConvert 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: diQ hi m<