U mf @s\dZddlmZddlZdZGdddejjZe e ddd Z ee e fe d d d Z dS) zDNS TTL conversion.)UnionNlc@seZdZdZdS)BadTTLz!DNS TTL value is not well-formed.N)__name__ __module__ __qualname____doc__rr5/opt/hc_python/lib/python3.8/site-packages/dns/ttl.pyr sr)textreturncCs|rt|}nt|dkr$tnd}d}d}|D]}|rZ|d9}|t|7}d}q4|rbt|}|dkr||d7}n`|dkr||d7}nJ|d kr||d 7}n4|d kr||d 7}n|d kr||7}n td|d}d}q4|dkstd|dks|tkrtd|S)zConvert 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 Fwi: diQhim<szunknown unit '%s'ztrailing integerz1TTL should be between 0 and 2**32 - 1 (inclusive))isdigitintlenrlowerMAX_TTL)r totalcurrentZ need_digitcrrr from_text$sB      r)valuer cCs0t|tr|St|tr$tj|StddS)Nzcannot convert value to TTL) isinstancerstrdnsttlr ValueError)rrrr makeVs    r") rtypingrZ dns.exceptionrr exception SyntaxErrorrrrrr"rrrr s  2