
    BThu
                         d dl mZ d dlmZ d dl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 ddlmZmZ erd d	lmZ  G d
 de      ZddgZy)    )	lru_cache)Path)TYPE_CHECKINGAnyOptionalSetType)SnapshotCollection)TaintedSnapshotError)AbstractSyrupyExtension   )AmberDataSerializerAmberDataSerializerSorted)SerializableDatac            	           e Zd ZU dZdZeZed   ed<   ddde	de
fd	Zd
e
dee
   ddfdZd
e
ddfdZeed
e
de
ddfd              Zd
e
de
de
ded   fdZe	 	 	 	 dd       Zy)AmberSnapshotExtensionzE
    An amber snapshot file stores data in the following format:
    ambrr   serializer_classdatar   kwargsreturnc                 <     | j                   j                  |fi |S )zv
        Returns the serialized form of 'data' to be compared
        with the snapshot data written to disk.
        )r   	serialize)selfr   r   s      r/var/www/catia.catastroantioquia-mas.com/valormas/lib/python3.12/site-packages/syrupy/extensions/amber/__init__.pyr   z AmberSnapshotExtension.serialize!   s"    
 /t$$..t>v>>    snapshot_locationsnapshot_namesNc                     t        j                  |      }|D ]  }|j                  |        |j                  r| j                  j                  |       y t        |      j                          y N)r   	read_fileremovehas_snapshotsr   
write_filer   unlink)r   r   r   snapshot_collection_to_updatesnapshot_names        r   delete_snapshotsz'AmberSnapshotExtension.delete_snapshots(   sg     )<(E(EFW(X%+ 	@M)00?	@ )66!!,,-JK"#**,r   r
   c                 8    | j                   j                  |      S r    r   r!   )r   r   s     r   _read_snapshot_collectionz0AmberSnapshotExtension._read_snapshot_collection4   s    $$../@AAr   	cache_keyc                 8    | j                   j                  |      S r    r*   )clsr   r,   s      r   __cacheable_read_snapshotz0AmberSnapshotExtension.__cacheable_read_snapshot7   s    
 ##--.?@@r   r'   
session_idc                     | j                  ||      }|j                  |      }t        |j                  xs |xr |j                        }|r|j                  nd }|rt        |      |S )N)r   r,   )snapshot_data)0_AmberSnapshotExtension__cacheable_read_snapshotgetbooltaintedr   r   )r   r   r'   r0   	snapshotssnapshotr6   r   s           r   !_read_snapshot_data_from_locationz8AmberSnapshotExtension._read_snapshot_data_from_location>   sn     22/: 3 
	 ==/y((KX-J(:J:JL (x}}d&T::r   c                >    | j                   j                  |d       y )NT)merge)r   r$   )r.   snapshot_collections     r   _write_snapshot_collectionz1AmberSnapshotExtension._write_snapshot_collectionK   s     	''(;4'Hr   )r<   r
   r   N)__name__
__module____qualname____doc___file_extensionr   r   r	   __annotations__r   strr   r   r(   r+   classmethodr   r3   r   r9   r=    r   r   r   r      s     O4Gd01G?0 ?C ?C ?
-!$
-69#h
-	
-B3 BCW B A #A03A	A  A
!$58FI	$	% I%9I	I Ir   r   r   N)	functoolsr   pathlibr   typingr   r   r   r   r	   syrupy.datar
   syrupy.exceptionsr   syrupy.extensions.baser   
serializerr   r   syrupy.typesr   r   __all__rF   r   r   <module>rP      sJ       + 2 :
 -7I4 7It $%:
;r   