Ë
    ÿÿæiü
  ã                  óô   — U d dl mZ d dlmZ d dlmZ d dlmZ d dlm	Z	 d dl
mZ erd dlmZ  e	«       5 Zd dlZddd«        ed	«       G d
„ d«      «       Zerd dlmZ  ed«      Zded<   yy# 1 sw Y   Œ5xY w)é    )Úannotations)ÚBytesIO)ÚTYPE_CHECKING)Úexperimental_class)Ú
try_import)ÚArtifactNotFound)ÚBinaryIONz3.4.0c                  ó>   — e Zd ZdZ	 d	 	 	 	 	 dd„Zd	d„Zd
d„Zdd„Zy)ÚGCSArtifactStorea|  An artifact backend for Google Cloud Storage (GCS).

    Args:
        bucket_name:
            The name of the bucket to store artifacts.

        client:
            A google-cloud-storage ``Client`` to use for storage operations. If not specified, a
            new client will be created with default settings.

    Example:
        .. code-block:: python

            import optuna
            from optuna.artifacts import GCSArtifactStore, upload_artifact


            artifact_backend = GCSArtifactStore("my-bucket")


            def objective(trial: optuna.Trial) -> float:
                ... = trial.suggest_float("x", -10, 10)
                file_path = generate_example(...)
                upload_artifact(
                    artifact_store=artifact_store,
                    file_path=file_path,
                    study_or_trial=trial,
                )
                return ...

        Before running this code, you will have to install ``gcloud`` and run

        .. code-block:: bash

            gcloud auth application-default login

        so that the Cloud Storage library can automatically find the credential.
    Nc                óÜ   — t         j                  «        || _        |xs( t        j                  j
                  j                  «       | _        | j                  j                  |«      | _	        y ©N)
Ú_importsÚcheckÚbucket_nameÚgoogleÚcloudÚstorageÚClientÚclientÚbucketÚ
bucket_obj)Úselfr   r   s      új/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/optuna/artifacts/_gcs.pyÚ__init__zGCSArtifactStore.__init__;   sK   € ô
 	�‰ÔØ&ˆÔØÒ=¤§¡× 4Ñ 4× ;Ñ ;Ó =ˆŒØŸ+™+×,Ñ,¨[Ó9ˆ�ó    c                óª   — | j                   j                  |«      }|€t        d| j                  › d|› d�«      ‚|j	                  «       }t        |«      S )NzArtifact storage with bucket: z, artifact_id: z was not found)r   Úget_blobr   r   Údownload_as_bytesr   )r   Úartifact_idÚblobÚbodys       r   Úopen_readerzGCSArtifactStore.open_readerE   sc   € Ø�‰×'Ñ'¨Ó4ˆàˆ<Ü"Ø0°×1AÑ1AÐ0BÀ/ÐR]ÐQ^ð _ð óð ð
 ×%Ñ%Ó'ˆÜ�t‹}Ðr   c                ó|   — | j                   j                  |«      }|j                  «       }|j                  |«       y r   )r   r    ÚreadÚupload_from_string)r   r   Úcontent_bodyr    Údatas        r   ÚwritezGCSArtifactStore.writeQ   s2   € Ø�‰×#Ñ# KÓ0ˆØ× Ñ Ó"ˆØ×Ñ Õ%r   c                ó:   — | j                   j                  |«       y r   )r   Údelete_blob)r   r   s     r   ÚremovezGCSArtifactStore.removeV   s   € Ø�‰×#Ñ# KÕ0r   r   )r   Ústrr   z"google.cloud.storage.Client | NoneÚreturnÚNone)r   r,   r-   ú
'BinaryIO')r   r,   r&   r/   r-   r.   )r   r,   r-   r.   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r"   r(   r+   © r   r   r   r      s=   „ ñ%ðT 6:ð:àð:ð 3ð:ð 
ó	:ó
ó&ô
1r   r   )ÚArtifactStoreÚ r5   Ú_)Ú
__future__r   Úior   Útypingr   Úoptuna._experimentalr   Úoptuna._importsr   Úoptuna.artifacts.exceptionsr   r	   r   Úgoogle.cloud.storager   r   Úoptuna.artifacts._protocolr5   r7   Ú__annotations__r4   r   r   Ú<module>rA      sw   ðÞ "å Ý  å 3Ý &Ý 8ñ Ýá„\�XÛ÷ ñ �GÓ÷D1ð D1ó ðD1ñN õ 9á'¨Ó+€A€}Ô+ð ÷Y €\ús   µA.Á.A7