3 bW@s8dZddlZddlmZGdddejjZddZdS) 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*|jrt|}n|djs"ttd}td}x|D]}|jrZ|d9}|t|7}q8|j}|dkr|||td7}nl|dkr||td7}nR|dkr||td7}n8|d kr||td 7}n|d kr||7}n td |d}q8W|dkstd |tdks|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: diQhim<szunknown unit '%s'ztrailing integeriz0TTL should be between 0 and 2^31 - 1 (inclusive))isdigitrrlower)textZtotalZcurrentcr r r from_texts8       r) rZ dns.exceptionZdnsZ_compatrZ exception SyntaxErrorrrr r r r s