ó
    ëBjO  ã                   óÆ   • S SK r S SKrS SKrS SKJr  S SKJr  S SKJrJ	r	J
r
  SSKJrJrJr  \
(       a  SSKJr  \R"                  " S	5      r\" S
5       " S S\5      5       rg)é    N)ÚPath)ÚTemporaryDirectory)ÚAnyÚOptionalÚTYPE_CHECKINGé   )Ú	CloudPathÚNoStatErrorÚregister_path_classé   )ÚS3ClientzK^s3://(?P<arn>arn:aws:s3::\d{12}:accesspoint/[^/]+\.mrap)(?:/(?P<key>.*))?$Ús3c                   óô   • \ rS rSr% SrSr\\S'   S\S'   \\S'   \\S'   \	S	\4S
 j5       r
SS\\   4S jjrSS\S\\   4S jjrSS jr\	S	\4S j5       r\	S	\4S j5       r\	S 5       r\	S	\4S j5       rSrg)ÚS3Pathé   a  Class for representing and operating on AWS S3 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 S3 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 [`S3Client`](../s3client/) class handles authentication with AWS. If a client instance is
not explicitly specified on `S3Path` instantiation, a default client is used. See `S3Client`'s
documentation for more details.
zs3://Úcloud_prefixr   ÚclientÚ_bucketÚ_local_pathÚreturnc                 ó   • U R                   $ ©N)Úbucket©Úselfs    ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/cloudpathlib/s3/s3path.pyÚdriveÚS3Path.drive&   s   € à�{‰{Ðó    NÚmodec                 ó   • g r   © )r   ÚparentsÚexist_okr    s       r   ÚmkdirÚS3Path.mkdir*   s   € àr   r$   c                 óJ  • U R                  5       (       a1  U(       d  [        SU  35      eU R                  R                  X 5        g [	        5       n[        UR                  5      S-  nUR                  5         U R                  R                  X@5        UR                  5         g )NzFile exists: Úempty)
ÚexistsÚFileExistsErrorr   Ú
_move_filer   r   ÚnameÚtouchÚ_upload_fileÚcleanup)r   r$   r    ÚtfÚps        r   r-   ÚS3Path.touch.   sr   € Ø�;‰;�=‰=ÞÜ%¨°d°VÐ&<Ó=Ð=Ø�K‰K×"Ñ" 4Õ.ä#Ó%ˆBÜ�R—W‘W“ Ñ'ˆAØ�G‰GŒIà�K‰K×$Ñ$ QÔ-à�J‰J�Lr   c                 ól  •  U R                   R                  U 5      n[
        R                  " S S U R                  S S S UR                  SS5      S UR                  SS5      R                  5       S 4
5      $ ! U R                   R                   R                  R                   a    [	        SU  S35      ef = f)NzNo stats available for z%; it may be a directory or not exist.Úsizer   Úlast_modified)
r   Ú_get_metadataÚ
exceptionsÚ	NoSuchKeyr
   ÚosÚstat_resultr   ÚgetÚ	timestamp)r   Úfollow_symlinksÚmetas      r   ÚstatÚS3Path.stat<   s·   € ð	Ø—;‘;×,Ñ,¨TÓ2ˆDô �~Š~àØØ×!Ñ!ØØØØ—‘˜ Ó#ØØ—‘˜¨!Ó,×6Ñ6Ó8Øðó
ð 	
øð �{‰{×!Ñ!×,Ñ,×6Ñ6ó 	ÜØ)¨$¨Ð/TÐUóð ð	ús   ‚A5 Á5>B3c                 ó*  • [        U S5      (       a  U R                  $ [        R                  [	        U 5      5      =n(       a"  UR                  S5      U l        U R                  $ U R                  R                  SS5      S   U l        U R                  $ )zKThe bucket name, or the full MRAP ARN for MRAP paths.

:type: :class:`str`
r   ÚarnÚ/r   r   )Úhasattrr   Ú_MRAP_PATTERNÚmatchÚstrÚgroupÚ
_no_prefixÚsplit)r   rF   s     r   r   ÚS3Path.bucketS   sz   € ô �4˜×#Ñ#Ø—<‘<ÐÜ!×'Ñ'¬¨D«	Ó2Ð2ˆ5Õ2Ø Ÿ;™; uÓ-ˆDŒLð �|‰|Ðð  Ÿ?™?×0Ñ0°°aÓ8¸Ñ;ˆDŒLØ�|‰|Ðr   c                 óT   • U R                   nUR                  S5      (       a  USS  nU$ )NrC   r   )Ú_no_prefix_no_driveÚ
startswith)r   Úkeys     r   rO   Ú
S3Path.keya   s.   € à×&Ñ&ˆð �>‰>˜#×ÑØ�a�b�'ˆCàˆ
r   c                 óV   • U R                   R                  U 5      R                  S5      $ )NÚetag)r   r6   r;   r   s    r   rR   ÚS3Path.etagl   s"   € à�{‰{×(Ñ(¨Ó.×2Ñ2°6Ó:Ð:r   c                 óô   • [        U S5      (       a  U R                  $ U R                  n[        R                  S:X  a  UR                  SS5      nU R                  R                  U-  U l        U R                  $ )Nr   Úwin32Ú:z%3A)rD   r   rI   ÚsysÚplatformÚreplacer   Ú_local_cache_dir)r   Ú	no_prefixs     r   Ú_localÚS3Path._localp   se   € ä�4˜×'Ñ'Ø×#Ñ#Ð#Ø—O‘Oˆ	ä�<‰<˜7Ó"Ø!×)Ñ)¨#¨uÓ5ˆIØŸ;™;×7Ñ7¸)ÑCˆÔØ×ÑÐr   )r   r   )FFN)TN)T)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   rG   Ú__annotations__r   Úpropertyr   r   r   r%   Úboolr-   r?   r   rO   rR   r\   Ú__static_attributes__r"   r   r   r   r      sÎ   ‡ ñð  €L�#ÓØÓØƒLØÓàð�só ó ðñ¸À#¹õ ñ˜dð °¸#±õ ô
ð. ð˜ó ó ðð ð�Só ó ðð ñ;ó ð;ð ð ˜ó  ó ó r   r   )r9   ÚrerW   Úpathlibr   Útempfiler   Útypingr   r   r   Ú	cloudpathr	   r
   r   Ús3clientr   ÚcompilerE   r   r"   r   r   Ú<module>rn      sZ   ðÛ 	Û 	Û 
Ý Ý 'ß /Ñ /ç CÑ CæÝ"à—
’
ØRó€ñ
 �TÓôf ˆYó f ó ñf r   