a àMÒe ã@s,dZddlmZddlZGdd„deƒZdS)zDNS name dictionaryé)ÚMutableMappingNcsheZdZdZgd¢Z‡fdd„Zdd„Zdd„Zd d „Zd d „Z d d„Z dd„Z dd„Z dd„Z ‡ZS)ÚNameDictz·A dictionary whose keys are dns.name.Name objects. In addition to being like a regular Python dictionary, this dictionary can also get the deepest match for a given key. )Ú max_depthÚmax_depth_itemsZ__storecs6tƒ ¡tƒ|_d|_d|_| t|i|¤Ž¡dS)Nr)ÚsuperÚ__init__ÚdictÚ_NameDict__storerrÚupdate)ÚselfÚargsÚkwargs©Ú __class__©ú0/usr/lib/python3.9/site-packages/dns/namedict.pyr-s  zNameDict.__init__cCs>t|ƒ|jkr|jd|_nt|ƒ|jkr:t|ƒ|_d|_dS)Né)Úlenrr©r ÚkeyrrrZ__update_max_depth6s  zNameDict.__update_max_depthcCs |j|S©N©r rrrrÚ __getitem__=szNameDict.__getitem__cCs.t|tjjƒstdƒ‚||j|<| |¡dS)NzNameDict key must be a name)Ú isinstanceÚdnsÚnameÚNameÚ ValueErrorr Ú_NameDict__update_max_depth)r rÚvaluerrrÚ __setitem__@s zNameDict.__setitem__cCsP|j |¡t|ƒ|jkr&|jd|_|jdkrLd|_|jD]}| |¡qs