3 ¢báW]ã@s6dZddlZddlZddlmZGdd„dejƒZdS)zDNS name dictionaryéNé)Úxrangec@sbeZdZdZdddgZdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dd„Z dd„Z dS)ÚNameDictaA dictionary whose keys are dns.name.Name objects. @ivar max_depth: the maximum depth of the keys that have ever been added to the dictionary. @type max_depth: int @ivar max_depth_items: the number of items of maximum depth @type max_depth_items: int Ú max_depthÚmax_depth_itemsZ__storecOs(tƒ|_d|_d|_|jt||ŽƒdS)Nr)ÚdictÚ_NameDict__storerrÚupdate)ÚselfÚargsÚkwargs©r ú/usr/lib/python3.6/namedict.pyÚ__init__-szNameDict.__init__cCs>t|ƒ|jkr|jd|_nt|ƒ|jkr:t|ƒ|_d|_dS)Nr)Úlenrr)r Úkeyr r rZ__update_max_depth3s  zNameDict.__update_max_depthcCs |j|S)N)r)r rr r rÚ __getitem__:szNameDict.__getitem__cCs.t|tjjƒstdƒ‚||j|<|j|ƒdS)NzNameDict key must be a name)Ú isinstanceÚdnsÚnameÚNameÚ ValueErrorrÚ_NameDict__update_max_depth)r rÚvaluer r rÚ __setitem__=s zNameDict.__setitem__cCsT|jj|ƒ}t|ƒ|jkr&|jd|_|jdkrPd|_x|jD]}|j|ƒq>WdS)Nrr)rÚpoprrrr)r rrÚkr r rÚ __delitem__Cs    zNameDict.__delitem__cCs t|jƒS)N)Úiterr)r r r rÚ__iter__LszNameDict.__iter__cCs t|jƒS)N)rr)r r r rÚ__len__OszNameDict.__len__cCs ||jkS)N)r)r rr r rÚhas_keyRszNameDict.has_keycCsnt|ƒ}||jkr|j}xs