f dZddlmZddlZdZGddej jZde de fd Z d ee e fde fd Z y) zDNS TTL conversion.)UnionNlceZdZdZy)BadTTLz!DNS TTL value is not well-formed.N)__name__ __module__ __qualname____doc__P/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/dns/ttl.pyrr s+r rtextreturnc|jr t|}nt|dk(rtd}d}d}|D]}|jr|dz}|t|z }d})|rt|j }|dk(r ||dzz }nC|dk(r ||dzz }n5|d k(r ||d zz }n'|d k(r ||d zz }n|d k(r||z }ntd|zd}d}|dk(s td|dks |t kDr td|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 totalcurrent need_digitcs r from_textr $s+ ||~D  Ta  Ayy{2 3q6!"  LGGI8Wv--E#XWu_,E#XWt^+E#XWr\)E#XW$E !4q!899! -.!|+, , qyEGOHII Lr valuect|tr|St|trtjj |St d)Nzcannot convert value to TTL) isinstancerstrdnsttlr ValueError)r!s r maker(Vs<% E3 ww  ''677r ) r typingr dns.exceptionr%r exception SyntaxErrorrr$rr r(r r r r-s\$ ,S]] & &,/C/C/d8c3h8C8r