Ë
    lQêju  ã                   óD   — d dl mZmZmZmZ d dlmZmZmZ  G d„ d«      Z	y)é    )ÚDictÚListÚSetÚcast)Ú	LogRecordÚ	OperationÚVectorc                   ó
  — e Zd ZU dZeeef   ed<   ee   ed<   ee   ed<   ee   ed<   e	ed<   e	ed<   dd
„Z
de	fd„Zdee   fd„Zdee   fd„Zdee   dee   fd„Zdedefd„Zdedefd„Zede	fd„«       Zddededd	fd„Zy	)ÚBatchz7Used to model the set of changes as an atomic operationÚ_ids_to_recordsÚ_deleted_idsÚ_written_idsÚ_upsert_add_idsÚ	add_countÚupdate_countÚreturnNc                 óˆ   — i | _         t        «       | _        t        «       | _        t        «       | _        d| _        d| _        y )Nr   )r   Úsetr   r   r   r   r   ©Úselfs    úg/home/oem/CyberBrain26-unified/.venv/lib/python3.12/site-packages/chromadb/segment/impl/vector/batch.pyÚ__init__zBatch.__init__   s7   € Ø!ˆÔÜ›EˆÔÜ›EˆÔÜ"›uˆÔØˆŒØˆÕó    c                 óX   — t        | j                  «      t        | j                  «      z   S )z'Get the number of changes in this batch)Úlenr   r   r   s    r   Ú__len__zBatch.__len__   s#   € ä�4×$Ñ$Ó%¬¨D×,=Ñ,=Ó(>Ñ>Ð>r   c                 ó,   — t        | j                  «      S )z0Get the list of deleted embeddings in this batch)Úlistr   r   s    r   Úget_deleted_idszBatch.get_deleted_ids   ó   € ä�D×%Ñ%Ó&Ð&r   c                 ó,   — t        | j                  «      S )z0Get the list of written embeddings in this batch)r   r   r   s    r   Úget_written_idszBatch.get_written_ids   r    r   Úidsc                 ón   — |D �cg c]%  }t        t        | j                  |   d   d   «      ‘Œ' c}S c c}w )z.Get the list of vectors to write in this batchÚrecordÚ	embedding)r   r	   r   )r   r#   Úids      r   Úget_written_vectorszBatch.get_written_vectors#   s?   € ð UXö
ØNPŒD”˜×-Ñ-¨bÑ1°(Ñ;¸KÑHÕIò
ð 	
ùò 
s   …*2r'   c                 ó    — | j                   |   S )zGet the record for a given ID)r   ©r   r'   s     r   Ú
get_recordzBatch.get_record)   s   € à×#Ñ# BÑ'Ð'r   c                 ó   — || j                   v S )zCheck if a given ID is deleted)r   r*   s     r   Ú
is_deletedzBatch.is_deleted-   s   € à�T×&Ñ&Ð&Ð&r   c                 ó,   — t        | j                  «      S )N)r   r   r   s    r   Údelete_countzBatch.delete_count1   s   € ä�4×$Ñ$Ó%Ð%r   r%   Úexists_alreadyc                 ó¢  — |d   d   }|d   d   t         j                  k(  �rš|| j                  v �rE| j                  j                  |«       | j                  |   d   d   t         j
                  k(  r| xj                  dz  c_        �n| j                  |   d   d   t         j                  k(  r1| xj                  dz  c_        | j                  j                  |«       n¿| j                  |   d   d   t         j                  k(  r™|| j                  v r1| xj                  dz  c_        | j                  j                  |«       nZ| xj                  dz  c_        | j                  j                  |«       n)|| j                  vr| j                  j                  |«       || j                  v r| j                  |= yy|| j                  |<   | j                  j                  |«       || j                  v r| j                  j                  |«       |d   d   t         j                  k(  rI|s1| xj                  dz  c_        | j                  j                  |«       y| xj                  dz  c_        y|d   d   t         j
                  k(  r| xj                  dz  c_        y|d   d   t         j                  k(  r| xj                  dz  c_        yy)ak  Apply an embedding record to this batch. Records passed to this method are assumed to be validated for correctness.
        For example, a delete or update presumes the ID exists in the index. An add presumes the ID does not exist in the index.
        The exists_already flag should be set to True if the ID does exist in the index, and False otherwise.
        r%   r'   Ú	operationé   N)r   ÚDELETEr   Úremover   ÚADDr   ÚUPDATEr   r   ÚaddÚUPSERTr   )r   r%   r0   r'   s       r   ÚapplyzBatch.apply5   sp  € ð
 �HÑ˜dÑ#ˆØ�(Ñ˜KÑ(¬I×,<Ñ,<Ó<ð �T×&Ñ&Ò&Ø×!Ñ!×(Ñ(¨Ô,Ø×'Ñ'¨Ñ+¨HÑ5°kÑBÄiÇmÁmÒSØ—N’N aÑ'—Nà×(Ñ(¨Ñ,¨XÑ6°{ÑCÄy×GWÑGWÒWà×%Ò%¨Ñ*Õ%Ø×%Ñ%×)Ñ)¨"Õ-à×(Ñ(¨Ñ,¨XÑ6°{ÑCÄy×GWÑGWÒWà˜T×1Ñ1Ñ1ØŸš¨!Ñ+�Ø×,Ñ,×3Ñ3°BÕ7à×)Ò)¨QÑ.Õ)Ø×)Ñ)×-Ñ-¨bÕ1Ø˜4×,Ñ,Ñ,Ø×!Ñ!×%Ñ% bÔ)ð �T×)Ñ)Ñ)Ø×(Ñ(¨Ñ,ð *ð (.ˆD× Ñ  Ñ$Ø×Ñ×!Ñ! "Ô%ð �T×&Ñ&Ñ&Ø×!Ñ!×(Ñ(¨Ô,ð �hÑ Ñ,´	×0@Ñ0@Ò@Ù%Ø—N’N aÑ'•NØ×(Ñ(×,Ñ,¨RÕ0à×%Ò%¨Ñ*Ö%Ø˜Ñ! +Ñ.´)·-±-Ò?Ø—’ !Ñ#–Ø˜Ñ! +Ñ.´)×2BÑ2BÒBØ×!Ò! QÑ&Ö!ð Cr   )r   N)F)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ústrr   Ú__annotations__r   Úintr   r   r   r   r"   r	   r(   r+   Úboolr-   Úpropertyr/   r:   © r   r   r   r      sä   … ÙAà˜#˜y˜.Ñ)Ó)Ø�c‘(ÓØ�c‘(ÓØ˜‘XÓØƒNØÓóð?˜ó ?ð'  c¡ó 'ð'  c¡ó 'ð
 t¨C¡yð 
°T¸&±\ó 
ð(˜Sð ( Yó (ð'˜Sð ' Tó 'ð ð&˜cò &ó ð&ñ5'˜Ið 5'°tð 5'Èô 5'r   r   N)
Útypingr   r   r   r   Úchromadb.typesr   r   r	   r   rD   r   r   ú<module>rG      s   ðß (Ó (ß 7Ñ 7÷e'ò e'r   