o
    Oôjžß  ã                   @   sÚ  d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
mZmZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ ddlmZ dd	lmZmZ dd
lmZm Z m!Z! dd„ Z"dd„ Z#dZ$dZ%dZ&dZ'dZ(dZ)dd„ Z*e!dd„ ƒZ+dd„ Z,dd„ Z-dd„ Z.dd „ Z/e 0d!d"¡Z1G d#d$„ d$e2ƒZ3G d%d&„ d&e2ƒZ4G d'd(„ d(e2ƒZ5d)d*„ Z6ee7ƒd+d,„ ƒZ8ee7e
j9ƒd-d.„ ƒZ:ee;e
j<ƒd/d0„ ƒZ=eej>e
j<e
j?ƒd1d2„ ƒZ@ed3e
j<ƒd4d5„ ƒZAed6e
jBƒeejCƒd7d8„ ƒƒZDed9e
j<e
j?ƒd:d;„ ƒZEe!d<d=„ ƒZFe e
j<d>ƒd?d@„ ƒZGe!dAdB„ ƒZHe e
j<dCƒdDdE„ ƒZIe!dFdG„ ƒZJe e
j<dHƒdIdJ„ ƒZKe!dKdL„ ƒZLe e
j<dMƒdNdO„ ƒZMe!dPdQ„ ƒZNe e
j<dRƒdSdT„ ƒZOdUdV„ ZPe!dWdX„ ƒZQe e
j<dYƒdZd[„ ƒZRd\d]„ ZSe!d^d_„ ƒZTe e
j<d`ƒdadb„ ƒZUdcdd„ ZVe!dedf„ ƒZWe e
j<dgƒdhdi„ ƒZXedje
j<e
j9ƒdkdl„ ƒZYdmdn„ ZZej[eSfej\eYfej]ePfej^eVffD ]
\Z_Z`eZe_e`ƒ �q¨eejaƒe e
j<doƒdpdq„ ƒƒZbeejcƒe e
j<drƒdsdt„ ƒƒZdeejeƒe e
j<duƒdvdw„ ƒƒZfeejgƒe e
j<dxƒdydz„ ƒƒZhe!d{d|„ ƒZie e
j<d}ƒd~d„ ƒZje!d€d�„ ƒZkeejlƒe e
j<d‚ƒdƒd„„ ƒƒZmeejnƒe e
j<d…ƒd†d‡„ ƒƒZoe!dˆd‰„ ƒZpeejqƒdŠd‹„ ƒZreejsƒdŒd�„ ƒZte!dŽd�„ ƒZueejvƒd�d‘„ ƒZweejxƒd’d“„ ƒZyeejze
j<e
j<ƒd”d•„ ƒZ{ee
j<e
j<ƒd–d—„ ƒZ|dS )˜z&
Support for native homogeneous sets.
é    N)Úcached_property)Úir)ÚtypesÚtypingÚcgutils)	Úlower_builtinÚ
lower_castÚiternext_implÚimpl_ret_borrowedÚimpl_ret_new_refÚimpl_ret_untrackedÚfor_iterÚcall_lenÚRefType)Ú	quicksort)Úslicing)ÚNumbaValueErrorÚTypingError)ÚoverloadÚoverload_methodÚ	intrinsicc                 C   s4   t  |¡}|  |¡ ¡ }| ||¡}| j|||d�S )zx
    Given a set value and type, get its payload structure (as a
    reference, so that mutations are seen by all).
    ©Úref)r   Ú
SetPayloadÚget_data_typeÚ
as_pointerÚbitcastÚmake_data_helper)ÚcontextÚbuilderÚset_typeÚptrÚpayload_typeÚptrtyÚpayload© r%   úe/var/www/html/academy/tools/voices/clone/sv-venv/lib/python3.10/site-packages/numba/cpython/setobj.pyÚget_payload_struct   s   
r'   c                 C   s   |   t |¡¡}|  |¡S )z7
    Return the entry size for the given set type.
    )r   r   ÚSetEntryÚget_abi_sizeof)r   r    Úlltyr%   r%   r&   Úget_entry_size#   s   
r+   éÿÿÿÿéþÿÿÿiÕÿÿÿé   é   Fc                 C   s`   | j }| t¡}| ||fi ¡}|  ||¡}|||fƒ}t| ||ƒ}	t |jt	¡}
| 
|	||
¡S )z.
    Compute the hash of the given value.
    )Útyping_contextÚresolve_value_typeÚhashÚget_call_typeÚget_functionÚis_hash_usedr   ÚConstantÚtypeÚFALLBACKÚselect)r   r   ÚtypÚvalueÚ	typingctxÚfntyÚsigÚfnÚhÚis_okÚfallbackr%   r%   r&   Úget_hash_value;   s   
rC   c                    s.   ‡ fdd„}|   t¡}| | ˆ fi ¡}||fS )Nc                    s   t | |ˆ |d ƒS ©Nr   )rC   )r   r   r:   Úargs©r;   r%   r&   ÚimplL   s   z'_get_hash_value_intrinsic.<locals>.impl)r1   r2   r3   )r<   r;   rG   r=   r>   r%   rF   r&   Ú_get_hash_value_intrinsicJ   s   
rH   c                 C   ó   t  |jt¡}| d||¡S )z8
    Whether the hash value denotes an empty entry.
    ú==)r   r6   r7   ÚEMPTYÚicmp_unsigned)r   r   r@   Úemptyr%   r%   r&   Úis_hash_emptyS   ó   rN   c                 C   rI   )z9
    Whether the hash value denotes a deleted entry.
    rJ   ©r   r6   r7   ÚDELETEDrL   ©r   r   r@   Zdeletedr%   r%   r&   Úis_hash_deletedZ   rO   rS   c                 C   rI   )z9
    Whether the hash value denotes an active entry.
    ú<rP   rR   r%   r%   r&   r5   a   s   r5   c                     sH   t dd„ ˆ D ƒƒstdˆ › �ƒ‚t ‡ fdd„ˆ D ƒƒs"tdˆ › �ƒ‚d S )Nc                 S   s   g | ]}t |tjƒ‘qS r%   )Ú
isinstancer   ÚSet)Ú.0r:   r%   r%   r&   Ú
<listcomp>k   s    z!check_all_set.<locals>.<listcomp>z All arguments must be Sets, got c                    s   g | ]
}ˆ d  j |j k‘qS )r   ©Údtype)rW   Ús©rE   r%   r&   rX   n   s    z'All Sets must be of the same type, got )Úallr   r\   r%   r\   r&   Úcheck_all_setj   s
   ÿr^   ÚSetLoop©ÚindexÚentryÚdo_breakc                   @   sÞ   e Zd Zdd„ Zedd„ ƒZejdd„ ƒZedd„ ƒZejdd„ ƒZed	d
„ ƒZejdd
„ ƒZedd„ ƒZ	e	jdd„ ƒZ	edd„ ƒZ
e
jdd„ ƒZ
edd„ ƒZedd„ ƒZdd„ Zd dd„Zejd!dd„ƒZejdd„ ƒZdS )"Ú_SetPayloadc                 C   s<   t ||||ƒ}|| _|| _|| _|| _| d¡| _|| _d S )NÚentries)r'   Ú_contextÚ_builderÚ_tyÚ_payloadÚ_get_ptr_by_nameÚ_entriesÚ_ptr)Úselfr   r   r    r!   r$   r%   r%   r&   Ú__init__w   s   
z_SetPayload.__init__c                 C   ó   | j jS ©N©ri   Úmask©rm   r%   r%   r&   rr   €   ó   z_SetPayload.maskc                 C   ó   || j _d S rp   rq   ©rm   r;   r%   r%   r&   rr   „   s   c                 C   ro   rp   ©ri   Úusedrs   r%   r%   r&   rx   ‰   rt   z_SetPayload.usedc                 C   ru   rp   rw   rv   r%   r%   r&   rx   �   ó   c                 C   ro   rp   ©ri   Úfillrs   r%   r%   r&   r{   ‘   rt   z_SetPayload.fillc                 C   ru   rp   rz   rv   r%   r%   r&   r{   •   ry   c                 C   ro   rp   ©ri   Úfingerrs   r%   r%   r&   r}   ™   rt   z_SetPayload.fingerc                 C   ru   rp   r|   rv   r%   r%   r&   r}   �   ry   c                 C   ro   rp   ©ri   Údirtyrs   r%   r%   r&   r   ¡   rt   z_SetPayload.dirtyc                 C   ru   rp   r~   rv   r%   r%   r&   r   ¥   ry   c                 C   ó   | j S )z>
        A pointer to the start of the entries array.
        )rk   rs   r%   r%   r&   re   ©   ó   z_SetPayload.entriesc                 C   r€   )zC
        A pointer to the start of the NRT-allocated area.
        )rl   rs   r%   r%   r&   r!   °   r�   z_SetPayload.ptrc                 C   s2   t  | j| j|¡}| jj| jt | j¡|d�}|S )z)
        Get entry number *idx*.
        r   )	r   Úgeprg   rk   rf   r   r   r(   rh   )rm   ÚidxZ	entry_ptrrb   r%   r%   r&   Ú	get_entry·   s   

þz_SetPayload.get_entryFc                    sê  ˆ
j ‰ˆ
j‰ˆj}ˆ
j}ˆ
jj}ˆj}| tj	¡}| 
|||fi ¡}	ˆ ||	¡‰t |d¡}
t |d¡}t ˆˆ¡}t ˆˆ ˆ|¡¡}ˆrQ| d¡‰t ˆˆ¡‰ˆ d¡}ˆ d¡‰ ˆ d¡‰ˆ d¡}‡ ‡‡‡‡‡‡‡‡‡	‡
fdd	„}t ˆt |t¡¡�# ˆ |¡}||ƒ ˆ ||
¡}ˆ ||¡}ˆ ||¡ W d
  ƒ n1 s¥w   Y  ˆ |¡ ˆ |¡�A ˆ |¡}||ƒ ˆ |¡}ˆ ||¡}ˆ |
ˆ ||¡¡}ˆ |ˆ ||¡¡}ˆ ||¡ ˆ ||¡ ˆ |¡ W d
  ƒ n1 søw   Y  ˆ ˆ¡�, ˆ�r"ˆ |¡}ˆ ˆ¡}ˆ ˆ d|ˆ¡||¡}ˆ ||¡ ˆ |¡ W d
  ƒ n	1 �s2w   Y  ˆ ˆ ¡� ˆ |¡ W d
  ƒ n	1 �sMw   Y  ˆ |¡ ˆ t d¡d¡}|  tj!ˆ ¡ |  tj"ˆ¡ |ˆ |¡fS )ag  
        Lookup the *item* with the given hash values in the entries.

        Return a (found, entry index) tuple:
        - If found is true, <entry index> points to the entry containing
          the item.
        - If found is false, <entry index> points to the empty entry that
          the item can be written to (only if *for_insert* is true)
        é   é   r,   zlookup.bodyzlookup.foundzlookup.not_foundz
lookup.endc              	      s2  ˆ
  | ¡}|j}ˆ ˆ dˆ|¡¡�* ˆˆˆ	|jfƒ}ˆ |¡� ˆ ˆ ¡ W d  ƒ n1 s0w   Y  W d  ƒ n1 s?w   Y  ˆ tˆˆ|ƒ¡� ˆ ˆ¡ W d  ƒ n1 s]w   Y  ˆr—ˆ tˆˆ|ƒ¡�  ˆ ˆ¡}ˆ 	ˆ d|ˆ¡| |¡}ˆ 
|ˆ¡ W d  ƒ dS 1 s�w   Y  dS dS )zO
            Check entry *i* against the value being searched for.
            rJ   N)r„   r2   Úif_thenrL   ÚkeyÚbranchrN   rS   Úloadr9   Ústore)Úirb   Z
entry_hashÚeqÚj©Zbb_foundZbb_not_foundr   r   ZeqfnÚ
for_insertZ
free_indexZfree_index_sentinelr@   Úitemrm   r%   r&   Úcheck_entryé   s*   
ÿ€üÿ
ÿ"üþz(_SetPayload._lookup.<locals>.check_entryNrJ   Úfound)#rf   rg   r7   rr   rh   rZ   r0   r1   Úoperatorr�   r3   r4   r   r6   r   Úalloca_once_valueÚand_Úappend_basic_blockÚ	for_rangeÚLINEAR_PROBESrŠ   Úaddr‹   r‰   Ú
goto_blockÚlshrÚmulr9   rL   Úposition_at_endÚphiÚIntTypeÚadd_incomingÚtrue_bitÚ	false_bit)rm   r‘   r@   r�   Úintp_trr   rZ   Útyctxr=   r>   ÚoneÚfiveÚperturbra   Úbb_bodyÚbb_endr’   rŒ   ÚprŽ   r“   r%   r�   r&   Ú_lookupÁ   sx   

ÿ




 
û



ò

ÿöÿ
z_SetPayload._lookupNc              	   c   sÖ   � | j }| j}| tj¡}t |d¡}| | j|¡}t	j
|||d��?}|  |j¡}t|||jƒ}	| |	¡� t|j||jd�}
|
V  W d  ƒ n1 sLw   Y  W d  ƒ dS W d  ƒ dS 1 sdw   Y  dS )zG
        Iterate over the payload's entries.  Yield a SetLoop.
        r…   ©Ústartr`   N)rf   rg   Úget_value_typer   Úintpr   r6   rš   rr   r   r˜   r„   ra   r5   r2   r‡   r_   rc   )rm   r®   r   r   r¤   r¦   ÚsizeZ
range_looprb   Úis_usedÚloopr%   r%   r&   Ú_iterate7  s$   €ÿýý"ýz_SetPayload._iteratec                 c   s  � | j }| j}| tj¡}t |d¡}t |d¡}| j}| d¡}| d¡}t	 
|| j¡}	| |¡ | |¡�0 | |	¡}
| || |
|¡¡}
| |
|	¡ |  |
¡}t|||jƒ}| |||¡ W d  ƒ n1 sjw   Y  | |¡ | |	¡}
|
| _|  |
¡V  dS )z‹
        Yield a random entry from the payload.  Caller must ensure the
        set isn't empty, otherwise the function won't end.
        r   r…   Znext_entry_bodyZnext_entry_endN)rf   rg   r¯   r   r°   r   r6   rr   r—   r   r•   r}   r‰   r›   rŠ   r–   rš   r‹   r„   r5   r2   Úcbranchrž   )rm   r   r   r¤   Úzeror¦   rr   r©   rª   ra   rŒ   rb   r²   r%   r%   r&   Ú_next_entryK  s.   €




ù
	
z_SetPayload._next_entry©Frp   )Ú__name__Ú
__module__Ú__qualname__rn   Úpropertyrr   Úsetterrx   r{   r}   r   re   r!   r„   r¬   Ú
contextlibÚcontextmanagerr´   r·   r%   r%   r%   r&   rd   u   s@    	













vrd   c                   @   s’  e Zd Zdd„ Zedd„ ƒZedd„ ƒZedd„ ƒZed	d
„ ƒZedd„ ƒZ	e	j
dd„ ƒZ	dd„ Zdd„ ZdUdd„ZdVdd„ZdVdd„ZdUdd„ZdUdd„ZdUd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/d0„ ZdWd2d3„Zd4d5„ Zd6d7„ ZedXd9d:„ƒZ edXd;d<„ƒZ!ed=d>„ ƒZ"ed?d@„ ƒZ#dAdB„ Z$dCdD„ Z%dEdF„ Z&dGdH„ Z'dWdIdJ„Z(dKdL„ Z)dMdN„ Z*dOdP„ Z+dQdR„ Z,dSdT„ Z-d8S )YÚSetInstancec                 C   s2   || _ || _|| _t||ƒ| _| |||¡| _d S rp   )rf   rg   rh   r+   Ú
_entrysizeÚmake_helperÚ_set)rm   r   r   r    Úset_valr%   r%   r&   rn   v  s
   zSetInstance.__init__c                 C   ro   rp   )rh   rZ   rs   r%   r%   r&   rZ   }  rt   zSetInstance.dtypec                 C   s.   | j }| j}| j j || j¡}t||| j|ƒS )z/
        The _SetPayload for this set.
        )rf   rg   ÚnrtÚmeminfo_dataÚmeminford   rh   )rm   r   r   r!   r%   r%   r&   r$   �  s   zSetInstance.payloadc                 C   ó
   | j  ¡ S rp   )rÃ   Ú	_getvaluers   r%   r%   r&   r;   �  ó   
zSetInstance.valuec                 C   ro   rp   )rÃ   rÇ   rs   r%   r%   r&   rÇ   ‘  rt   zSetInstance.meminfoc                 C   ro   rp   ©rÃ   Úparentrs   r%   r%   r&   rÌ   •  rt   zSetInstance.parentc                 C   ru   rp   rË   rv   r%   r%   r&   rÌ   ™  ry   c                 C   ro   )z<
        Return the number of elements in the size.
        )r$   rx   rs   r%   r%   r&   Úget_size�  s   zSetInstance.get_sizec                 C   s$   | j jr|r	tjntj| j_d S d S rp   )rh   Ú	reflectedr   r¢   r£   r$   r   ©rm   Úvalr%   r%   r&   Ú	set_dirty£  s   ÿzSetInstance.set_dirtyTc                 C   s°   | j }| j}|j}||_|  |¡ ||_|j}	t |	jd¡}
| 	|	|
¡ }	|_|j
t|||ƒdd�� | 	|j|
¡|_W d   ƒ n1 sEw   Y  |rQ|  |	¡ |  d¡ d S )Nr…   T©Úlikely)rf   rg   r2   Úincref_valuerˆ   rx   r   r6   r7   rš   r‡   rN   r{   ÚupsizerÑ   )rm   r$   rb   r‘   r@   Ú	do_resizer   r   Úold_hashrx   r¦   r%   r%   r&   Ú
_add_entry§  s"   
ÿþ
zSetInstance._add_entryc              	   C   s  | j }| j}|j||dd�\}}	| |¡}
| |
¡�` | |	¡}|j}||_|r-|  |¡ ||_|j	}t
 |jd¡}| ||¡ }|_	|jt|||ƒdd�� | |j|¡|_W d   ƒ n1 saw   Y  |rm|  |¡ |  d¡ W d   ƒ d S 1 s}w   Y  d S )NT©r�   r…   rÒ   )rf   rg   r¬   Únot_r‡   r„   r2   rÔ   rˆ   rx   r   r6   r7   rš   rN   r{   rÕ   rÑ   )rm   r$   r‘   r@   rÖ   Ú	do_increfr   r   r“   rŒ   Ú	not_foundrb   r×   rx   r¦   r%   r%   r&   Ú_add_key¼  s.   


ÿþ
"ízSetInstance._add_keyc                 C   sf   t  |jjt¡|_|r|  |j¡ |j}t  |jd¡}| j 	||¡ }|_|r,|  
|¡ |  d¡ d S )Nr…   T)r   r6   r2   r7   rQ   Údecref_valuerˆ   rx   rg   ÚsubÚdownsizerÑ   )rm   r$   rb   rÖ   Ú	do_decrefrx   r¦   r%   r%   r&   Ú_remove_entryØ  s   
zSetInstance._remove_entryc           
      C   sd   | j }| j}| ||¡\}}| |¡� | |¡}	|  ||	|¡ W d   ƒ |S 1 s+w   Y  |S rp   )rf   rg   r¬   r‡   r„   râ   )
rm   r$   r‘   r@   rÖ   r   r   r“   rŒ   rb   r%   r%   r&   Ú_remove_keyæ  s   

þüzSetInstance._remove_keyc                 C   s8   | j }| j}| j}t||| jj|ƒ}|  ||||¡ d S rp   )rf   rg   r$   rC   rh   rZ   rÝ   )rm   r‘   rÖ   r   r   r$   r@   r%   r%   r&   rš   ò  s
   zSetInstance.addc                 C   s6   | j }| j}| j}|  ||||¡}|  ||||¡ dS )z`A version of .add for use inside functions following Python calling
        convention.
        N)rf   rg   r$   Ú_pyapi_get_hash_valuerÝ   )rm   Úpyapir‘   rÖ   r   r   r$   r@   r%   r%   r&   Ú	add_pyapiú  s
   zSetInstance.add_pyapic                 C   s„   | j jg}tj}dd„ }|g}tj|g|¢R Ž }	| ||	|¡\}
}|j|
dd�� | | 	¡ ¡ W d  ƒ |S 1 s;w   Y  |S )z=Python API compatible version of `get_hash_value()`.
        c                 S   ó   t | ƒS rp   )rH   )rÐ   r%   r%   r&   Úwrapper  ó   z2SetInstance._pyapi_get_hash_value.<locals>.wrapperFrÒ   N)
rh   rZ   r   r°   r   Ú	signatureÚcall_jit_coder‡   ÚretÚget_null_object)rm   rå   r   r   r‘   ÚargtypesÚrestyrè   rE   r>   Úis_errorÚretvalr%   r%   r&   rä     s   

þýz!SetInstance._pyapi_get_hash_valuec                 C   s8   | j }| j}| j}t||| jj|ƒ}| ||¡\}}|S rp   )rf   rg   r$   rC   rh   rZ   r¬   )rm   r‘   r   r   r$   r@   r“   rŒ   r%   r%   r&   Úcontains  s   zSetInstance.containsc                 C   s6   | j }| j}| j}t||| jj|ƒ}|  |||¡}|S rp   )rf   rg   r$   rC   rh   rZ   rã   )rm   r‘   r   r   r$   r@   r“   r%   r%   r&   Údiscard   s   zSetInstance.discardc                 C   s|   | j }| j}| | jj¡}t ||¡}| j}| ¡ �}| 	|j
|¡ | j||dd� W d   ƒ n1 s4w   Y  | |¡S )NF)rá   )rf   rg   r¯   rh   rZ   r   Úalloca_oncer$   r·   r‹   rˆ   râ   rŠ   )rm   r   r   Últyrˆ   r$   rb   r%   r%   r&   Úpop)  s   
ý
zSetInstance.popc                 C   s<   | j }| j}| tj¡}t |t¡}|  |¡ |  	d¡ d S )NT)
rf   rg   r¯   r   r°   r   r6   ÚMINSIZEÚ_replace_payloadrÑ   )rm   r   r   r¤   Úminsizer%   r%   r&   Úclear8  s   
zSetInstance.clearc              
   C   sÄ  | j }| j}| j}|j}|j}t| ƒ||| jdƒ}| d||¡}|j|dd��±\}}	|�/ | 	|¡}
|j
| |
¡dd�� |j |td¡ W d  ƒ n1 sOw   Y  W d  ƒ n1 s^w   Y  |	�[ |  |||¡}| |¡}
|j
| |
¡dd�� |j |td¡ W d  ƒ n1 s�w   Y  |j}| ¡ �}|j}|j||j|jdd� W d  ƒ n1 s´w   Y  W d  ƒ n1 sÃw   Y  W d  ƒ |S W d  ƒ |S 1 sÛw   Y  |S )z,
        Return a copy of this set.
        NrJ   TrÒ   F)zcannot copy set©rÖ   )rf   rg   r$   rx   r{   r7   rh   rL   Úif_elseÚ_copy_payloadr‡   rÚ   Ú	call_convÚreturn_user_excÚMemoryErrorÚchoose_alloc_sizeÚ_allocate_payloadr´   rb   rÝ   rˆ   r2   )rm   r   r   r$   rx   r{   ÚotherZno_deleted_entriesZif_no_deletedZ
if_deletedÚokÚnentriesÚother_payloadr³   rb   r%   r%   r&   ÚcopyA  sT   

ÿÿ€ý

ÿÿ
ÿþ€÷
÷ò
÷ézSetInstance.copyc           
   	   C   sª   | j }| j}| j}|j}| ¡ �5}|j}| |j|j¡\}}	| | 	|¡¡� | j
||dd� W d  ƒ n1 s9w   Y  W d  ƒ n1 sHw   Y  |  |j¡ dS )z9
        In-place intersection with *other* set.
        Frû   N)rf   rg   r$   r´   rb   r¬   rˆ   r2   r‡   rÚ   râ   rà   rx   )
rm   r  r   r   r$   r  r³   rb   r“   Ú_r%   r%   r&   Ú	intersecth  s   
ÿ€ýzSetInstance.intersectc                 C   sl   | j }| j}| j}|j}| ¡ �}|j}| j||j|jdd� W d  ƒ n1 s)w   Y  |  |j	¡ dS )z7
        In-place difference with *other* set.
        Frû   N)
rf   rg   r$   r´   rb   rã   rˆ   r2   rà   rx   )rm   r  r   r   r$   r  r³   rb   r%   r%   r&   Ú
differencez  s   
þzSetInstance.differencec              
   C   s  | j }| j}|j}| ¡ �m}|jj}|jj}| j}|j||dd�\}	}
| |
¡}| 	|	¡�>\}}|� | j
||dd� W d  ƒ n1 sEw   Y  |� |  ||||¡ W d  ƒ n1 s_w   Y  W d  ƒ n1 snw   Y  W d  ƒ n1 s}w   Y  |  | jj¡ dS )zA
        In-place symmetric difference with *other* set.
        TrÙ   Frû   N)rf   rg   r$   r´   rb   rˆ   r2   r¬   r„   rü   râ   rØ   rà   rx   )rm   r  r   r   r  r³   rˆ   r@   r$   r“   rŒ   rb   Z	if_commonZif_not_commonr%   r%   r&   Úsymmetric_differenceŠ  s*   

ÿÿ€ý€ùz SetInstance.symmetric_differenceFc                 C   sV  | j }| j}| j}|j}|rdnd}t |tj¡}| | ||j|j¡¡�y\}	}
|
� | 	tj
|¡ W d   ƒ n1 s<w   Y  |	�L | ¡ �8}|j}| |j|j¡\}}| | |¡¡� | 	tj
|¡ | ¡  W d   ƒ n1 stw   Y  W d   ƒ n1 sƒw   Y  W d   ƒ n1 s’w   Y  W d   ƒ n1 s¡w   Y  | |¡S )NrT   ú<=)rf   rg   r$   r   r•   r¢   rü   rL   rx   r‹   r£   r´   rb   r¬   rˆ   r2   r‡   rÚ   rc   rŠ   )rm   r  Ústrictr   r   r$   r  Úcmp_opÚresZ
if_smallerÚ	if_largerr³   rb   r“   r  r%   r%   r&   Úissubset¢  s8   ÿþ

þ€ý€þ€ú
zSetInstance.issubsetc              	      sÖ   | j }| j‰ | j}|j}t ˆ tj¡‰‡ ‡fdd„}ˆ  ˆ  d|j|j¡¡�8\}}|� |||ƒ W d   ƒ n1 s;w   Y  |� |||ƒ W d   ƒ n1 sRw   Y  W d   ƒ n1 saw   Y  ˆ  	ˆ¡S )Nc              	      s˜   |   ¡ �>}|j}| |j|j¡\}}ˆ  |¡� ˆ  tjˆ¡ | 	¡  W d   ƒ n1 s-w   Y  W d   ƒ d S W d   ƒ d S 1 sEw   Y  d S rp   )
r´   rb   r¬   rˆ   r2   r‡   r‹   r   r£   rc   )ÚsmallerÚlargerr³   rb   r“   r  ©r   r  r%   r&   ÚcheckÄ  s   

þý"ýz%SetInstance.isdisjoint.<locals>.checkú>)
rf   rg   r$   r   r•   r¢   rü   rL   rx   rŠ   )rm   r  r   r$   r  r  r  Ú	otherwiser%   r  r&   Ú
isdisjoint¼  s&   	ÿþþ€ø
zSetInstance.isdisjointc                 C   sJ  | j }| j}| j}|j}t |tj¡}| | d|j|j¡¡�y\}}|�L | 	¡ �8}	|	j
}
| |
j|
j¡\}}| | |¡¡� | tj|¡ |	 ¡  W d   ƒ n1 sUw   Y  W d   ƒ n1 sdw   Y  W d   ƒ n1 ssw   Y  |� | tj|¡ W d   ƒ n1 sŒw   Y  W d   ƒ n1 s›w   Y  | |¡S )NrJ   )rf   rg   r$   r   r•   r¢   rü   rL   rx   r´   rb   r¬   rˆ   r2   r‡   rÚ   r‹   r£   rc   rŠ   )rm   r  r   r   r$   r  r  Zif_same_sizer  r³   rb   r“   r  r%   r%   r&   ÚequalsÛ  s6   ÿ

þ€ý€þþ€õ
zSetInstance.equalsNc           	      C   sf   |  tj¡}|du rt |t¡}nt|tƒrt ||¡}|  |||¡}| |||dƒ}| 	|¡}||fS )zî
        Allocate a SetInstance with its storage.
        Return a (ok, instance) tuple where *ok* is a LLVM boolean and
        *instance* is a SetInstance object (the object's contents are
        only valid when *ok* is true).
        N)
r¯   r   r°   r   r6   r÷   rU   Úintr  r  )	Úclsr   r   r    Únitemsr¤   r  rm   r  r%   r%   r&   Úallocate_exó  s   

zSetInstance.allocate_exc                 C   s^   |   ||||¡\}}|j| |¡dd�� |j |td¡ W d  ƒ |S 1 s(w   Y  |S )zø
        Allocate a SetInstance with its storage.  Same as allocate_ex(),
        but return an initialized *instance*.  If allocation failed,
        control is transferred to the caller using the target's current
        call convention.
        FrÒ   )zcannot allocate setN)r  r‡   rÚ   rþ   rÿ   r   )r  r   r   r    r  r  rm   r%   r%   r&   Úallocate  s   
ÿ
ÿýzSetInstance.allocatec                 C   s<   | |||dƒ}||j _| tj¡|j _|j |||j¡ |S )z¨
        Allocate a new set instance pointing to an existing payload
        (a meminfo pointer).
        Note the parent field has to be filled by the caller.
        N)	rÃ   rÇ   Úget_constant_nullr   ÚpyobjectrÌ   rÅ   Úincrefr;   )r  r   r   r    rÇ   rm   r%   r%   r&   Úfrom_meminfo  s
   zSetInstance.from_meminfoc              	   C   s  |j }t |d¡}t |t¡}| ||¡}t ||¡}| d¡}	| d¡}
| |	¡ | 	|	¡�A | 
|¡}| d||¡}|j|dd�� | |
¡ W d  ƒ n1 sSw   Y  | ||¡}| ||¡ | |	¡ W d  ƒ n1 ssw   Y  | |
¡ | 
|¡S )zT
        Choose a suitable number of entries for the given number of items.
        r…   úcalcsize.bodyúcalcsize.endú>=FrÒ   N)r7   r   r6   r÷   Úshlr   r•   r—   r‰   r›   rŠ   rL   r‡   r‹   rž   )r  r   r   r  r¤   r¦   rù   Úmin_entriesZsize_pr©   rª   r±   Zis_large_enoughZ	next_sizer%   r%   r&   r  $  s(   



ÿù
	
zSetInstance.choose_alloc_sizec              	   C   sX  | j }| j}|j}t |d¡}t |d¡}| j}| ||¡}| |j|¡}	| 	d||	¡}
|j
|
dd��o t ||	¡}| d¡}| d¡}| |¡ | |¡�' | |¡}| ||¡}| ||¡ | 	d||¡}| |||¡ W d  ƒ n1 sxw   Y  | |¡ | |¡}tr“| |d	||	||¡ |  ||d
¡ W d  ƒ dS 1 s¥w   Y  dS )zs
        When adding to the set, ensure it is properly sized for the given
        number of used entries.
        r…   é   r%  FrÒ   r#  r$  NzKupsize to %zd items: current size = %zd, min entries = %zd, new size = %zd
zcannot grow set)rf   rg   r7   r   r6   r$   r&  rš   rr   rL   r‡   r   r•   r—   r‰   r›   rŠ   r‹   rµ   rž   ÚDEBUG_ALLOCSÚprintfÚ_resize)rm   r  r   r   r¤   r¦   Útwor$   r'  r±   Úneed_resizeÚ
new_size_pr©   rª   Únew_sizeÚis_too_smallr%   r%   r&   rÕ   C  s<   



ú

ý"çzSetInstance.upsizec              
   C   sÊ  | j }| j}|j}t |d¡}t |d¡}t |t¡}| j}| ||¡}	| | 	d|	|¡|	|¡}	| |	|¡}
| 
|j|¡}| | 	d|
|¡| 	d||¡¡}|j|dd��‡ t ||¡}| d¡}| d	¡}| |¡ | |¡�? | |¡}| ||¡}| 	d
|	|¡}| |¡� | |¡ W d  ƒ n1 s—w   Y  | ||¡ | |¡ W d  ƒ n1 s±w   Y  | |¡ | |¡}trÌ| |d|||	|¡ |  ||d¡ W d  ƒ dS 1 sÞw   Y  dS )zw
        When removing from the set, ensure it is properly sized for the given
        number of used entries.
        r…   r(  r%  r  rT   FrÒ   r#  r$  r  NzMdownsize to %zd items: current size = %zd, min entries = %zd, new size = %zd
zcannot shrink set)rf   rg   r7   r   r6   r÷   r$   r&  r9   rL   rš   rr   r–   r‡   r   r•   r—   r‰   r›   rŠ   rœ   r‹   rž   r)  r*  r+  )rm   r  r   r   r¤   r¦   r,  rù   r$   r'  Úmax_sizer±   r-  r.  r©   rª   r/  r0  r%   r%   r&   rà   q  sR   ÿþ



ÿ÷

ý"àzSetInstance.downsizec           
      C   sÀ   | j }| j}|}| j|dd�}|j| |¡dd�� |j |t|f¡ W d  ƒ n1 s-w   Y  | j}| 	¡ �}|j
}	| j||	j|	jddd� W d  ƒ n1 sSw   Y  |  |j¡ dS )zw
        Resize the payload to the given number of entries.

        CAUTION: *nentries* must be a power of 2!
        T©ÚreallocFrÒ   N)rÖ   rÛ   )rf   rg   r  r‡   rÚ   rþ   rÿ   r   r$   r´   rb   rÝ   rˆ   r2   Ú_free_payloadr!   )
rm   r$   r  Úerrmsgr   r   Zold_payloadr  r³   rb   r%   r%   r&   r+  ­  s"   
ÿÿ
ÿþzSetInstance._resizec                 C   s®   | j }| j}| j ¡ �}|j}|  |j¡ W d  ƒ n1 sw   Y  |  | jj¡ | j	|dd�}|j
| |¡dd�� |j |td¡ W d  ƒ dS 1 sPw   Y  dS )z›
        Replace the payload with a new empty payload with the given number
        of entries.

        CAUTION: *nentries* must be a power of 2!
        NTr2  FrÒ   )zcannot reallocate set)rf   rg   r$   r´   rb   rÞ   rˆ   r4  r!   r  r‡   rÚ   rþ   rÿ   r   )rm   r  r   r   r³   rb   r  r%   r%   r&   rø   È  s   þ
ÿ"ÿzSetInstance._replace_payloadc              
   C   sd  | j }| j}t |tj¡}| tj¡}t 	|d¡}t 	|d¡}| 
t | j¡¡}	| |	¡}
| j}|
|8 }
t ||t 	||¡t 	||
¡¡\}}|j|dd�� | tj|¡ W d  ƒ n1 s_w   Y  |j| |¡dd��¶ |r…| jj}|jj|||d�}t ||¡}n|  ||j¡}|j ||| |tj¡¡}t ||¡}|j|dd��n\}}|� | tj|¡ W d  ƒ n1 s½w   Y  |�@ |sÓ|| j_| tj ¡| j_!| j"}t #||j$|d¡ ||_%||_&||_'| (||¡}||_)t*rý| +|d	||j$|¡ W d  ƒ n	1 �sw   Y  W d  ƒ n	1 �sw   Y  W d  ƒ n	1 �s(w   Y  | |¡S )
zÃ
        Allocate and initialize payload for the given number of entries.
        If *realloc* is True, the existing meminfo is reused.

        CAUTION: *nentries* must be a power of 2!
        r   r…   FrÒ   NT)r±   éÿ   ú.allocated %zd bytes for set at %p: mask = %zd
),rf   rg   r   r•   r¢   r¯   r   r°   r   r6   r   r   rh   r)   rÁ   Úmuladd_with_overflowr‡   r‹   r£   rŠ   rÃ   rÇ   rÅ   Zmeminfo_varsize_alloc_uncheckedÚis_nullÚ	_imp_dtorÚmoduleÚ"meminfo_new_varsize_dtor_uncheckedr   Ú	voidptr_trü   r  r   rÌ   r$   Úmemsetr!   rx   r{   r}   rß   rr   r)  r*  )rm   r  r3  r   r   r  r¤   r¶   r¦   r"   Úpayload_sizeÚ
entry_sizeÚ	allocsizeÚovfrÇ   r!   Úalloc_okÚdtorÚif_errorÚif_okr$   Únew_maskr%   r%   r&   r  ß  sx   


þÿþÿÿÿþ€ò€ü€ò
$zSetInstance._allocate_payloadc                 C   s   | j j | j| j|¡ dS )z9
        Free an allocated old payload at *ptr*.
        N)rf   rÅ   Zmeminfo_varsize_freerg   rÇ   )rm   r!   r%   r%   r&   r4  "  s   zSetInstance._free_payloadc                 C   s(  | j }| j}t |tj¡}| tj¡}t 	|d¡}t 	|d¡}| 
t | j¡¡}| |¡}	| j}
|	|
8 }	|j}| ||¡}| t 	||	¡| t 	||
¡|¡¡}|j| |¡dd��­ |  ||j¡}|j ||| |tj¡¡}t ||¡}|j|dd��|\}}|� | tj|¡ W d  ƒ n1 s’w   Y  |�O || j_| j }|j!|_!|j"|_"||_#||_t $||j%|j%||
¡ | &¡ �}|  '|j(j)¡ W d  ƒ n1 sÐw   Y  t*rá| +|d||j,|¡ W d  ƒ n1 sëw   Y  W d  ƒ n1 súw   Y  W d  ƒ n	1 �s
w   Y  | |¡S )z7
        Raw-copy the given payload into self.
        r   r…   TrÒ   FNr7  )-rf   rg   r   r•   r¢   r¯   r   r°   r   r6   r   r   rh   r)   rÁ   rr   rš   r�   r‡   rŠ   r:  r;  rÅ   r<  r   r=  r9  rü   r‹   r£   rÃ   rÇ   r$   rx   r{   r}   Ú
raw_memcpyre   r´   rÔ   rb   rˆ   r)  r*  r!   )rm   Zsrc_payloadr   r   r  r¤   r¶   r¦   r"   r?  r@  rr   r  rA  rD  rÇ   rC  rE  rF  r$   r³   r%   r%   r&   rý   (  sj   
ÿÿÿÿ
þ
ÿþ€ì€ý€ù
"zSetInstance._copy_payloadc                 C   sÆ   t j}| tj¡}t t ¡ |||g¡}d| jj	› �}t j
|||d�}|jrad|_t | ¡ ¡}t||| j|jd ƒ}	|	 ¡ �}
|
j}|j || jj	|j¡ W d  ƒ n1 sXw   Y  | ¡  |S )z Define the dtor for set
        z
.dtor.set.)ÚnameÚlinkonce_odrr   N)r   r=  r¯   r   Úsize_tr   ÚFunctionTypeÚVoidTyperh   rZ   Úget_or_insert_functionÚis_declarationÚlinkageÚ	IRBuilderr—   rd   rE   r´   rb   rÅ   Údecrefrˆ   Úret_void)rm   r   r;  Ú	llvoidptrZllsize_tr=   Úfnamer?   r   r$   r³   rb   r%   r%   r&   r:  i  s$   þ
þzSetInstance._imp_dtorc                 C   ó   | j j | j| jj|¡ dS )z Incref an element value
        N)rf   rÅ   r!  rg   rh   rZ   rÏ   r%   r%   r&   rÔ   …  ó   zSetInstance.incref_valuec                 C   rV  )z Decref an element value
        N)rf   rÅ   rR  rg   rh   rZ   rÏ   r%   r%   r&   rÞ   Š  rW  zSetInstance.decref_value)T)TTr¸   rp   ).r¹   rº   r»   rn   r¼   rZ   r$   r;   rÇ   rÌ   r½   rÍ   rÑ   rØ   rÝ   râ   rã   rš   ræ   rä   rò   ró   rö   rú   r  r	  r
  r  r  r  r  Úclassmethodr  r  r"  r  rÕ   rà   r+  rø   r  r4  rý   r:  rÔ   rÞ   r%   r%   r%   r&   rÀ   t  sh    











			'


.<
CArÀ   c                   @   sZ   e Zd Zdd„ Zedd„ ƒZedd„ ƒZedd„ ƒZed	d
„ ƒZ	e	j
dd
„ ƒZ	dd„ ZdS )ÚSetIterInstancec                 C   sL   || _ || _|| _| |||¡| _| j j || j¡}t||| jj	|ƒ| _
d S rp   )rf   rg   rh   rÂ   Ú_iterrÅ   rÆ   rÇ   rd   Ú	containerri   )rm   r   r   Ú	iter_typeÚiter_valr!   r%   r%   r&   rn   ’  s   zSetIterInstance.__init__c                 C   sJ   t |||j|ƒ}| |||d ƒ}| tjd¡}t ||¡|j_|j	|j_	|S rD   )
rÀ   r[  Úget_constantr   r°   r   r•   rZ  ra   rÇ   )r  r   r   r\  rÄ   Zset_instrm   ra   r%   r%   r&   Úfrom_setš  s   
zSetIterInstance.from_setc                 C   rÈ   rp   )rZ  rÉ   rs   r%   r%   r&   r;   £  rÊ   zSetIterInstance.valuec                 C   ro   rp   )rZ  rÇ   rs   r%   r%   r&   rÇ   §  rt   zSetIterInstance.meminfoc                 C   s   | j  | jj¡S rp   )rg   rŠ   rZ  ra   rs   r%   r%   r&   ra   «  s   zSetIterInstance.indexc                 C   s   | j  || jj¡ d S rp   )rg   r‹   rZ  ra   rv   r%   r%   r&   ra   ¯  s   c                 C   sˆ   | j }| j}t |jd¡}| ¡  |j|d��#}|j}| ¡  | 	|j
¡ | j |j |¡| _ | ¡  W d   ƒ d S 1 s=w   Y  d S )Nr…   r­   )ra   ri   r   r6   r7   Úset_exhaustedr´   rb   Ú	set_validÚyield_rˆ   rg   rš   rc   )rm   Úresultra   r$   r¦   r³   rb   r%   r%   r&   Úiternext³  s   
"úzSetIterInstance.iternextN)r¹   rº   r»   rn   rX  r_  r¼   r;   rÇ   ra   r½   rd  r%   r%   r%   r&   rY  �  s    




rY  c              	   C   s¤   t |ƒ}t | |||¡}|dkrJt ||¡}t ||¡}|  tj|¡}t 	||¡�}	| 
t ||d|	j¡¡}
| |
¡ W d  ƒ n1 sEw   Y  t| |||jƒS )zD
    Build a set of the given type, containing the given items.
    r   N)ÚlenrÀ   r  r   Ú
pack_arrayr•   r^  r   r°   r˜   rŠ   r‚   ra   rš   r   r;   )r   r   r    Úitemsr  ÚinstÚarrayÚ	array_ptrÚcountr³   r‘   r%   r%   r&   Ú	build_setÆ  s   þrl  c                 C   s$   |j }t | ||¡}t| |||jƒS rp   )Úreturn_typerÀ   r  r   r;   )r   r   r>   rE   r    rh  r%   r%   r&   Úset_empty_constructorÜ  s   rn  c           
      C   s�   |j }|j\}|\}t| |||ƒ}t | |||¡}t| |||ƒ�}	| |	j¡ | j 	||j
|	j¡ W d   ƒ n1 s;w   Y  t| |||jƒS rp   )rm  rE   r   rÀ   r  r   rš   r;   rÅ   rR  rZ   r   )
r   r   r>   rE   r    Ú
items_typerg  Únrh  r³   r%   r%   r&   Úset_constructorâ  s   þrq  c                 C   s    t | ||jd |d ƒ}| ¡ S rD   )rÀ   rE   rÍ   ©r   r   r>   rE   rh  r%   r%   r&   Úset_lenú  s   rs  c                 C   s&   t | ||jd |d ƒ}| |d ¡S ©Nr   r…   )rÀ   rE   rò   rr  r%   r%   r&   Úin_setÿ  s   ru  Úgetiterc                 C   s(   t  | ||j|d ¡}t| ||j|jƒS rD   )rY  r_  rm  r
   r;   rr  r%   r%   r&   Úgetiter_set  s   rw  rd  c                 C   s&   t | ||jd |d ƒ}| |¡ d S rD   )rY  rE   rd  )r   r   r>   rE   rc  rh  r%   r%   r&   Úiternext_listiter	  s   rx  zset.addc                 C   ó2   t | ||jd |d ƒ}|d }| |¡ |  ¡ S rt  )rÀ   rE   rš   Úget_dummy_value©r   r   r>   rE   rh  r‘   r%   r%   r&   Úset_add  s   
r|  c                 C   ó   t  ||¡}dd„ }||fS )Nc                 S   ry  rt  )rÀ   rE   ró   rz  r{  r%   r%   r&   Úset_discard"  s   
z!_set_discard.<locals>.set_discard©r   Únone)r<   r[   r‘   r>   r~  r%   r%   r&   Ú_set_discard  s   r�  ró   c                 C   ó   dd„ S )Nc                 S   ó
   t | |ƒS rp   )r�  ©r[   r‘   r%   r%   r&   Ú<lambda>.  ó   
 z ol_set_discard.<locals>.<lambda>r%   r„  r%   r%   r&   Úol_set_discard,  rt   r‡  c                 C   s   |  |¡}dd„ }||fS )Nc                 S   st   t | ||jd |d ƒ}|jj}|jt ||¡dd�� | j |t	d¡ W d   ƒ | 
¡ S 1 s1w   Y  | 
¡ S )Nr   FrÒ   )zset.pop(): empty set)rÀ   rE   r$   rx   r‡   r   r9  rþ   rÿ   ÚKeyErrorrö   )r   r   r>   rE   rh  rx   r%   r%   r&   Úset_pop5  s   
ÿ
ÿüz_set_pop.<locals>.set_poprY   )r<   r[   r>   r‰  r%   r%   r&   Ú_set_pop1  s   
	rŠ  rö   c                 C   r‚  )Nc                 S   rç   rp   )rŠ  ©r[   r%   r%   r&   r…  C  ó    zol_set_pop.<locals>.<lambda>r%   r‹  r%   r%   r&   Ú
ol_set_popA  rt   r�  c                 C   r}  )Nc                 S   s|   t | ||jd |d ƒ}|d }| |¡}|j| |¡dd�� | j |td¡ W d   ƒ |  ¡ S 1 s5w   Y  |  ¡ S )Nr   r…   FrÒ   )zset.remove(): key not in set)	rÀ   rE   ró   r‡   rÚ   rþ   rÿ   rˆ  rz  )r   r   r>   rE   rh  r‘   r“   r%   r%   r&   Ú
set_removeJ  s   

ÿ
ÿüz_set_remove.<locals>.set_remover  )r<   r[   r‘   r>   rŽ  r%   r%   r&   Ú_set_removeF  s   
r�  Úremovec                 C   s   | j |kr	dd„ S d S )Nc                 S   rƒ  rp   )r�  r„  r%   r%   r&   r…  Z  r†  zol_set_remove.<locals>.<lambda>rY   r„  r%   r%   r&   Úol_set_removeW  s   
ÿr‘  c                 C   s   t  |¡}dd„ }||fS )Nc                 S   s(   t | ||jd |d ƒ}| ¡  |  ¡ S rD   )rÀ   rE   rú   rz  rr  r%   r%   r&   Ú	set_clearc  s   z_set_clear.<locals>.set_clearr  )r<   r[   r>   r’  r%   r%   r&   Ú
_set_clear_  s   
r“  rú   c                 C   r‚  )Nc                 S   rç   rp   )r“  r‹  r%   r%   r&   r…  m  rŒ  zol_set_clear.<locals>.<lambda>r%   r‹  r%   r%   r&   Úol_set_cleark  rt   r”  c                 C   s   ||ƒ}dd„ }||fS )Nc                 S   s2   t | ||jd |d ƒ}| ¡ }t| ||j|jƒS rD   )rÀ   rE   r  r   rm  r;   ©r   r   r>   rE   rh  r  r%   r%   r&   Úset_copyt  s   z_set_copy.<locals>.set_copyr%   )r<   r[   r>   r–  r%   r%   r&   Ú	_set_copyp  s   r—  r  c                 C   r‚  )Nc                 S   rç   rp   )r—  r‹  r%   r%   r&   r…  ~  rŒ  zol_set_copy.<locals>.<lambda>r%   r‹  r%   r%   r&   Úol_set_copy|  rt   r˜  c                 C   óB   t | ||jd |d ƒ}t | ||jd |d ƒ}| |¡ |  ¡ S rt  )rÀ   rE   r
  rz  r•  r%   r%   r&   Úset_difference_update�  s   
rš  c                 C   ó   t  ||¡}|tfS rp   )r   r€  rš  ©r<   ÚaÚbr>   r%   r%   r&   Ú_set_difference_updateŠ  ó   rŸ  Údifference_updatec                 C   ó   t | |ƒ dd„ S )Nc                 S   rƒ  rp   )rŸ  ©r�  rž  r%   r%   r&   r…  “  r†  z,set_difference_update_impl.<locals>.<lambda>©r^   r£  r%   r%   r&   Úset_difference_update_impl�  ó   
r¥  c                 C   r™  rt  )rÀ   rE   r	  rz  r•  r%   r%   r&   Úset_intersection_update–  ó   
r§  c                 C   r›  rp   )r   r€  r§  rœ  r%   r%   r&   Ú_set_intersection_update�  r   r©  Úintersection_updatec                 C   r¢  )Nc                 S   rƒ  rp   )r©  r£  r%   r%   r&   r…  ¦  r†  z.set_intersection_update_impl.<locals>.<lambda>r¤  r£  r%   r%   r&   Úset_intersection_update_impl£  r¦  r«  c                 C   r™  rt  )rÀ   rE   r  rz  r•  r%   r%   r&   Úset_symmetric_difference_update©  r¨  r¬  c                 C   r›  rp   )r   r€  r¬  rœ  r%   r%   r&   Ú _set_symmetric_difference_update°  r   r­  Úsymmetric_difference_updatec                 C   r¢  )Nc                 S   rƒ  rp   )r­  r£  r%   r%   r&   r…  ¹  r†  z6set_symmetric_difference_update_impl.<locals>.<lambda>r¤  r£  r%   r%   r&   Ú$set_symmetric_difference_update_impl¶  r¦  r¯  z
set.updatec                 C   sÚ   t | ||jd |d ƒ}|jd }|d }t| |||ƒ}|d ur-| |jj|¡}| |¡ t| |||ƒ�"}	|  ||	j	|j
|j
¡}
| |
¡ | j ||j
|	j	¡ W d   ƒ n1 sYw   Y  |d uri| |jj¡ |  ¡ S rt  )rÀ   rE   r   rš   r$   rx   rÕ   r   Úcastr;   rZ   rÅ   rR  rà   rz  )r   r   r>   rE   rh  ro  rg  rp  r/  r³   Úcastedr%   r%   r&   Ú
set_update¼  s   


÷r²  c                    s(   t ‡fdd„ƒ‰ t| ƒ‡ fdd„ƒ}d S )Nc                    s   |||ƒ}‡ fdd„}||fS )Nc                    s:   |j |jd ks
J ‚ˆ | |||ƒ t| ||jd |d ƒS rD   )rm  rE   r
   )r   r   r>   rE   ©rG   r%   r&   ÚcodegenÞ  s   z>gen_operator_impl.<locals>._set_operator_intr.<locals>.codegenr%   ©r<   r�  rž  r>   r´  r³  r%   r&   Ú_set_operator_intrÛ  s   
z-gen_operator_impl.<locals>._set_operator_intrc                    s   t | |ƒ ‡ fdd„S )Nc                    s
   ˆ | |ƒS rp   r%   r£  ©r¶  r%   r&   r…  ç  r†  z=gen_operator_impl.<locals>._ol_set_operator.<locals>.<lambda>r¤  r£  r·  r%   r&   Ú_ol_set_operatorä  s   
z+gen_operator_impl.<locals>._ol_set_operator)r   r   )ÚoprG   r¸  r%   )r¶  rG   r&   Úgen_operator_implÚ  s   rº  r
  c                 C   ó   t | |ƒ dd„ }|S )Nc                 S   s   |   ¡ }| |¡ |S rp   )r  r¡  ©r�  rž  r[   r%   r%   r&   Údifference_implú  s   
z,impl_set_difference.<locals>.difference_implr¤  )r�  rž  r½  r%   r%   r&   Úimpl_set_differenceõ  s   
r¾  Úintersectionc                 C   r»  )Nc                 S   s<   t | ƒt |ƒk r|  ¡ }| |¡ |S | ¡ }| | ¡ |S rp   )re  r  rª  r¼  r%   r%   r&   Úintersection_impl  ó   

z+set_intersection.<locals>.intersection_implr¤  )r�  rž  rÀ  r%   r%   r&   Úset_intersection  ó   

rÂ  r  c                 C   r»  )Nc                 S   ó<   t | ƒt |ƒkr|  ¡ }| |¡ |S | ¡ }| | ¡ |S rp   )re  r  r®  r¼  r%   r%   r&   Úsymmetric_difference_impl  rÁ  z;set_symmetric_difference.<locals>.symmetric_difference_implr¤  )r�  rž  rÅ  r%   r%   r&   Úset_symmetric_difference  rÃ  rÆ  Úunionc                 C   r»  )Nc                 S   rÄ  rp   )re  r  Úupdater¼  r%   r%   r&   Ú
union_impl(  rÁ  zset_union.<locals>.union_implr¤  )r�  rž  rÉ  r%   r%   r&   Ú	set_union#  rÃ  rÊ  c                 C   r}  )Nc                 S   ó:   t | ||jd |d ƒ}t | ||jd |d ƒ}| |¡S rt  )rÀ   rE   r  r•  r%   r%   r&   r´  ;  ó   
z _set_isdisjoint.<locals>.codegen©r   Úbooleanrµ  r%   r%   r&   Ú_set_isdisjoint7  ó   rÏ  r  c                 C   r¢  )Nc                 S   rƒ  rp   )rÏ  r£  r%   r%   r&   r…  H  r†  z set_isdisjoint.<locals>.<lambda>r¤  r£  r%   r%   r&   Úset_isdisjointD  ó   
rÑ  c                 C   r}  )Nc                 S   rË  rt  ©rÀ   rE   r  r•  r%   r%   r&   r´  O  rÌ  z_set_issubset.<locals>.codegenrÍ  rµ  r%   r%   r&   Ú_set_issubsetK  rÐ  rÔ  r  c                 C   r¢  )Nc                 S   rƒ  rp   )rÔ  r£  r%   r%   r&   r…  \  r†  zset_issubset.<locals>.<lambda>r¤  r£  r%   r%   r&   Úset_issubsetW  s   
rÕ  Ú
issupersetc                 C   r»  )Nc                 S   s
   |  | ¡S rp   )r  r£  r%   r%   r&   Úsuperset_impld  ó   
z%set_issuperset.<locals>.superset_implr¤  )r�  rž  r×  r%   r%   r&   Úset_issuperset_  s   
rÙ  c                 C   r}  )Nc                 S   rË  rt  )rÀ   rE   r  r•  r%   r%   r&   r´  m  rÌ  z_set_eq.<locals>.codegenrÍ  rµ  r%   r%   r&   Ú_set_eqi  rÐ  rÚ  c                 C   r¢  )Nc                 S   rƒ  rp   )rÚ  r£  r%   r%   r&   r…  y  r†  zset_eq.<locals>.<lambda>r¤  r£  r%   r%   r&   Úset_equ  rÒ  rÛ  c                 C   r»  )Nc                 S   s
   | |k S rp   r%   r£  r%   r%   r&   Úne_impl  rØ  zset_ne.<locals>.ne_implr¤  )r�  rž  rÜ  r%   r%   r&   Úset_ne{  ó   
rÝ  c                 C   r}  )Nc                 S   s>   t | ||jd |d ƒ}t | ||jd |d ƒ}|j|dd�S )Nr   r…   T)r  rÓ  r•  r%   r%   r&   r´  ˆ  s   z_set_lt.<locals>.codegenrÍ  rµ  r%   r%   r&   Ú_set_lt„  rÐ  rß  c                 C   r¢  )Nc                 S   rƒ  rp   )rß  r£  r%   r%   r&   r…  ”  r†  zset_lt.<locals>.<lambda>r¤  r£  r%   r%   r&   Úset_lt�  rÒ  rà  c                 C   r»  )Nc                 S   s   || k S rp   r%   r£  r%   r%   r&   Úgt_implš  ré   zset_gt.<locals>.gt_implr¤  )r�  rž  rá  r%   r%   r&   Úset_gt–  rÞ  râ  c                 C   s^   t | ||jd |d ƒ}t | ||jd |d ƒ}| |jtj¡}| |jtj¡}| d||¡S )Nr   r…   rJ   )rÀ   rE   ÚptrtointrÇ   r   r¤   Úicmp_signed)r   r   r>   rE   r�  rž  ÚmaÚmbr%   r%   r&   Úset_isŸ  s
   rç  c                 C   s   |j |j ksJ ‚|S rp   rY   )r   r   ÚfromtyÚtotyrÐ   r%   r%   r&   Ú
set_to_set«  s   rê  )}Ú__doc__Úcollectionsr¾   Úmathr”   Ú	functoolsr   Úllvmliter   Ú
numba.corer   r   r   Únumba.core.imputilsr   r   r	   r
   r   r   r   r   r   Ú
numba.miscr   Únumba.cpythonr   Únumba.core.errorsr   r   Únumba.core.extendingr   r   r   r'   r+   rK   rQ   r8   r÷   r™   r)  rC   rH   rN   rS   r5   r^   Ú
namedtupler_   Úobjectrd   rÀ   rY  rl  Úsetrn  ÚIterableTyperq  re  rV   rs  rò   ÚAnyru  rw  ÚSetIterÚBORROWEDrx  r|  r�  r‡  rŠ  r�  r�  r‘  r“  r”  r—  r˜  rš  rŸ  r¥  r§  r©  r«  r¬  r­  r¯  r²  rº  ÚiandÚiorÚisubÚixorÚop_Úop_implrß   r¾  r–   rÂ  ÚxorrÆ  Úor_rÊ  rÏ  rÑ  rÔ  ÚlerÕ  ÚgerÙ  rÚ  r�   rÛ  ÚnerÝ  rß  Últrà  Úgtrâ  Úis_rç  rê  r%   r%   r%   r&   Ú<module>   s   ,
	        "6

























	









ü

















