관리-도구
편집 파일: set.cpython-39.opt-1.pyc
a �����M�e�#����������������������@���s���d�dl�Z�G�dd��d�ZdS�)�����Nc�������������������@���sN��e�Zd�ZdZdgZdQdd�Zdd��Zdd ��Zd d��Zdd ��Z dd��Z d�d�dd�Zdd��Zdd��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. �itemsNc�����������������C���s(���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__ ���s����zSet.__init__c�����������������C���s���dt�t|�j������S�)Nzdns.set.Set(%s))�repr�listr����keys�r���r���r���r ����__repr__-���s����zSet.__repr__c�����������������C���s���||�j�vrd|�j�|<�dS�)zAdd an item to the set.N�r����r���r���r���r���r ���r���0���s���� zSet.addc�����������������C���s(���z|�j�|=�W�n�ty"���t�Y�n0�dS�)zRemove an item from the set.N)r����KeyError� ValueErrorr���r���r���r ����remove6���s����z Set.removec�����������������C���s���|�j��|d��dS�)z'Remove an item from the set if present.N)r����popr���r���r���r ����discard>���s����zSet.discardc�����������������C���s���|�j����\}}|S�)z&Remove an arbitrary item from the set.)r����popitem)r����k�_r���r���r ���r���C���s����zSet.pop)�returnc�����������������C���s<���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__r���r����update)r����cls�objr���r���r ����_cloneH���s���� z Set._clonec�����������������C���s���|�����S��z!Make a (shallow) copy of the set.�r"���r���r���r���r ����__copy__^���s����zSet.__copy__c�����������������C���s���|�����S�r#���r$���r���r���r���r ����copyc���s����zSet.copyc�����������������C���s8���t�|t�std��|�|u�rdS�|jD�]}|��|��q$dS�)zaUpdate the set, adding any elements from other which are not already in the set. �other must be a Set instanceN)� isinstancer���r���r���r����r����otherr���r���r���r ����union_updateh���s���� zSet.union_updatec�����������������C���sD���t�|t�std��|�|u�rdS�t|�j�D�]}||jvr(|�j|=�q(dS�)z]Update the set, removing any elements from other which are not in both sets. r'���N)r(���r���r���r���r���r)���r���r���r ����intersection_updatet���s���� zSet.intersection_updatec�����������������C���s@���t�|t�std��|�|u�r&|�j����n|jD�]}|��|��q,dS�)zWUpdate the set, removing any elements from other which are in the set. r'���N)r(���r���r���r����clearr���r)���r���r���r ����difference_update����s���� zSet.difference_updatec�����������������C���sH���t�|t�std��|�|u�r&|�j����n|��|�}|��|��|��|��dS�)z<Update the set, retaining only elements unique to both sets.r'���N)r(���r���r���r���r-����intersectionr+���r.���)r���r*���Zoverlapr���r���r ����symmetric_difference_update����s���� zSet.symmetric_difference_updatec�����������������C���s���|�����}|�|��|S�)zwReturn a new set which is the union of ``self`` and ``other``. Returns the same Set type as this set. )r"���r+����r���r*���r!���r���r���r ����union����s���� z Set.unionc�����������������C���s���|�����}|�|��|S�)z�Return a new set which is the intersection of ``self`` and ``other``. Returns the same Set type as this set. )r"���r,���r1���r���r���r ���r/�������s���� zSet.intersectionc�����������������C���s���|�����}|�|��|S�)z�Return 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.���r1���r���r���r ���� difference����s���� zSet.differencec�����������������C���s���|�����}|�|��|S�)z�Return 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"���r0���r1���r���r���r ����symmetric_difference����s���� zSet.symmetric_differencec�����������������C���s ���|���|�S��N�r2����r���r*���r���r���r ����__or__����s����z Set.__or__c�����������������C���s ���|���|�S�r5���)r/���r7���r���r���r ����__and__����s����zSet.__and__c�����������������C���s ���|���|�S�r5���r6���r7���r���r���r ����__add__����s����zSet.__add__c�����������������C���s ���|���|�S�r5���)r3���r7���r���r���r ����__sub__����s����zSet.__sub__c�����������������C���s ���|���|�S�r5���)r4���r7���r���r���r ����__xor__����s����zSet.__xor__c�����������������C���s���|���|��|�S�r5����r+���r7���r���r���r ����__ior__����s���� zSet.__ior__c�����������������C���s���|���|��|�S�r5���)r,���r7���r���r���r ����__iand__����s���� zSet.__iand__c�����������������C���s���|���|��|�S�r5���r=���r7���r���r���r ����__iadd__����s���� zSet.__iadd__c�����������������C���s���|���|��|�S�r5���)r.���r7���r���r���r ����__isub__����s���� zSet.__isub__c�����������������C���s���|���|��|�S�r5���)r0���r7���r���r���r ����__ixor__����s���� zSet.__ixor__c�����������������C���s���|D�]}|���|��qdS�)z�Update 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)r���r)���r���r���r ���r�������s����z Set.updatec�����������������C���s���|�j�����dS�)zMake the set empty.N)r���r-���r���r���r���r ���r-�������s����z Set.clearc�����������������C���s���|�j�|j�kS�r5���r���r7���r���r���r ����__eq__����s����z Set.__eq__c�����������������C���s���|���|��S�r5���)rC���r7���r���r���r ����__ne__����s����z Set.__ne__c�����������������C���s ���t�|�j�S�r5���)�lenr���r���r���r���r ����__len__���s����zSet.__len__c�����������������C���s ���t�|�j�S�r5���)�iterr���r���r���r���r ����__iter__��s����zSet.__iter__c�����������������C���sB���t�|t�r&tt�|�j|j|j|j��S�t t�|�j||d���S�d�S�)N����) r(����slicer���� itertools�islicer����start�stop�step�next)r����ir���r���r ����__getitem__��s���� zSet.__getitem__c�����������������C���s6���t�|t�r&t|�|��D�]}|�j|=�qn|�j|�|�=�d�S�r5���)r(���rJ���r���r���)r���rQ����eltr���r���r ����__delitem__��s���� zSet.__delitem__c�����������������C���s2���t�|t�std��|�jD�]}||jvr�dS�qdS�)zFIs this set a subset of *other*? Returns a ``bool``. r'���FT�r(���r���r���r���r)���r���r���r ����issubset��s���� zSet.issubsetc�����������������C���s2���t�|t�std��|jD�]}||�jvr�dS�qdS�)zHIs this set a superset of *other*? Returns a ``bool``. r'���FTrU���r)���r���r���r ���� issuperset ��s���� zSet.issupersetc�����������������C���s2���t�|t�std��|jD�]}||�jv�r�dS�qdS�)Nr'���FTrU���r)���r���r���r ���� isdisjoint-��s���� zSet.isdisjoint)N)+�__name__� __module__�__qualname__�__doc__� __slots__r ���r���r���r���r���r���r"���r%���r&���r+���r,���r.���r0���r2���r/���r3���r4���r8���r9���r:���r;���r<���r>���r?���r@���rA���rB���r���r-���rC���rD���rF���rH���rR���rT���rV���rW���rX���r���r���r���r ���r������sP��� r���)rK���r���r���r���r���r ����<module>���s���