File: //lib/python3.12/__pycache__/_weakrefset.cpython-312.pyc
�
    )!�h  �                   �J   � d dl mZ d dlmZ dgZ G d� d�      Z G d� d�      Zy)�    ��ref)�GenericAlias�WeakSetc                   �   � e Zd Zd� Zd� Zd� Zy)�_IterationGuardc                 �$   � t        |�      | _        y �N)r   �
weakcontainer)�selfr   s     �"/usr/lib/python3.12/_weakrefset.py�__init__z_IterationGuard.__init__   s   � � ��/���    c                 �`   � | j                  �       }|�|j                  j                  | �       | S r
   )r   �
_iterating�add)r   �ws     r
   �	__enter__z_IterationGuard.__enter__   s,   � ���� ���=�
�L�L���T�"��r   c                 �   � | j                  �       }|�1|j                  }|j                  | �       |s|j                  �        y y y r
   )r   r   �remove�_commit_removals)r   �e�t�br   �ss         r
   �__exit__z_IterationGuard.__exit__   sB   � ���� ���=����A�
�H�H�T�N���"�"�$� � r   N)�__name__�
__module__�__qualname__r   r   r   � r   r
   r   r      s   � �0��%r   r   c                   ��   � e Zd Zd!d�Zd� Zd� Zd� Zd� Zd� Zd� Z	d	� Z
d
� Zd� Zd� Z
d
� Zd� Zd� Zd� ZeZd� Zd� Zd� ZeZd� Zd� Zd� ZeZd� Zd� ZeZd� Zd� Zd� Z e Z!d� Z"d� Z#d� Z$e$Z%d� Z&d � Z' e(e)�      Z*y)"r   Nc                 �   � t        �       | _        t        | �      fd�}|| _        g | _        t        �       | _        |�| j
                  |�       y y )Nc                 �   �  |�       }|�D|j                   r|j                  j                  | �       y |j                  j	                  | �       y y r
   )r   �_pending_removals�append�data�discard)�item�selfrefr   s      r
   �_removez!WeakSet.__init__.<locals>._remove'