a àMÒe€#ã@sddlZGdd„dƒZdS)éNc@sNeZdZdZdgZdQdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z ddœdd„Z dd„Z dd„Z dd„Zdd„Zdd„Zdd„Zdd „Zd!d"„Zd#d$„Zd%d&„Zd'd(„Zd)d*„Zd+d,„Zd-d.„Zd/d0„Zd1d2„Zd3d4„Zd5d6„Zd7d8„Zd9d:„Zd;d<„Z d=d>„Z!d?d@„Z"dAdB„Z#dCdD„Z$dEdF„Z%dGdH„Z&dIdJ„Z'dKdL„Z(dMdN„Z)dOdP„Z*dS)RÚSeta!A simple set class. This class was originally used to deal with sets being missing in ancient versions of python, but dnspython will continue to use it as these sets are based on lists and are thus indexable, and this ability is widely used in dnspython applications. ÚitemsNcCs(tƒ|_|dur$|D]}| |¡qdS)zaInitialize the set. *items*, an iterable or ``None``, the initial set of items. N)ÚdictrÚadd)ÚselfrÚitem©rú+/usr/lib/python3.9/site-packages/dns/set.pyÚ__init__ sz Set.__init__cCsdtt|j ¡ƒƒS)Nzdns.set.Set(%s))ÚreprÚlistrÚkeys©rrrr Ú__repr__-sz Set.__repr__cCs||jvrd|j|<dS)zAdd an item to the set.N©r©rrrrr r0s zSet.addcCs(z |j|=Wnty"t‚Yn0dS)zRemove an item from the set.N)rÚKeyErrorÚ ValueErrorrrrr Úremove6s  z Set.removecCs|j |d¡dS)z'Remove an item from the set if present.N)rÚpoprrrr Údiscard>sz Set.discardcCs|j ¡\}}|S)z&Remove an arbitrary item from the set.)rÚpopitem)rÚkÚ_rrr rCszSet.pop)ÚreturncCs<t|dƒr|j}n|j}| |¡}tƒ|_|j |j¡|S)aÞMake a (shallow) copy of the set. There is a 'clone protocol' that subclasses of this class should use. To make a copy, first call your super's _clone() method, and use the object returned as the new instance. Then make shallow copies of the attributes defined in the subclass. This protocol allows us to write the set algorithms that return new instances (e.g. union) once, and keep using them in subclasses. Ú _clone_class)ÚhasattrrÚ __class__Ú__new__rrÚupdate)rÚclsÚobjrrr Ú_cloneHs  z Set._clonecCs| ¡S©z!Make a (shallow) copy of the set.©r"rrrr Ú__copy__^sz Set.__copy__cCs| ¡Sr#r$rrrr ÚcopycszSet.copycCs8t|tƒstdƒ‚||urdS|jD]}| |¡q$dS)zaUpdate the set, adding any elements from other which are not already in the set. úother must be a Set instanceN)Ú isinstancerrrr©rÚotherrrrr Ú union_updatehs   zSet.union_updatecCsDt|tƒstdƒ‚||urdSt|jƒD]}||jvr(|j|=q(dS)z]Update the set, removing any elements from other which are not in both sets. r'N)r(rrr rr)rrr Úintersection_updatets  zSet.intersection_updatecCs@t|tƒstdƒ‚||ur&|j ¡n|jD]}| |¡q,dS)zWUpdate the set, removing any elements from other which are in the set. r'N)r(rrrÚclearrr)rrr Údifference_updateƒs    zSet.difference_updatecCsHt|tƒstdƒ‚||ur&|j ¡n| |¡}| |¡| |¡dS)zr?r@rArBrr-rCrDrFrHrRrTrVrWrXrrrr rsP           r)rKrrrrr Ús