
    hw                         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
   S SKJr  SSKJrJrJr  \(       a  S	S
KJr  \" S5       " S S\5      5       rg! \ a     N6f = f)    N)Path)TemporaryDirectory)AnyOptionalTYPE_CHECKING)CloudPathIsADirectoryError)ResourceNotFoundError   )	CloudPathNoStatErrorregister_path_class   )AzureBlobClientazurec                      ^  \ rS rSr% SrSr\\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U 4S j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U =r$ )AzureBlobPath   aB  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                     U R                   $ N)	containerselfs    W/home/james-whalen/.local/lib/python3.13/site-packages/cloudpathlib/azure/azblobpath.pydriveAzureBlobPath.drive&   s    ~~    modec                 8    U R                   R                  XUS9  g )N)parentsexist_ok)r   _mkdir)r   r"   r#   r    s       r   mkdirAzureBlobPath.mkdir*   s    48Dr   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-   AzureBlobPath.touch-   sr    ;;==%dV&<==KK""4.#%BRWW'AGGIKK$$Q-JJLr   c                 $    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      $ ! [         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_metadatar	   r   osstat_resultr   get	timestamp)r   follow_symlinksmetas      r   statAzureBlobPath.stat;   s    	;;,,T2D ~~!!#!,668
 	
 % 	)$/TU 	s   A5 5Bc                    >  [         TU ]  U5      $ ! [         a?    U R                  R	                  U 5      (       a  U R                  R                  X5      s $ e f = fr   )superreplacer   r   
_check_hnsr+   )r   target	__class__s     r   rA   AzureBlobPath.replaceR   sU    	7?6** * 	{{%%d++{{--d;;		s    AAAc                 @    U R                   R                  SS5      S   $ )N/r   r   )
_no_prefixsplitr   s    r   r   AzureBlobPath.container]   s    $$S!,Q//r   c                 T    U R                   nUR                  S5      (       a  USS  nU$ )NrG   r   )_no_prefix_no_drive
startswith)r   keys     r   blobAzureBlobPath.bloba   s.    && >>#ab'C
r   c                 X    U R                   R                  U 5      R                  SS 5      $ )Netagr   r6   r9   r   s    r   rR   AzureBlobPath.etagk   s$    {{((.2264@@r   c                 x    U R                   R                  U 5      R                  S0 5      R                  SS 5      $ )Ncontent_settingscontent_md5rS   r   s    r   md5AzureBlobPath.md5o   s3    {{((.223ErJNN}^bccr    )FFN)TN)T)rC   r   r   r   )__name__
__module____qualname____firstlineno____doc__r   str__annotations__propertyr   r   r   r%   boolr-   r=   rA   r   rO   rR   rX   __static_attributes____classcell__)rD   s   @r   r   r      s      L#s  E# Ed # 
.	 03 0 0 c   A A dS d dr   r   )r7   pathlibr   tempfiler   typingr   r   r   cloudpathlib.exceptionsr   azure.core.exceptionsr	   ImportError	cloudpathr   r   r   azblobclientr   r   rZ   r   r   <module>rn      sj    	  ' / / >	; D C - W\dI \d \d  		s   A AA