Ë
    /æjŽ:  ã                   ó�  — 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m	Z	m
Z
  G d„ dee«      Zej                  ej                  ej                  ej                   fZej$                  ej&                  ej(                  ej*                  ej,                  ej.                  ej0                  ej2                  fZ G d„ d	ee«      Z G d
„ dee«      Ze G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Ze G d„ d«      «       Z e G d„ d«      «       Z!e G d„ d«      «       Z"e G d„ d«      «       Z#e G d„ d«      «       Z$y)é    )Ú	dataclass)Údatetime)ÚEnum)ÚLiteral)ÚHfMountÚHfUriÚparse_datetimec                   ó@   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZy)Ú
SpaceStagea  
    Enumeration of possible stage of a Space on the Hub.

    Value can be compared to a string:
    ```py
    assert SpaceStage.BUILDING == "BUILDING"
    ```

    Taken from https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L61 (private url).
    ÚNO_APP_FILEÚCONFIG_ERRORÚBUILDINGÚBUILD_ERRORÚRUNNINGÚRUNNING_BUILDINGÚRUNTIME_ERRORÚDELETINGÚSTOPPEDÚPAUSEDÚAPP_STARTINGÚRUNNING_APP_STARTINGN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r   r   r   r   r   r   © ó    ú]/root/repos/pocs/video-evals/.venv/lib/python3.12/site-packages/huggingface_hub/_space_api.pyr   r      sG   „ ñ	ð  €KØ!€LØ€HØ€KØ€GØ)ÐØ#€MØ€HØ€GØ€FØ!€LØ1Ñr   r   c                   ód   — e Zd ZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZdZdZdZdZdZdZdZdZdZdZdZy)ÚSpaceHardwarea=  
    Enumeration of hardwares available to run your Space on the Hub.

    Value can be compared to a string:
    ```py
    assert SpaceHardware.CPU_BASIC == "cpu-basic"
    ```

    Taken from https://github.com/huggingface-internal/moon-landing/blob/main/server/repo_types/SpaceHardwareFlavor.ts (private url).
    z	cpu-basiczcpu-upgradez	zero-a10gzt4-smallz	t4-mediumÚl4x1Úl4x4Úl40sx1Úl40sx4Úl40sx8z
a10g-smallz
a10g-largeza10g-largex2za10g-largex4z
a100-largeÚa100x4Úa100x8zrtx-pro-6000zrtx-pro-6000x2zrtx-pro-6000x4zrtx-pro-6000x8N)r   r   r   r   Ú	CPU_BASICÚCPU_UPGRADEÚ	ZERO_A10GÚT4_SMALLÚ	T4_MEDIUMÚL4X1ÚL4X4ÚL40SX1ÚL40SX4ÚL40SX8Ú
A10G_SMALLÚ
A10G_LARGEÚA10G_LARGEX2ÚA10G_LARGEX4Ú
A100_LARGEÚA100X4ÚA100X8ÚRTX_PRO_6000ÚRTX_PRO_6000X2ÚRTX_PRO_6000X4ÚRTX_PRO_6000X8r   r   r   r    r    D   sx   „ ñ	ð €IØ€Kð €Ið €HØ€IØ€DØ€DØ€FØ€FØ€FØ€JØ€JØ!€LØ!€LØ€JØ€FØ€Fð "€LØ%€NØ%€NØ%�Nr   r    c                   ó   — e Zd ZdZdZdZdZy)ÚSpaceStoragea5  
    Enumeration of persistent storage available for your Space on the Hub.

    Value can be compared to a string:
    ```py
    assert SpaceStorage.SMALL == "small"
    ```

    Taken from https://github.com/huggingface/moon-landing/blob/main/server/repo_types/SpaceHardwareFlavor.ts#L24 (private url).
    ÚsmallÚmediumÚlargeN)r   r   r   r   ÚSMALLÚMEDIUMÚLARGEr   r   r   r>   r>   n   s   „ ñ	ð €EØ€FØ�Er   r>   c                   ó’   — e Zd ZU dZed   ed<   eed<   eed<   dZedz  ed<   dZe	dz  ed<   dZ
edz  ed	<   dd„Zd
efd„Zd
efd„Zy)ÚVolumeaâ  
    Describes a volume to mount in a Space or Job container.

    Args:
        type (`str`):
            Type of volume: `"bucket"`, `"model"`, `"dataset"`, or `"space"`.
        source (`str`):
            Source identifier, e.g. `"username/my-bucket"` or `"username/my-model"`.
        mount_path (`str`):
            Mount path inside the container, e.g. `"/data"`. Must start with `/`.
        revision (`str` or `None`):
            Git revision (only for repos, defaults to `"main"`).
        read_only (`bool` or `None`):
            Read-only mount. Forced `True` for repos, defaults to `False` for buckets.
        path (`str` or `None`):
            Subfolder prefix inside the bucket/repo to mount, e.g. `"path/to/dir"`.
    )ÚbucketÚmodelÚdatasetÚspaceÚtypeÚsourceÚ
mount_pathNÚrevisionÚ	read_onlyÚpathÚreturnc                 ó2  — |j                  dd«      | _        |d   | _        |j                  d«      }|�|n|d   | _        |j                  d«      | _        |j                  d«      }|�|n|j                  d«      | _        |j                  d	«      | _        y )
NrK   rH   rL   Ú	mountPathrM   rN   ÚreadOnlyrO   rP   )ÚgetrK   rL   rM   rN   rO   rP   )ÚselfÚkwargsrM   rO   s       r   Ú__init__zVolume.__init__š   s†   € Ø—J‘J˜v wÓ/ˆŒ	Ø˜XÑ&ˆŒØ—Z‘Z Ó,ˆ
Ø(2Ð(>™*ÀFÈ<ÑDXˆŒØŸ
™
 :Ó.ˆŒØ—J‘J˜zÓ*ˆ	Ø&/Ð&;™ÀÇÁÈKÓAXˆŒØ—J‘J˜vÓ&ˆ�	r   c                 óð   — | j                   | j                  | j                  dœ}| j                  �| j                  |d<   | j                  �| j                  |d<   | j
                  �| j
                  |d<   |S )z6Serialize to the JSON payload expected by the Hub API.)rK   rL   rS   rN   rT   rP   )rK   rL   rM   rN   rO   rP   ©rV   Údatas     r   Úto_dictzVolume.to_dict¤   sn   € ð —I‘IØ—k‘kØŸ™ñ
ˆð
 �=‰=Ð$Ø#Ÿ}™}ˆD�ÑØ�>‰>Ð%Ø#Ÿ~™~ˆD�ÑØ�9‰9Ð ØŸ9™9ˆD�‰LØˆr   c           	      óÔ   — t        t        | j                  | j                  | j                  | j
                  xs d¬«      | j                  | j                  ¬«      j                  «       S )zGReturn the volume as an HF mount URI in the format expected by the CLI.Ú )rK   ÚidrN   Úpath_in_repo)rL   rM   rO   )	r   r   rK   rL   rN   rP   rM   rO   Úto_uri)rV   s    r   ra   zVolume.to_uri³   sM   € äÜ˜dŸi™i¨D¯K©KÀ$Ç-Á-Ð^b×^gÑ^gÒ^mÐkmÔnØ—‘Ø—n‘nô
÷ ‰&‹(ð		r   )rQ   N)r   r   r   r   r   Ú__annotations__ÚstrrN   rO   ÚboolrP   rX   Údictr\   ra   r   r   r   rF   rF      sf   … ñð$ Ð7Ñ
8Ó8ØƒKØƒOØ€Hˆc�D‰jÓØ!€Iˆt�d‰{Ó!Ø€Dˆ#�‰*Óó'ð˜ó ð˜ô r   rF   c                   óX   — e Zd ZU ed   ed<   eeeedz  f      ed<   eed<   deddfd„Z	y)	ÚSpaceHotReloading)ÚcreatedÚcanceledÚstatusNÚreplica_statusesÚrawr[   rQ   c                 ó:   — |d   | _         |d   | _        || _        y )Nrj   ÚreplicaStatuses)rj   rk   rl   rZ   s     r   rX   zSpaceHotReloading.__init__Â   s"   € Ø˜8‘nˆŒØ $Ð%6Ñ 7ˆÔØˆ�r   )
r   r   r   r   rb   ÚlistÚtuplerc   re   rX   r   r   r   rg   rg   ¼   s>   … àÐ)Ñ*Ó*Ø˜5  c¨D¡j Ñ1Ñ2Ó2Ø	ƒIð˜Tð  dô r   rg   c                   ó¦   — e Zd ZU dZeed<   edz  ed<   edz  ed<   edz  ed<   edz  ed<   e	ed<   e
dz  ed	<   ee   dz  ed
<   eed<   deddfd„Zy)ÚSpaceRuntimeaƒ  
    Contains information about the current runtime of a Space.

    Args:
        stage (`str`):
            Current stage of the space. Example: RUNNING.
        hardware (`str` or `None`):
            Current hardware of the space. Example: "cpu-basic". Can be `None` if Space
            is `BUILDING` for the first time.
        requested_hardware (`str` or `None`):
            Requested hardware. Can be different from `hardware` especially if the request
            has just been made. Example: "t4-medium". Can be `None` if no hardware has
            been requested yet.
        sleep_time (`int` or `None`):
            Number of seconds the Space will be kept alive after the last request. By default (if value is `None`), the
            Space will never go to sleep if it's running on an upgraded hardware, while it will go to sleep after 48
            hours on a free 'cpu-basic' hardware. For more details, see https://huggingface.co/docs/hub/spaces-gpus#sleep-time.
        volumes (`list[Volume]` or `None`):
            List of volumes mounted in the Space. Each volume is a [`Volume`] object describing its type, source,
            mount path, and optional settings. `None` if no volumes are attached.
        raw (`dict`):
            Raw response from the server. Contains more information about the Space
            runtime like number of replicas, number of cpu, memory size,...
    ÚstageNÚhardwareÚrequested_hardwareÚ
sleep_timeÚstorageÚdev_modeÚhot_reloadingÚvolumesrl   r[   rQ   c                 óè  — |d   | _         |j                  d«      xs i }|j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  dd«      | _        |j                  d	«      x}�t        |«      nd | _        |j                  d
«      }|�|D �cg c]  }t        di |¤Ž‘Œ c}nd | _
        || _        y c c}w )Nrs   rt   ÚcurrentÚ	requestedÚ	gcTimeoutrw   ÚdevModeFÚhotReloadingrz   r   )rs   rU   rt   ru   rv   rw   rx   rg   ry   rF   rz   rl   )rV   r[   Úhardware_dictÚraw_hrÚraw_volumesÚvs         r   rX   zSpaceRuntime.__init__í   sÕ   € Ø˜'‘]ˆŒ
ØŸ™ Ó,Ò2°ˆØ%×)Ñ)¨)Ó4ˆŒØ"/×"3Ñ"3°KÓ"@ˆÔØŸ(™( ;Ó/ˆŒØ—x‘x 	Ó*ˆŒØŸ™ ¨EÓ2ˆŒØEIÇXÁXÈnÓE]Ð;]¸6Ð:jÔ.¨vÔ6ÐptˆÔØ—h‘h˜yÓ)ˆØ=HÐ=T¨[Ö9¨œ™ ›Ó9ÐZ^ˆŒØˆ�ùò :s   ÃC/)r   r   r   r   r   rb   r    Úintr>   rd   rg   ro   rF   re   rX   r   r   r   rr   rr   È   sq   … ñð2 ÓØ˜dÑ"Ó"Ø%¨Ñ,Ó,Ø�d‘
ÓØ˜DÑ Ó ØƒNØ$ tÑ+Ó+Ø�&‰\˜DÑ Ó Ø	ƒIð˜Tð  dô r   rr   c                   óP   — e Zd ZU dZeed<   edz  ed<   edz  ed<   dededdfd„Zy)	ÚSpaceSecreta&  
    Contains information about a secret of a Space.

    Secret values are write-only and cannot be read back. Only the key, description,
    and last update time are returned by the API.

    Args:
        key (`str`):
            Secret key. Example: `"GITHUB_API_KEY"`
        description (`str` or None):
            Description of the secret. Example: `"Github API key to access the Github API"`.
        updated_at (`datetime` or None):
            datetime of the last update of the secret (if the secret has been updated at least once).
    ÚkeyNÚdescriptionÚ
updated_atÚvaluesrQ   c                 ó”   — || _         |j                  d«      | _        |j                  d«      }|�t        |«      | _        y d | _        y )Nr‰   Ú	updatedAt)rˆ   rU   r‰   r	   rŠ   ©rV   rˆ   r‹   rŠ   s       r   rX   zSpaceSecret.__init__  s@   € ØˆŒØ!Ÿ:™: mÓ4ˆÔØ—Z‘Z Ó,ˆ
Ø8BÐ8Nœ.¨Ó4ˆ�ÐTXˆ�r   ©	r   r   r   r   rc   rb   r   re   rX   r   r   r   r‡   r‡   û   s@   … ñð 
ƒHØ�t‘ÓØ˜4‘ÓðY˜Cð Y¨ð Y°$ô Yr   r‡   c                   óZ   — e Zd ZU dZeed<   eed<   edz  ed<   edz  ed<   dededdfd	„Zy)
ÚSpaceVariablea  
    Contains information about the current variables of a Space.

    Args:
        key (`str`):
            Variable key. Example: `"MODEL_REPO_ID"`
        value (`str`):
            Variable value. Example: `"the_model_repo_id"`.
        description (`str` or None):
            Description of the variable. Example: `"Model Repo ID of the implemented model"`.
        updatedAt (`datetime` or None):
            datetime of the last update of the variable (if the variable has been updated at least once).
    rˆ   ÚvalueNr‰   rŠ   r‹   rQ   c                 ó¨   — || _         |d   | _        |j                  d«      | _        |j                  d«      }|�t	        |«      | _        y d | _        y )Nr’   r‰   r�   )rˆ   r’   rU   r‰   r	   rŠ   rŽ   s       r   rX   zSpaceVariable.__init__,  sK   € ØˆŒØ˜G‘_ˆŒ
Ø!Ÿ:™: mÓ4ˆÔØ—Z‘Z Ó,ˆ
Ø8BÐ8Nœ.¨Ó4ˆ�ÐTXˆ�r   r�   r   r   r   r‘   r‘     sE   … ñð 
ƒHØƒJØ�t‘ÓØ˜4‘ÓðY˜Cð Y¨ð Y°$ô Yr   r‘   c                   óÚ   — e Zd ZU dZeed<   eed<   eed<   edz  ed<   edz  ed<   eed<   eed	<   ee   dz  ed
<   e	dz  ed<   edz  ed<   edz  ed<   e
dz  ed<   edz  ed<   deddfd„Zy)ÚSpaceSearchResulta“  A single result from the Spaces semantic search API.

    Returned by [`HfApi.search_spaces`].

    Attributes:
        id (`str`):
            ID of the Space (e.g. `"username/repo-name"`).
        author (`str`):
            Author of the Space.
        title (`str`):
            Display title of the Space.
        emoji (`str` or `None`):
            Emoji icon of the Space.
        sdk (`str` or `None`):
            SDK used by the Space (e.g. `"gradio"`, `"docker"`, `"static"`).
        likes (`int`):
            Number of likes.
        private (`bool`):
            Whether the Space is private.
        tags (`list[str]` or `None`):
            List of tags.
        runtime ([`SpaceRuntime`] or `None`):
            Runtime information (stage, hardware, etc.).
        ai_short_description (`str` or `None`):
            AI-generated short description.
        ai_category (`str` or `None`):
            AI-generated category (e.g. `"Image Generation"`).
        semantic_relevancy_score (`float` or `None`):
            Semantic relevancy score (0-1) relative to the search query.
        trending_score (`int` or `None`):
            Trending score.
    r_   ÚauthorÚtitleNÚemojiÚsdkÚlikesÚprivateÚtagsÚruntimeÚai_short_descriptionÚai_categoryÚsemantic_relevancy_scoreÚtrending_scorer[   rQ   c                 óN  — |j                  d«      }|d   | _        |j                  dd«      | _        |j                  dd«      | _        |j                  d«      | _        |j                  d«      | _        |j                  dd	«      | _        |j                  d
d«      | _        |j                  d«      | _        |rt        |«      nd | _
        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        |j                  d«      | _        y )Nr�   r_   r–   r^   r—   r˜   r™   rš   r   r›   Frœ   rž   rŸ   ÚsemanticRelevancyScoreÚtrendingScore)rU   r_   r–   r—   r˜   r™   rš   r›   rœ   rr   r�   rž   rŸ   r    r¡   )rV   r[   r�   s      r   rX   zSpaceSearchResult.__init__e  sè   € Ø—(‘(˜9Ó%ˆØ�t‘*ˆŒØ—h‘h˜x¨Ó,ˆŒØ—X‘X˜g rÓ*ˆŒ
Ø—X‘X˜gÓ&ˆŒ
Ø—8‘8˜E“?ˆŒØ—X‘X˜g qÓ)ˆŒ
Ø—x‘x 	¨5Ó1ˆŒØ—H‘H˜VÓ$ˆŒ	Ù07”| GÔ,¸TˆŒØ$(§H¡HÐ-CÓ$DˆÔ!ØŸ8™8 MÓ2ˆÔØ(,¯©Ð1IÓ(JˆÔ%Ø"Ÿh™h Ó7ˆÕr   )r   r   r   r   rc   rb   r…   rd   ro   rr   Úfloatre   rX   r   r   r   r•   r•   4  s‹   … ñðB 	ƒGØƒKØƒJØ�‰:ÓØ	ˆt‰ƒOØƒJØƒMØ
ˆs‰)�dÑ
ÓØ˜DÑ Ó Ø ™*Ó$Ø�t‘ÓØ# d™lÓ*Ø˜$‘JÓð8˜Tð 8 dô 8r   r•   c                   óJ   — e Zd ZU dZeed<   eed<   eed<   eed<   deddfd	„Zy)
ÚSpaceTemplatea³  
    Contains information about a Space template available on the Hub.

    Returned by [`HfApi.list_space_templates`]. The `repo_id` can be passed as `space_template`
    to [`HfApi.create_repo`] to seed a new Space from that template.

    Args:
        name (`str`):
            Human-friendly name of the template (e.g. `"JupyterLab"`, `"chatbot"`).
        repo_id (`str`):
            Repo id of the template Space (e.g. `"SpacesExamples/jupyterlab"`).
        sdk (`str`):
            SDK the template is built with (e.g. `"gradio"`, `"docker"`, `"static"`).
        preferred_private (`bool`):
            Whether Spaces created from this template are recommended to be private.
    ÚnameÚrepo_idr™   Úpreferred_privater[   rQ   Nc                 óT   — |d   | _         |d   | _        |d   | _        |d   | _        y )Nr¨   ÚrepoIdr™   ÚpreferredPrivate)r¨   r©   r™   rª   rZ   s     r   rX   zSpaceTemplate.__init__Ž  s1   € Ø˜‘LˆŒ	Ø˜H‘~ˆŒØ˜‘;ˆŒØ!%Ð&8Ñ!9ˆÕr   )	r   r   r   r   rc   rb   rd   re   rX   r   r   r   r§   r§   v  s1   … ñð" ƒIØƒLØ	ƒHØÓð:˜Tð : dô :r   r§   c                   óV   — e Zd ZU dZeed<   eed<   edz  ed<   edz  ed<   deddfd	„Zy)
ÚZeroGpuQuotaa�  
    Contains information about the ZeroGPU quota of the authenticated user.

    The ZeroGPU quota is consumed each time you use a ZeroGPU Space (from the UI or through its API) and is reset
    periodically. See https://huggingface.co/docs/hub/spaces-zerogpu for more details.

    Returned by [`HfApi.get_zero_gpu_quota`].

    Args:
        base (`float`):
            Total quota, in GPU-seconds.
        remaining (`float`):
            Remaining quota, in GPU-seconds.
        resets_at (`datetime` or `None`):
            Date at which the quota will be reset. `None` if the quota has not been used yet.
        overquota_used (`float` or `None`):
            Overquota (paid) GPU-seconds consumed once the base quota is exhausted. PRO, Team and Enterprise users
            can purchase credits to go beyond the base quota at https://huggingface.co/settings/billing?add-credits=true.
    ÚbaseÚ	remainingNÚ	resets_atÚoverquota_usedr[   rQ   c                 ó¢   — |d   | _         |d   | _        |j                  d«      x}�t        |«      nd | _        |j                  d«      | _        y )Nr°   r|   ÚresetsAtÚoverquotaUsed)r°   r±   rU   r	   r²   r³   )rV   r[   r²   s      r   rX   zZeroGpuQuota.__init__°  sK   € Ø˜‘LˆŒ	Ø˜i™ˆŒØDHÇHÁHÈZÓDXÐ7X°yÐ6eœ¨	Ô2ÐkoˆŒØ"Ÿh™h Ó7ˆÕr   )	r   r   r   r   r¥   rb   r   re   rX   r   r   r   r¯   r¯   •  s;   … ñð( ƒKØÓØ˜$‰ÓØ˜D‘LÓ ð8˜Tð 8 dô 8r   r¯   N)%Údataclassesr   r   Úenumr   Útypingr   Úhuggingface_hub.utilsr   r   r	   rc   r   r   r   r   r   ÚINTERMEDIATE_SPACE_STAGESr   r   r   r   r   r   r   r   ÚTERMINAL_SPACE_STAGESr    r>   rF   rg   rr   r‡   r‘   r•   r§   r¯   r   r   r   ú<module>r½      s•  ðõ "Ý Ý Ý ç @Ñ @ô2��dô 2ð8 ×ÑØ×ÑØ×ÑØ×#Ñ#ð	Ð ð ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×Ñð	Ð ô'&�C˜ô '&ôT�3˜ô ð" ÷9ð 9ó ð9ðx ÷ð ó ðð ÷/ð /ó ð/ðd ÷Yð Yó ðYð6 ÷Yð Yó ðYð8 ÷>8ð >8ó ð>8ðB ÷:ð :ó ð:ð< ÷8ð 8ó ñ8r   