Ë
    äš¾jv  ã                   ó¸   — 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
 	 d dlmZ ddlmZmZmZ erd	d
lmZ  ed«       G d„ de«      «       Zy# e$ r Y Œ0w xY w)é    N)ÚPath)ÚTemporaryDirectory)ÚAnyÚOptionalÚTYPE_CHECKING)ÚCloudPathIsADirectoryError)ÚResourceNotFoundErroré   )Ú	CloudPathÚNoStatErrorÚregister_path_classé   )ÚAzureBlobClientÚazurec                   óÚ   ‡ — e Zd ZU dZdZeed<   ded<   edefd„«       Zdde	e
   fd	„Zdd
ede	e
   fd„Zdd„Zdˆ fd„Zedefd„«       Zedefd„«       Zed„ «       Zedefd„«       Zˆ xZS )ÚAzureBlobPathaj  Class for representing and operating on Azure Blob Storage URIs, in the style of the Python
    standard library's [`pathlib` module](https://docs.python.org/3/library/pathlib.html).
    Instances represent a path in Blob Storage with filesystem path semantics, and convenient
    methods allow for basic operations like joining, reading, writing, iterating over contents,
    etc. This class almost entirely mimics the [`pathlib.Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path)
    interface, so most familiar properties and methods should be available and behave in the
    expected way.

    The [`AzureBlobClient`](../azblobclient/) class handles authentication with Azure. If a
    client instance is not explicitly specified on `AzureBlobPath` instantiation, a default client
    is used. See `AzureBlobClient`'s documentation for more details.
    zaz://Úcloud_prefixr   ÚclientÚreturnc                 ó   — | j                   S ©N)Ú	container©Úselfs    úg/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/cloudpathlib/azure/azblobpath.pyÚdrivezAzureBlobPath.drive%   s   € à�~‰~Ðó    Úmodec                 ó@   — | j                   j                  | ||¬«       y )N)ÚparentsÚexist_ok)r   Ú_mkdir)r   r    r!   r   s       r   ÚmkdirzAzureBlobPath.mkdir)   s   € Ø�‰×Ñ˜4¨¸8ÐÕDr   r!   c                 ó:  — | j                  «       r-|st        d| › �«      ‚| j                  j                  | | «       y t	        «       }t        |j                  «      dz  }|j                  «        | j                  j                  || «       |j                  «        y )NzFile exists: Úempty)
ÚexistsÚFileExistsErrorr   Ú
_move_filer   r   ÚnameÚtouchÚ_upload_fileÚcleanup)r   r!   r   ÚtfÚps        r   r*   zAzureBlobPath.touch,   st   € Ø�;‰;Œ=ÙÜ%¨°d°VÐ&<Ó=Ð=Ø�K‰K×"Ñ" 4¨Õ.ä#Ó%ˆBÜ�R—W‘W“ Ñ'ˆAØ�G‰GŒIà�K‰K×$Ñ$ Q¨Ô-à�J‰J�Lr   c                 ó   — 	 | j                   j                  | «      }t	        j
                  d d | j                  d d d |j                  dd«      d |j                  dd«      j                  «       d f
«      S # t        $ r t        d| › d�«      ‚w xY w)NzNo stats available for z%; it may be a directory or not exist.Úsizer   Úlast_modified)	r   Ú_get_metadatar	   r   ÚosÚstat_resultr   ÚgetÚ	timestamp)r   Úfollow_symlinksÚmetas      r   ÚstatzAzureBlobPath.stat:   s¡   € ð	Ø—;‘;×,Ñ,¨TÓ2ˆDô �~‰~àØØ×!Ñ!ØØØØ—‘˜ Ó#ØØ—‘˜¨!Ó,×6Ñ6Ó8Øðó
ð 	
øô %ò 	ÜØ)¨$¨Ð/TÐUóð ð	ús   ‚A4 Á4Bc                 ó²   •— 	 t         ‰| �  |«      S # t        $ r; | j                  j	                  | «      r| j                  j                  | |«      cY S ‚ w xY wr   )ÚsuperÚreplacer   r   Ú
_check_hnsr(   )r   ÚtargetÚ	__class__s     €r   r<   zAzureBlobPath.replaceQ   sT   ø€ ð	Ü‘7‘? 6Ó*Ð*øô *ò 	Ø�{‰{×%Ñ% dÔ+Ø—{‘{×-Ñ-¨d°FÓ;Ò;àð		ús   ƒ ’A AÁAc                 ó@   — | j                   j                  dd«      d   S )Nú/r   r   )Ú
_no_prefixÚsplitr   s    r   r   zAzureBlobPath.container\   s   € à�‰×$Ñ$ S¨!Ó,¨QÑ/Ð/r   c                 óJ   — | j                   }|j                  d«      r|dd  }|S )NrA   r   )Ú_no_prefix_no_driveÚ
startswith)r   Úkeys     r   ÚblobzAzureBlobPath.blob`   s+   € à×&Ñ&ˆð �>‰>˜#ÔØ�a�b�'ˆCàˆ
r   c                 óX   — | j                   j                  | «      j                  dd «      S )NÚetag©r   r2   r5   r   s    r   rJ   zAzureBlobPath.etagj   s$   € à�{‰{×(Ñ(¨Ó.×2Ñ2°6¸4Ó@Ð@r   c                 óx   — | j                   j                  | «      j                  di «      j                  dd «      S )NÚcontent_settingsÚcontent_md5rK   r   s    r   Úmd5zAzureBlobPath.md5n   s3   € à�{‰{×(Ñ(¨Ó.×2Ñ2Ð3EÀrÓJ×NÑNÈ}Ð^bÓcÐcr   )FFN)TN)T)r>   r   r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚstrÚ__annotations__Úpropertyr   r   r   r#   Úboolr*   r9   r<   r   rH   rJ   rO   Ú__classcell__)r?   s   @r   r   r      sÐ   ø… ñð  €L�#ÓØÓàð�sò ó ðñE¸À#¹ó Eñ˜dð °¸#±ó ó
õ.	ð ð0˜3ò 0ó ð0ð ð�cò ó ðð ñAó ðAð ðd�Sò dó ôdr   r   )r3   Úpathlibr   Útempfiler   Útypingr   r   r   Úcloudpathlib.exceptionsr   Úazure.core.exceptionsr	   ÚImportErrorÚ	cloudpathr   r   r   Úazblobclientr   r   © r   r   ú<module>rb      sh   ðÛ 	Ý Ý 'ß /Ñ /å >ð	Ý;÷ DÑ CáÝ-ñ �WÓô\d�Ió \dó ñ\døð ò 	Ùð	ús   ¢A ÁAÁA