B
    Áì2a/  ã               @   s2   d dl mZ dgZG dd„ dƒZG dd„ dƒZdS )é    )ÚrefÚWeakSetc               @   s$   e Zd Zdd„ Zdd„ Zdd„ ZdS )Ú_IterationGuardc             C   s   t |ƒ| _d S )N)r   Úweakcontainer)Úselfr   © r   ú7/var/www/html/prediksi/Python-3.7.12/Lib/_weakrefset.pyÚ__init__   s    z_IterationGuard.__init__c             C   s    |   ¡ }|d k	r|j | ¡ | S )N)r   Ú
_iteratingÚadd)r   Úwr   r   r   Ú	__enter__   s    z_IterationGuard.__enter__c             C   s0   |   ¡ }|d k	r,|j}| | ¡ |s,| ¡  d S )N)r   r
   ÚremoveÚ_commit_removals)r   ÚeÚtÚbr   Úsr   r   r   Ú__exit__   s    
z_IterationGuard.__exit__N)Ú__name__Ú
__module__Ú__qualname__r	   r   r   r   r   r   r   r   
   s   r   c               @   s  e Zd Zd>dd„Zdd„ Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ ZeZd d!„ Zd"d#„ Zd$d%„ ZeZd&d'„ Zd(d)„ Zd*d+„ ZeZd,d-„ Zd.d/„ ZeZd0d1„ Zd2d3„ Zd4d5„ Z e Z!d6d7„ Z"d8d9„ Z#d:d;„ Z$e$Z%d<d=„ Z&dS )?r   Nc             C   sB   t ƒ | _t| ƒfdd„}|| _g | _t ƒ | _|d k	r>|  |¡ d S )Nc             S   s2   |ƒ }|d k	r.|j r"|j | ¡ n|j | ¡ d S )N)r
   Ú_pending_removalsÚappendÚdataÚdiscard)ÚitemÚselfrefr   r   r   r   Ú_remove&   s
    z!WeakSet.__init__.<locals>._remove)Úsetr   r   r   r   r
   Úupdate)r   r   r   r   r   r   r	   $   s    zWeakSet.__init__c             C   s(   | j }| jj}x|r"|| ¡ ƒ qW d S )N)r   r   r   Úpop)r   Úlr   r   r   r   r   4   s    zWeakSet._commit_removalsc          	   c   s<   t | ƒ�* x"| jD ]}|ƒ }|d k	r|V  qW W d Q R X d S )N)r   r   )r   Úitemrefr   r   r   r   Ú__iter__:   s
    
zWeakSet.__iter__c             C   s   t | jƒt | jƒ S )N)Úlenr   r   )r   r   r   r   Ú__len__C   s    zWeakSet.__len__c             C   s,   yt |ƒ}W n tk
r    dS X || jkS )NF)r   Ú	TypeErrorr   )r   r   Úwrr   r   r   Ú__contains__F   s
    zWeakSet.__contains__c             C   s   | j t| ƒft| dd ƒfS )NÚ__dict__)Ú	__class__ÚlistÚgetattr)r   r   r   r   Ú
__reduce__M   s    zWeakSet.__reduce__c             C   s&   | j r|  ¡  | j t|| jƒ¡ d S )N)r   r   r   r   r   r   )r   r   r   r   r   r   Q   s    zWeakSet.addc             C   s   | j r|  ¡  | j ¡  d S )N)r   r   r   Úclear)r   r   r   r   r/   V   s    zWeakSet.clearc             C   s
   |   | ¡S )N)r+   )r   r   r   r   Úcopy[   s    zWeakSet.copyc             C   sX   | j r|  ¡  xDy| j ¡ }W n tk
r<   tdƒd ‚Y nX |ƒ }|d k	r|S qW d S )Nzpop from empty WeakSet)r   r   r   r!   ÚKeyError)r   r#   r   r   r   r   r!   ^   s    zWeakSet.popc             C   s"   | j r|  ¡  | j t|ƒ¡ d S )N)r   r   r   r   r   )r   r   r   r   r   r   j   s    zWeakSet.removec             C   s"   | j r|  ¡  | j t|ƒ¡ d S )N)r   r   r   r   r   )r   r   r   r   r   r   o   s    zWeakSet.discardc             C   s*   | j r|  ¡  x|D ]}|  |¡ qW d S )N)r   r   r   )r   ÚotherZelementr   r   r   r    t   s    
zWeakSet.updatec             C   s   |   |¡ | S )N)r    )r   r2   r   r   r   Ú__ior__z   s    
zWeakSet.__ior__c             C   s   |   ¡ }| |¡ |S )N)r0   Údifference_update)r   r2   Únewsetr   r   r   Ú
difference~   s    
zWeakSet.differencec             C   s   |   |¡ d S )N)Ú__isub__)r   r2   r   r   r   r4   „   s    zWeakSet.difference_updatec             C   s<   | j r|  ¡  | |kr"| j ¡  n| j dd„ |D ƒ¡ | S )Nc             s   s   | ]}t |ƒV  qd S )N)r   )Ú.0r   r   r   r   ú	<genexpr>Œ   s    z#WeakSet.__isub__.<locals>.<genexpr>)r   r   r   r/   r4   )r   r2   r   r   r   r7   †   s    zWeakSet.__isub__c                s   ˆ   ‡ fdd„|D ƒ¡S )Nc             3   s   | ]}|ˆ kr|V  qd S )Nr   )r8   r   )r   r   r   r9   �   s    z'WeakSet.intersection.<locals>.<genexpr>)r+   )r   r2   r   )r   r   Úintersection�   s    zWeakSet.intersectionc             C   s   |   |¡ d S )N)Ú__iand__)r   r2   r   r   r   Úintersection_update“   s    zWeakSet.intersection_updatec             C   s(   | j r|  ¡  | j dd„ |D ƒ¡ | S )Nc             s   s   | ]}t |ƒV  qd S )N)r   )r8   r   r   r   r   r9   ˜   s    z#WeakSet.__iand__.<locals>.<genexpr>)r   r   r   r<   )r   r2   r   r   r   r;   •   s    zWeakSet.__iand__c             C   s   | j  dd„ |D ƒ¡S )Nc             s   s   | ]}t |ƒV  qd S )N)r   )r8   r   r   r   r   r9   œ   s    z#WeakSet.issubset.<locals>.<genexpr>)r   Úissubset)r   r2   r   r   r   r=   ›   s    zWeakSet.issubsetc             C   s   | j ttt|ƒƒk S )N)r   r   Úmapr   )r   r2   r   r   r   Ú__lt__Ÿ   s    zWeakSet.__lt__c             C   s   | j  dd„ |D ƒ¡S )Nc             s   s   | ]}t |ƒV  qd S )N)r   )r8   r   r   r   r   r9   £   s    z%WeakSet.issuperset.<locals>.<genexpr>)r   Ú
issuperset)r   r2   r   r   r   r@   ¢   s    zWeakSet.issupersetc             C   s   | j ttt|ƒƒkS )N)r   r   r>   r   )r   r2   r   r   r   Ú__gt__¦   s    zWeakSet.__gt__c             C   s$   t || jƒstS | jttt|ƒƒkS )N)Ú
isinstancer+   ÚNotImplementedr   r   r>   r   )r   r2   r   r   r   Ú__eq__©   s    zWeakSet.__eq__c             C   s   |   ¡ }| |¡ |S )N)r0   Úsymmetric_difference_update)r   r2   r5   r   r   r   Úsymmetric_difference®   s    
zWeakSet.symmetric_differencec             C   s   |   |¡ d S )N)Ú__ixor__)r   r2   r   r   r   rE   ´   s    z#WeakSet.symmetric_difference_updatec                s@   ˆ j rˆ  ¡  ˆ |kr"ˆ j ¡  nˆ j ‡ fdd„|D ƒ¡ ˆ S )Nc             3   s   | ]}t |ˆ jƒV  qd S )N)r   r   )r8   r   )r   r   r   r9   ¼   s    z#WeakSet.__ixor__.<locals>.<genexpr>)r   r   r   r/   rE   )r   r2   r   )r   r   rG   ¶   s    zWeakSet.__ixor__c             C   s   |   dd„ | |fD ƒ¡S )Nc             s   s   | ]}|D ]
}|V  q
qd S )Nr   )r8   r   r   r   r   r   r9   À   s    z WeakSet.union.<locals>.<genexpr>)r+   )r   r2   r   r   r   Úunion¿   s    zWeakSet.unionc             C   s   t |  |¡ƒdkS )Nr   )r%   r:   )r   r2   r   r   r   Ú
isdisjointÃ   s    zWeakSet.isdisjoint)N)'r   r   r   r	   r   r$   r&   r)   r.   r   r/   r0   r!   r   r   r    r3   r6   Ú__sub__r4   r7   r:   Ú__and__r<   r;   r=   Ú__le__r?   r@   Ú__ge__rA   rD   rF   Ú__xor__rE   rG   rH   Ú__or__rI   r   r   r   r   r   #   sH   
			N)Ú_weakrefr   Ú__all__r   r   r   r   r   r   Ú<module>   s   