Ë
    äš¾j°  ã                   óˆ   — 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 erddlmZ  ed	«       G d
„ de
«      «       Zy)é    N)ÚPath)ÚTemporaryDirectory)ÚAnyÚTYPE_CHECKINGÚOptionalé   )Ú	CloudPathÚNoStatErrorÚregister_path_classé   )ÚGSClientÚgsc                   óÌ   — 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edefd„«       Zedefd„«       Zed„ «       Zede	e   fd„«       Zy)ÚGSPathaG  Class for representing and operating on Google Cloud 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 GS 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 [`GSClient`](../gsclient/) class handles authentication with GCP. If a client instance is
    not explicitly specified on `GSPath` instantiation, a default client is used. See `GSClient`'s
    documentation for more details.
    zgs://Úcloud_prefixr   ÚclientÚreturnc                 ó   — | j                   S ©N)Úbucket©Úselfs    ú`/home/spazio/kingdom_calls/work5/transenv/lib/python3.12/site-packages/cloudpathlib/gs/gspath.pyÚdrivezGSPath.drive   s   € à�{‰{Ðó    NÚmodec                  ó   — y r   © )r   ÚparentsÚexist_okr   s       r   ÚmkdirzGSPath.mkdir"   s   € àr   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GSPath.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        d| › d�«      ‚	 |d   j                  «       }t        j                  d d | j                  d d d |j                  dd«      d |d f
«      S # t        $ r d}Y ŒFw xY w)NzNo stats available for z%; it may be a directory or not exist.Úupdatedr   Úsize)	r   Ú_get_metadatar
   Ú	timestampÚKeyErrorÚosÚstat_resultr   Úget)r   Úfollow_symlinksÚmetaÚmtimes       r   ÚstatzGSPath.stat4   s©   € Ø�{‰{×(Ñ(¨Ó.ˆØˆ<ÜØ)¨$¨Ð/TÐUóð ð	Ø˜‘O×-Ñ-Ó/ˆEô �~‰~àØØ×!Ñ!ØØØØ—‘˜ Ó#ØØØðó
ð 	
øô ò 	ØŠEð	ús   ®A: Á:BÂBc                 ó@   — | j                   j                  dd«      d   S )Nú/r   r   )Ú
_no_prefixÚsplitr   s    r   r   zGSPath.bucketO   s   € à�‰×$Ñ$ S¨!Ó,¨QÑ/Ð/r   c                 óJ   — | j                   }|j                  d«      r|dd  }|S )Nr;   r   )Ú_no_prefix_no_driveÚ
startswith)r   Úkeys     r   ÚblobzGSPath.blobS   s+   € à×&Ñ&ˆð �>‰>˜#ÔØ�a�b�'ˆCàˆ
r   c                 óV   — | j                   j                  | «      j                  d«      S )NÚetag©r   r0   r5   r   s    r   rD   zGSPath.etag^   s"   € à�{‰{×(Ñ(¨Ó.×2Ñ2°6Ó:Ð:r   c                 ób   — | j                   j                  | «      }|sy |j                  dd «      S )NÚmd5_hashrE   )r   r7   s     r   Úmd5z
GSPath.md5b   s-   € à�{‰{×(Ñ(¨Ó.ˆÙØØ�x‰x˜
 DÓ)Ð)r   )FFN)TN)T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚstrÚ__annotations__Úpropertyr   r   r   r!   Úboolr(   r9   r   rB   rD   rH   r   r   r   r   r      sÇ   … ñð  €L�#ÓØÓàð�sò ó ðñ¸À#¹ó ñ˜dð °¸#±ó ó
ð6 ð0˜ò 0ó ð0ð ð�cò ó ðð ñ;ó ð;ð ð*�X˜c‘]ò *ó ñ*r   r   )r3   Úpathlibr   Útempfiler   Útypingr   r   r   Ú	cloudpathr	   r
   r   Úgsclientr   r   r   r   r   ú<module>rV      sC   ðÛ 	Ý Ý 'ß /Ñ /ç CÑ CáÝ"ñ �TÓôZ*ˆYó Z*ó ñZ*r   