ó
    ëBj\7  ã                   óˆ  • S SK J r Jr  S SKrS SKrS SKJrJr  S SKJrJ	r	J
r
JrJrJrJrJr  S SKrSSKJrJr  SSKJr  SSKJr  S	S
KJr   \(       a  S SKJr  S SKJr  S SKJr   S SK!J"r"  S SK#Jr$   S SK#J'r'  \" S5       " S S\5      5       r)\)RT                  \)l        g! \% a    S\S   l&         NAf = f! \( a    Sr' NHf = f)é    )ÚdatetimeÚ	timedeltaN)ÚPathÚPurePosixPath)ÚAnyÚCallableÚDictÚIterableÚOptionalÚTYPE_CHECKINGÚTupleÚUnioné   )ÚClientÚregister_client_class)Úimplementation_registry)ÚFileCacheModeé   )ÚGSPath)ÚCredentials)ÚRetry)Údefault)ÚDefaultCredentialsError)r   FÚgs)Útransfer_managerc                   óN  ^ • \ rS rSrSrSSSSSS\R                  SSS4
S\\\	\
R                  4      S\S   S\\	   S\S	   S
\\\	\4      S\\\	\
R                  4      S\\   S\\\	\4      S\\   S\S   4U 4S jjjrS\S\\\	\4      4S jrS\S\\	\
R                  4   S\4S jrS\S\\	   4S jrS\S\4S jrS%S\S\\\\4      4S jjrS&S\S\S\S\4S jjrS&S\S\SS4S jjrS\\	\
R                  4   S\S\4S  jrS\S\	4S! jrS'S\S"\ S\	4S# jjr!S$r"U =r#$ )(ÚGSClienté    zñClient class for Google Cloud Storage which handles authentication with GCP for
[`GSPath`](../gspath/) instances. See documentation for the
[`__init__` method][cloudpathlib.gs.gsclient.GSClient.__init__] for detailed authentication
options.
NÚapplication_credentialsÚcredentialsr   ÚprojectÚstorage_clientÚStorageClientÚfile_cache_modeÚlocal_cache_dirÚcontent_type_methodÚ#download_chunks_concurrently_kwargsÚtimeoutÚretryr   c                 óÜ  >• Ub  X@l         OWUb  [        X#S9U l         OEUb  [        R                  " U5      U l         O& [        5       u  p+U=(       d    Un[        X#S9U l         X€l        0 U l        U	b  X�l        U R                  U R                  S'   U
b  X l	        U R                  U R                  S'   [        TU ]-  UUUS9  g! [         a    [        R
                  " 5       U l          N‡f = f)a(  Class constructor. Sets up a [`Storage
Client`](https://googleapis.dev/python/storage/latest/client.html).
Supports, in this order, the following authentication methods of `Storage Client`.

- Instantiated and already authenticated `Storage Client`.
- OAuth2 Credentials object and a project name.
- File path to a JSON credentials file for a Google service account.
- Google Cloud SDK default credentials. See [How Application Default Credentials works](https://cloud.google.com/docs/authentication/application-default-credentials)

If no authentication methods are used,
then the client will be instantiated as anonymous, which will only have
access to public buckets.

Args:
    application_credentials (Optional[Union[str, os.PathLike]]): Path to Google service
        account credentials file.
    credentials (Optional[Credentials]): The OAuth2 Credentials to use for this client.
        See documentation for [`StorageClient`](
        https://googleapis.dev/python/storage/latest/client.html).
    project (Optional[str]): The project which the client acts on behalf of. See
        documentation for [`StorageClient`](
        https://googleapis.dev/python/storage/latest/client.html).
    storage_client (Optional[StorageClient]): Instantiated [`StorageClient`](
        https://googleapis.dev/python/storage/latest/client.html).
    file_cache_mode (Optional[Union[str, FileCacheMode]]): How often to clear the file cache; see
        [the caching docs](https://cloudpathlib.drivendata.org/stable/caching/) for more information
        about the options in cloudpathlib.eums.FileCacheMode.
    local_cache_dir (Optional[Union[str, os.PathLike]]): Path to directory to use as cache
        for downloaded files. If None, will use a temporary directory. Default can be set with
        the `CLOUDPATHLIB_LOCAL_CACHE_DIR` environment variable.
    content_type_method (Optional[Callable]): Function to call to guess media type (mimetype) when
        writing a file to the cloud. Defaults to `mimetypes.guess_type`. Must return a tuple (content type, content encoding).
    download_chunks_concurrently_kwargs (Optional[Dict[str, Any]]): Keyword arguments to pass to
        [`download_chunks_concurrently`](https://cloud.google.com/python/docs/reference/storage/latest/google.cloud.storage.transfer_manager#google_cloud_storage_transfer_manager_download_chunks_concurrently)
        for sliced parallel downloads; Only available in `google-cloud-storage` version 2.7.0 or later, otherwise ignored and a warning is emitted.
    timeout (Optional[float]): Cloud Storage [timeout value](https://cloud.google.com/python/docs/reference/storage/1.39.0/retry_timeout)
    retry (Optional[google.api_core.retry.Retry]): Cloud Storage [retry configuration](https://cloud.google.com/python/docs/reference/storage/1.39.0/retry_timeout#configuring-retries)
N)r    r!   r(   r)   )r%   r&   r$   )Úclientr#   Úfrom_service_account_jsonÚgoogle_default_authr   Úcreate_anonymous_clientr'   Úblob_kwargsr(   r)   ÚsuperÚ__init__)Úselfr   r    r!   r"   r$   r%   r&   r'   r(   r)   Údefault_projectÚ	__class__s               €ÚU/home/mande/repo/quber/.venv/lib/python3.13/site-packages/cloudpathlib/gs/gsclient.pyr1   ÚGSClient.__init__(   só   ø€ ðj Ñ%Ø(�KàÑ$Ü'°KÑQˆD�Kà$Ñ0Ü'×AÒAÐBYÓZˆD�KðFô 0CÓ/DÑ,�Ø!×4 _�Ü+¸ÑU�”ð 4WÔ0Ø+-ˆÔØÑØ")ŒLØ*.¯,©,ˆD×Ñ˜YÑ'ØÑØ %ŒJØ(,¯
©
ˆD×Ñ˜WÑ%ä‰ÑØ+Ø 3Ø+ð 	ò 	
øô +ó FÜ+×CÒCÓE�–ðFús   ¾%C Ã$C+Ã*C+Ú
cloud_pathÚreturnc                 óþ   • U R                   R                  UR                  5      nUR                  UR                  5      nUc  g UR                  UR
                  UR                  UR                  UR                  S.$ )N)ÚetagÚsizeÚupdatedÚcontent_typeÚmd5_hash)	r+   ÚbucketÚget_blobÚblobr:   r;   r<   r=   r>   ©r2   r7   r?   rA   s       r5   Ú_get_metadataÚGSClient._get_metadata   sg   € Ø—‘×#Ñ# J×$5Ñ$5Ó6ˆØ�‰˜zŸ™Ó/ˆà‰<Øð Ÿ	™	ØŸ	™	ØŸ<™<Ø $× 1Ñ 1Ø ŸM™Mñð ó    Ú
local_pathc                 ó˜  • U R                   R                  UR                  5      nUR                  UR                  5      n[	        U5      n[
        b0  U R                  b#  [
        R                  " XB40 U R                  D6  U$ [
        c#  U R                  b  [        R                  " S5        UR                  " U40 U R                  D6  U$ )NzwIgnoring `download_chunks_concurrently_kwargs` for version of google-cloud-storage that does not support them (<2.7.0).)r+   r?   r@   rA   r   r   r'   Údownload_chunks_concurrentlyÚwarningsÚwarnÚdownload_to_filenamer/   )r2   r7   rF   r?   rA   s        r5   Ú_download_fileÚGSClient._download_fileŽ   s¶   € Ø—‘×#Ñ# J×$5Ñ$5Ó6ˆØ�‰˜zŸ™Ó/ˆä˜*Ó%ˆ
ÜÑ'¨D×,TÑ,TÑ,`Ü×9Ò9ØñØ$(×$LÑ$Lòð Ðô  Ñ'¨D×,TÑ,TÑ,`Ü—’ð Nôð ×%Ò% jÑE°D×4DÑ4DÒEàÐrE   c                 ó`  • UR                   (       d  gU R                  R                  UR                  5      nUR                  UR                   5      nUb  gUR                   nU(       a  UR	                  S5      (       d  US-  nUR                  SUS9n[        [        U5      5      (       a  gg )NÚdirÚfileÚ/r   )Úmax_resultsÚprefix)rA   r+   r?   r@   ÚendswithÚ
list_blobsÚboolÚlist)r2   r7   r?   rA   rS   Úfs         r5   Ú_is_file_or_dirÚGSClient._is_file_or_dir¡   s�   € à��Øà—‘×#Ñ# J×$5Ñ$5Ó6ˆØ�‰˜zŸ™Ó/ˆàÑØà—_‘_ˆFÞ˜fŸo™o¨c×2Ñ2Ø˜#‘�ð ×!Ñ!¨a¸Ð!Ð?ˆAô ”D˜“G�}‰}ØàrE   c                 ó²   • UR                   (       d3  U R                  R                  UR                  5      R                  5       $ U R	                  U5      S;   $ )N)rP   rO   )rA   r+   r?   ÚexistsrY   )r2   r7   s     r5   Ú_existsÚGSClient._exists¹   sC   € à��Ø—;‘;×%Ñ% j×&7Ñ&7Ó8×?Ñ?ÓAÐAà×#Ñ# JÓ/°?ÑBÐBrE   c           	   #   óh  ^ ^#   • TR                   (       d@  U(       a  [        S5      eUU 4S jT R                  R                  5        5        S h  v•N   g T R                  R                  TR                   5      nTR                  nU(       a  UR                  S5      (       d  US-  nU(       aè  [        5       nUR                  US9 HÊ  n[        UR                  [        U5      S  5      R                   H^  nXu;  d  M
  [        U5      S:w  d  M  T R                  TR                   TR                    SU U 35      S4v •  UR                  U5        M`     T R                  TR                   TR                    SUR                   35      S4v •  MÌ     g UR                  SUS9nU H=  n	T R                  TR                   TR                    SU	R                   35      S4v •  M?     UR                    H3  n
T R                  TR                   TR                    SU
 35      S4v •  M5     g  GNß7f)	NztCannot recursively list all buckets and contents; you can get all the buckets then recursively list each separately.c              3   óx   >#   • U  H/  nTR                  TR                   [        U5       35      S 4v •  M1     g7f)TN)Ú	CloudPathÚcloud_prefixÚstr)Ú.0Úbr7   r2   s     €€r5   Ú	<genexpr>Ú%GSClient._list_dir.<locals>.<genexpr>È   s:   øé € ð â3�Að —‘ :×#:Ñ#:Ð";¼CÀ»F¸8Ð DÓEÀtÕLÚ3ùs   ƒ7:rQ   )rS   Ú.TF)Ú	delimiterrS   )r?   ÚNotImplementedErrorr+   Úlist_bucketsrA   rT   ÚsetrU   r   ÚnameÚlenÚparentsrc   ra   rb   ÚaddÚprefixes)r2   r7   Ú	recursiver?   rS   Úyielded_dirsÚoÚparentÚiteratorrP   Ú	directorys   ``         r5   Ú	_list_dirÚGSClient._list_dirÀ   s)  ùé € à× × ÞÜ)ð Kóð õàŸ™×1Ñ1Ô3ó÷ ð ð à—‘×#Ñ# J×$5Ñ$5Ó6ˆà—‘ˆÞ˜&Ÿ/™/¨#×.Ñ.Ø�c‰MˆFÞÜ›5ˆLØ×&Ñ&¨fÐ&Ó5�ä+¨A¯F©F´3°v³;°=Ð,AÓB×JÔJ�FàÕ1´c¸&³kÀSÕ6Hà ŸN™NØ#-×#:Ñ#:Ð";¸J×<MÑ<MÐ;NÈaÐPVÈxÐX^ÐW_Ð `óð !ð	ò ð %×(Ñ(¨Ö0ñ Kð —N‘N j×&=Ñ&=Ð%>¸z×?PÑ?PÐ>QÐQRÐST×SYÑSYÐRZÐ#[Ó\Øðô ò 6ð" ×(Ñ(°3¸vÐ(ÐFˆHó !�à—N‘N j×&=Ñ&=Ð%>¸z×?PÑ?PÐ>QÐQRÐSW×S\ÑS\ÐR]Ð#^Ó_Øðô ñ !ð &×.Ô.�	à—N‘N j×&=Ñ&=Ð%>¸z×?PÑ?PÐ>QÐQRÐS\ÐR]Ð#^Ó_Øðô ò /òQùs    „AH2ÁH/ÁB,H2ÄH2ÄDH2ÚsrcÚdstÚ
remove_srcc                 ó”  • X:X  až  U R                   R                  UR                  5      nUR                  UR                  5      nUR                  c  S[
        R                  " 5       0Ul        O"[
        R                  " 5       UR                  S'   UR                  5         U$ U R                   R                  UR                  5      nU R                   R                  UR                  5      nUR                  UR                  5      nUR                  " X‡UR                  40 U R                  D6  U(       a  UR                  5         U$ )Nr<   )r+   r?   r@   rA   Úmetadatar   ÚutcnowÚpatchÚ	copy_blobr/   Údelete)	r2   rz   r{   r|   r?   rA   Ú
src_bucketÚ
dst_bucketÚsrc_blobs	            r5   Ú
_move_fileÚGSClient._move_fileö   sì   € à‹:Ø—[‘[×'Ñ'¨¯
©
Ó3ˆFØ—?‘? 3§8¡8Ó,ˆDð �}‰}Ñ$Ø!*¬H¯OªOÓ,=Ð >�•ä+3¯?ª?Ó+<�—‘˜iÑ(Ø�J‰JŒLð ˆ
ð Ÿ™×+Ñ+¨C¯J©JÓ7ˆJØŸ™×+Ñ+¨C¯J©JÓ7ˆJà!×*Ñ*¨3¯8©8Ó4ˆHØ× Ò  °s·x±xÑTÀ4×CSÑCSÒTæØ—‘Ô!àˆ
rE   Ú
missing_okc                 ó  • U R                  U5      nUS:X  a…  U R                  USS9 VVs/ s H  u  pEU(       a  M  UR                  PM     nnnU R                  R	                  UR                  5      nU H"  nUR                  U5      R                  5         M$     g US:X  aO  U R                  R	                  UR                  5      nUR                  UR                  5      R                  5         g U(       d  [        SU 35      eg s  snnf )NrO   T)rr   rP   zFile does not exist: )rY   rx   rA   r+   r?   r@   r‚   ÚFileNotFoundError)	r2   r7   rˆ   Úfile_or_dirre   Úis_dirÚblobsr?   rA   s	            r5   Ú_removeÚGSClient._remove  sç   € Ø×*Ñ*¨:Ó6ˆØ˜%Óà(,¯©°zÈT¨Ñ(RôÚ(R™9˜1ÔZ`“�—”Ñ(Rð ñ ð —[‘[×'Ñ'¨
×(9Ñ(9Ó:ˆFÛ�Ø—‘ Ó%×,Ñ,Ö.ò à˜FÓ"Ø—[‘[×'Ñ'¨
×(9Ñ(9Ó:ˆFØ�O‰O˜JŸO™OÓ,×3Ñ3Õ5ö Ü'Ð*?À
¸|Ð(LÓMÐMð ùós
   «D¼Dc                 ó4  • U R                   R                  UR                  5      nUR                  UR                  5      n0 nU R                  b   U R                  [	        U5      5      u  pgXeS'   UR
                  " [	        U5      40 UDU R                  D6  U$ )Nr=   )r+   r?   rA   r&   rc   Úupload_from_filenamer/   )r2   rF   r7   r?   rA   Ú
extra_argsr=   Ú_s           r5   Ú_upload_fileÚGSClient._upload_file   s…   € Ø—‘×#Ñ# J×$5Ñ$5Ó6ˆØ�{‰{˜:Ÿ?™?Ó+ˆàˆ
Ø×#Ñ#Ñ/Ø"×6Ñ6´s¸:³ÓG‰OˆLØ)5�~Ñ&à×!Ò!¤# j£/ÑT°ZÐTÀ4×CSÑCSÒTØÐrE   c                 óš   • U R                   R                  UR                  5      nUR                  UR                  5      nUR                  $ )N)r+   Ú
get_bucketr?   rA   Ú
public_urlrB   s       r5   Ú_get_public_urlÚGSClient._get_public_url,  s8   € Ø—‘×'Ñ'¨
×(9Ñ(9Ó:ˆØ�{‰{˜:Ÿ?™?Ó+ˆØ�‰ÐrE   Úexpire_secondsc                 ó¶   • U R                   R                  UR                  5      nUR                  UR                  5      nUR	                  S[        US9SS9nU$ )NÚv4)ÚsecondsÚGET)ÚversionÚ
expirationÚmethod)r+   r—   r?   rA   Úgenerate_signed_urlr   )r2   r7   r›   r?   rA   Úurls         r5   Ú_generate_presigned_urlÚ GSClient._generate_presigned_url1  sV   € Ø—‘×'Ñ'¨
×(9Ñ(9Ó:ˆØ�{‰{˜:Ÿ?™?Ó+ˆØ×&Ñ&Ø¤Y°~Ñ%FÈuð 'ð 
ˆð ˆ
rE   )r/   r+   r'   r)   r(   )F)T)i  )$Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú	mimetypesÚ
guess_typer   r   rc   ÚosÚPathLiker   r   r	   r   Úfloatr1   r   rC   r   rL   rY   rV   r]   r
   r   rx   r†   rŽ   r”   r™   Úintr¥   Ú__static_attributes__Ú__classcell__)r4   s   @r5   r   r       s;  ø† ñð FJØ/3Ø!%Ø48Ø?CØ=AØ2;×2FÑ2FØHLØ#'Ø#'ñU
à!)¨%°°R·[±[Ð0@Ñ*AÑ!BðU
ð ˜mÑ,ðU
ð ˜#‘ð	U
ð
 ! Ñ1ðU
ð " %¨¨]Ð(:Ñ";Ñ<ðU
ð " %¨¨R¯[©[Ð(8Ñ"9Ñ:ðU
ð & hÑ/ðU
ð .6°d¸3À¸8±nÑ-EðU
ð ˜%‘ðU
ð ˜Ñ ÷U
ð U
ðn¨ð °8¸DÀÀcÀ¹NÑ3Kô ð¨ð ¸UÀ3ÈÏÉÐCSÑ=Tð ÐY]ô ð&¨&ð °X¸c±]ô ð0C &ð C¨Tô Cñ4 Fð 4ÀÈÈvÐW[È|ÑI\Ñ@]õ 4ñl˜fð ¨6ð ¸tð Èvõ ñ2N &ð N°dð NÀdõ Nð"
 u¨S°"·+±+Ð-=Ñ'>ð 
ÈFð 
ÐW]ô 
ð¨&ð °Sô ñ
°&ð È#ð Ð\_÷ ó rE   r   )+r   r   r¬   r®   Úpathlibr   r   Útypingr   r   r	   r
   r   r   r   r   rI   r+   r   r   Ú	cloudpathr   Úenumsr   Úgspathr   Úgoogle.auth.credentialsr   Úgoogle.api_core.retryr   Úgoogle.authr   r-   Úgoogle.auth.exceptionsr   Úgoogle.cloud.storager#   ÚModuleNotFoundErrorÚdependencies_loadedr   ÚImportErrorr   ra   © rE   r5   Ú<module>rÂ      s±   ðß (Û Û 	ß 'ß W× WÓ WÛ ç 2Ý /Ý !Ý ð
>ÞÝ7Ý/å:Ý>Ý<ðÝ5ñ
 �tÓôVˆvó Vó ðVðr ×$Ñ$€…øðI	 ó >Ø8=Ð˜DÑ!Ö5ð>ûð ó ØÒðús$   Á%B  Á2B6 Â B3Â2B3Â6CÃ C