
    4Ysh
                     <    d dl mZ  G d de      Z G d de      Zy)    )Lockc                   0    e Zd ZdZddgZd Zd Zd Zd Zy)	ResponsibleGeneratorz?A generator that will help clean up when it is done being used.cleanupgenc                      || _         || _        y N)r   r   )selfr   r   s      /var/www/sten-cake5-migrate2.hellocrow.space/lexinfo-master/env/lib/python3.12/site-packages/rdflib/plugins/stores/concurrent.py__init__zResponsibleGenerator.__init__	   s        c                 $    | j                          y r	   )r   r
   s    r   __del__zResponsibleGenerator.__del__   s    r   c                     | S r	    r   s    r   __iter__zResponsibleGenerator.__iter__   s    r   c                 ,    t        | j                        S r	   )nextr   r   s    r   __next__zResponsibleGenerator.__next__   s    DHH~r   N)	__name__
__module____qualname____doc__	__slots__r   r   r   r   r   r   r   r   r      s#    IE"Ir   r   c                   6    e Zd Zd Zd Zd Zd Zd Zd Zd Z	y)	ConcurrentStorec                 Z    || _         d| _        t               | _        g | _        g | _        y Nr   )store_ConcurrentStore__visit_countr   _ConcurrentStore__lock!_ConcurrentStore__pending_removes_ConcurrentStore__pending_adds)r
   r    s     r   r   zConcurrentStore.__init__   s0    
  f "$ r   c                     |\  }}}| j                   dk(  r| j                  j                  |||f       y | j                  j	                  |||f       y r   )r!   r    addr$   appendr
   triplespos        r   r&   zConcurrentStore.add&   sK    	Aq"JJNNAq!9%&&1ay1r   c                     |\  }}}| j                   dk(  r| j                  j                  |||f       y | j                  j	                  |||f       y r   )r!   r    remover#   r'   r(   s        r   r.   zConcurrentStore.remove-   sM    	Aq"JJq!Qi(""))1a)4r   c              #   P  K   |\  }}}| j                   j                  |||f      }| j                  }| j                          t	        || j
                        D ]  \  }}}	|||	f|vs|||	f  | j                  D ]%  \  }}}	|||k(  s|||k(  s|||	k(  s|||	f ' y wr	   )r    triplesr#   _ConcurrentStore__begin_readr   _ConcurrentStore__end_readr$   )
r
   r)   suprobgpending_removesr*   r+   r,   s
             r   r0   zConcurrentStore.triples4   s     RJJB|,00+At? 	GAq!q!9/Ag	 ,, 	IQ1rQwZ27Z27Ag	s   A%B&(#B&B&B&
B&c                 6    | j                   j                         S r	   )r    __len__r   s    r   r9   zConcurrentStore.__len__E   s    zz!!##r   c                     | j                   }|j                          | j                  dz   | _        |j                          y )N   )r"   acquirer!   release)r
   locks     r   __begin_readzConcurrentStore.__begin_readH   s0    {{!//!3r   c                    | j                   }|j                          | j                  dz
  | _        | j                  dk(  r| j                  }|r6|j	                         \  }}}	 | j
                  j                  |||f       |r6| j                  }|r5|j	                         \  }}}| j
                  j                  |||f       |r5|j                          y #  t        |||d       Y ixY w)Nr;   r   zNot in store to remove)r"   r<   r!   r#   popr    r.   printr$   r&   r=   )r
   r>   r7   r*   r+   r,   pending_addss          r   
__end_readzConcurrentStore.__end_readN   s    {{!//!3""44O!+//1	Aq=JJ%%q!Qi0 "  ..L(,,.	Aq

1ay)  	=!Q#;<s   #C C*N)
r   r   r   r   r&   r.   r0   r9   r1   r2   r   r   r   r   r      s%    !25"$r   r   N)	threadingr   objectr   r   r   r   r   <module>rG      s"    6 &Hf Hr   