f# ddlZGddZy)NceZdZdZdgZd*dZdZdZdZdZ d Z d+d Z d Z d Z d ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ d Z!d!Z"d"Z#d#Z$d$Z%d%Z&d&Z'd'Z(d(Z)d)Z*y),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. itemsNcXt|_||D]}|j|yy)zaInitialize the set. *items*, an iterable or ``None``, the initial set of items. N)dictradd)selfritems P/var/lib/jenkins/workspace/mettalog/venv/lib/python3.12/site-packages/dns/set.py__init__z Set.__init__ s/ V   c`dtt|jjzS)Nzdns.set.Set(%s))reprlistrkeysr s r __repr__z Set.__repr__-s" 4TZZ__->(?#@@@r c@||jvrd|j|<yy)zAdd an item to the set.Nrr r s r rzSet.add0s# tzz !#DJJt  "r cF |j|=y#t$rtwxYw)zRemove an item from the set.N)rKeyError ValueErrorrs r removez Set.remove6s(  4    s  c<|jj|dy)z'Remove an item from the set if present.N)rpoprs r discardz Set.discard>s tT"r c@|jj\}}|S)z&Remove an arbitrary item from the set.)rpopitem)r k_s r rzSet.popCs##%Ar ct|dr |j}n |j}|j|}t |_|j j |j |S)aMake 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__rrupdate)r clsobjs r _clonez Set._cloneHsT 4 (##C..Ckk#F  $ r c"|jSz!Make a (shallow) copy of the set.r*rs r __copy__z Set.__copy__^{{}r c"|jSr,r-rs r copyzSet.copycr/r ct|ts td||ury|jD]}|j |y)zaUpdate the set, adding any elements from other which are not already in the set. other must be a Set instanceN) isinstancerrrrr otherr s r union_updatezSet.union_updatehs= %%;< < 5= KKD HHTN r ct|ts td||uryt|jD]}||jvs|j|= y)z]Update the set, removing any elements from other which are not in both sets. r3N)r4rrrrr5s r intersection_updatezSet.intersection_updatetsQ %%;< < 5= $D5;;&JJt$%r ct|ts td||ur|jj y|jD]}|j |y)zWUpdate the set, removing any elements from other which are in the set. r3N)r4rrrclearrr5s r difference_updatezSet.difference_updatesK %%;< < 5= JJ     T"$r ct|ts td||ur|jj y|j |}|j ||j|y)zzSet.intersections"kkm & r cH|j}|j||S)zReturn a new set which ``self`` - ``other``, i.e. the items in ``self`` which are not also in ``other``. Returns the same Set type as this set. )r*r<rBs r differencezSet.differences"kkm e$ r cH|j}|j||S)zReturn a new set which (``self`` - ``other``) | (``other`` - ``self), ie: the items in either ``self`` or ``other`` which are not contained in their intersection. Returns the same Set type as this set. )r*r@rBs r symmetric_differencezSet.symmetric_differences"kkm ''. r c$|j|SNrCr r6s r __or__z Set.__or__zz%  r c$|j|SrJ)r>rLs r __and__z Set.__and__s  ''r c$|j|SrJrKrLs r __add__z Set.__add__rNr c$|j|SrJ)rFrLs r __sub__z Set.__sub__su%%r c$|j|SrJ)rHrLs r __xor__z Set.__xor__s((//r c(|j||SrJr7rLs r __ior__z Set.__ior__ %  r c(|j||SrJ)r9rLs r __iand__z Set.__iand__s   ' r c(|j||SrJrXrLs r __iadd__z Set.__iadd__rZr c(|j||SrJ)r<rLs r __isub__z Set.__isub__s u% r c(|j||SrJ)r@rLs r __ixor__z Set.__ixor__s ((/ r c4|D]}|j|y)zUpdate the set, adding any elements from other which are not already in the set. *other*, the collection of items with which to update the set, which may be any iterable type. N)rr5s r r'z Set.updatesD HHTNr c8|jjy)zMake the set empty.N)rr;rs r r;z Set.clears r c4|j|jk(SrJrrLs r __eq__z Set.__eq__szzU[[((r c&|j| SrJ)rfrLs r __ne__z Set.__ne__s;;u%%%r c,t|jSrJ)lenrrs r __len__z Set.__len__s4::r c,t|jSrJ)iterrrs r __iter__z Set.__iter__sDJJr ct|trIttj|j |j |j|jSttj|j ||dzS)N) r4slicer itertoolsislicerstartstopstepnext)r is r __getitem__zSet.__getitem__sZ a  ((QWWaffaffMN N ((QA>? ?r ct|tr!t||D]}|j|=y|j||=yrJ)r4rqrr)r rxelts r __delitem__zSet.__delitem__ s; a DG}JJsO% 47#r c|t|ts td|jD]}||jvsyy)zFIs this set a subset of *other*? Returns a ``bool``. r3FTr4rrrr5s r issubsetz Set.issubsets< %%;< <JJD5;;&r c|t|ts td|jD]}||jvsyy)zHIs this set a superset of *other*? Returns a ``bool``. r3FTr~r5s r issupersetzSet.issuperset s< %%;< <KKD4::% r c|t|ts td|jD]}||jvsyy)Nr3FTr~r5s r isdisjointzSet.isdisjoint-s:%%;< <KKDtzz! r rJ)returnr)+__name__ __module__ __qualname____doc__ __slots__r rrrrrr*r.r1r7r9r<r@rCr>rFrHrMrPrRrTrVrYr\r^r`rbr'r;rfrhrkrnryr|rrrr r rrs I A$ #  ,   % # ,   !(!&0 )& @ $  r r)rrrrr r rs$^^r