ó
    ,Êžjú
  ã                  ó  • % 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  \(       a  S SKJr  \	" 5        rS SKrSSS5        \" S	5       " S
 S5      5       r\(       a  S SKJr  \" S5      rS\S'   gg! , (       d  f       N?= f)é    )Úannotations)ÚBytesIO)ÚTYPE_CHECKING)Úexperimental_class)Ú
try_import)ÚArtifactNotFound)ÚBinaryIONz3.4.0c                  óP   • \ rS rSrSr S	     S
S jjrSS jrSS jrSS jrSr	g)ÚGCSArtifactStoreé   a  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_store = 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                óä   • [         R                  5         Xl        U=(       d(    [        R                  R
                  R                  5       U l        U R                  R                  U5      U l	        g ©N)
Ú_importsÚcheckÚbucket_nameÚgoogleÚcloudÚstorageÚClientÚclientÚbucketÚ
bucket_obj)Úselfr   r   s      Ú£C:\Users\johnn\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\LocalCache\local-packages\Python313\site-packages\optuna/artifacts/_gcs.pyÚ__init__ÚGCSArtifactStore.__init__;   sI   € ô
 	�‰ÔØ&ÔØ×=¤§¡× 4Ñ 4× ;Ñ ;Ó =ˆŒØŸ+™+×,Ñ,¨[Ó9ˆ�ó    c                ó¬   • U R                   R                  U5      nUc  [        SU R                   SU S35      eUR	                  5       n[        U5      $ )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_readerÚGCSArtifactStore.open_readerE   sc   € Ø�‰×'Ñ'¨Ó4ˆà‰<Ü"Ø0°×1AÑ1AÐ0BÀ/ÐR]ÐQ^ð _ð óð ð
 ×%Ñ%Ó'ˆÜ�t‹}Ðr   c                ó|   • U R                   R                  U5      nUR                  5       nUR                  U5        g r   )r   r"   ÚreadÚupload_from_string)r   r!   Úcontent_bodyr"   Údatas        r   ÚwriteÚGCSArtifactStore.writeQ   s2   € Ø�‰×#Ñ# KÓ0ˆØ× Ñ Ó"ˆØ×Ñ Õ%r   c                ó:   • U R                   R                  U5        g r   )r   Údelete_blob)r   r!   s     r   ÚremoveÚGCSArtifactStore.removeV   s   € Ø�‰×#Ñ# KÕ0r   )r   r   r   r   )r   Ústrr   z"google.cloud.storage.Client | NoneÚreturnÚNone)r!   r1   r2   ú
'BinaryIO')r!   r1   r)   r4   r2   r3   )r!   r1   r2   r3   )
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r$   r+   r/   Ú__static_attributes__© r   r   r   r      s=   † ñ%ðT 6:ð:àð:ð 3ð:ð 
õ	:ô
ô&÷
1r   r   )ÚArtifactStoreÚ r<   Ú_)Ú
__future__r   Úior   Útypingr   Úoptuna._experimentalr   Úoptuna._importsr   Úoptuna.artifacts.exceptionsr   r	   r   Úgoogle.cloud.storager   r   Úoptuna.artifacts._protocolr<   r>   Ú__annotations__r;   r   r   Ú<module>rH      sw   ðÞ "å Ý  å 3Ý &Ý 8ö Ýá„\�XÛ÷ ñ �GÓ÷D1ð D1ó ðD1öN õ 9á'¨Ó+€A€}Ô+ð ÷Y …\ús   ºA8Á8
B