Ë
    -Œ:jz0  ã                   óT  — 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"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   © ó    ú\/var/www/html/tokenscope/api/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                   óT   — 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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Úa100x8N)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ÚA100X8r   r   r   r    r    D   sb   „ ñ	ð €IØ€Kð €Ið €HØ€IØ€DØ€DØ€FØ€FØ€FØ€JØ€JØ!€LØ!€LØ€JØ€FØ�Fr   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:   h   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 )
NrG   rD   rH   Ú	mountPathrI   rJ   ÚreadOnlyrK   rL   )ÚgetrG   rH   rI   rJ   rK   rL   )ÚselfÚkwargsrI   rK   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.)rG   rH   rO   rJ   rP   rL   )rG   rH   rI   rJ   rK   rL   ©rR   Ú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.Ú )rG   ÚidrJ   Úpath_in_repo)rH   rI   rK   )	r   r   rG   rH   rJ   rL   rI   rK   Úto_uri)rR   s    r   r]   zVolume.to_uri­   sM   € äÜ˜dŸi™i¨D¯K©KÀ$Ç-Á-Ð^b×^gÑ^gÒ^mÐkmÔnØ—‘Ø—n‘nô
÷ ‰&‹(ð		r   )rM   N)r   r   r   r   r   Ú__annotations__ÚstrrJ   rK   ÚboolrL   rT   ÚdictrX   r]   r   r   r   rB   rB   y   sf   … ñð$ Ð7Ñ
8Ó8ØƒKØƒOØ€Hˆc�D‰jÓØ!€Iˆt�d‰{Ó!Ø€Dˆ#�‰*Óó'ð˜ó ð˜ô r   rB   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ÚrawrW   rM   c                 ó:   — |d   | _         |d   | _        || _        y )Nrf   ÚreplicaStatuses)rf   rg   rh   rV   s     r   rT   zSpaceHotReloading.__init__¼   s"   € Ø˜8‘nˆŒØ $Ð%6Ñ 7ˆÔØˆ�r   )
r   r   r   r   r^   ÚlistÚtupler_   ra   rT   r   r   r   rc   rc   ¶   s>   … àÐ)Ñ*Ó*Ø˜5  c¨D¡j Ñ1Ñ2Ó2Ø	ƒIð˜Tð  dô r   rc   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Úvolumesrh   rW   rM   c                 óþ  — |d   | _         |j                  di «      j                  d«      | _        |j                  di «      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 )Nro   rp   ÚcurrentÚ	requestedÚ	gcTimeoutrs   ÚdevModeFÚhotReloadingrv   r   )ro   rQ   rp   rq   rr   rs   rt   rc   ru   rB   rv   rh   )rR   rW   Úraw_hrÚraw_volumesÚvs        r   rT   zSpaceRuntime.__init__ç   sØ   € Ø˜'‘]ˆŒ
ØŸ™ ¨RÓ0×4Ñ4°YÓ?ˆŒØ"&§(¡(¨:°rÓ":×">Ñ">¸{Ó"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   r^   r    Úintr:   r`   rc   rk   rB   ra   rT   r   r   r   rn   rn   Â   sq   … ñð2 ÓØ˜dÑ"Ó"Ø%¨Ñ,Ó,Ø�d‘
ÓØ˜DÑ Ó ØƒNØ$ tÑ+Ó+Ø�&‰\˜DÑ Ó Ø	ƒIð
˜Tð 
 dô 
r   rn   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ÚvaluesrM   c                 ó”   — || _         |j                  d«      | _        |j                  d«      }|�t        |«      | _        y d | _        y )Nr„   Ú	updatedAt)rƒ   rQ   r„   r	   r…   ©rR   rƒ   r†   r…   s       r   rT   zSpaceSecret.__init__	  s@   € ØˆŒØ!Ÿ:™: mÓ4ˆÔØ—Z‘Z Ó,ˆ
Ø8BÐ8Nœ.¨Ó4ˆ�ÐTXˆ�r   ©	r   r   r   r   r_   r^   r   ra   rT   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†   rM   c                 ó¨   — || _         |d   | _        |j                  d«      | _        |j                  d«      }|�t	        |«      | _        y d | _        y )Nr�   r„   rˆ   )rƒ   r�   rQ   r„   r	   r…   r‰   s       r   rT   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_scorerW   rM   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‘   rZ   r’   r“   r”   r•   r   r–   Fr—   r™   rš   ÚsemanticRelevancyScoreÚtrendingScore)rQ   r[   r‘   r’   r“   r”   r•   r–   r—   rn   r˜   r™   rš   r›   rœ   )rR   rW   r˜   s      r   rT   zSpaceSearchResult.__init__^  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   r_   r^   r€   r`   rk   rn   Úfloatra   rT   r   r   r   r�   r�   -  s‹   … ñðB 	ƒGØƒKØƒJØ�‰:ÓØ	ˆt‰ƒOØƒJØƒMØ
ˆs‰)�dÑ
ÓØ˜DÑ Ó Ø ™*Ó$Ø�t‘ÓØ# d™lÓ*Ø˜$‘JÓð8˜Tð 8 dô 8r   r�   N)#Údataclassesr   r   Úenumr   Útypingr   Úhuggingface_hub.utilsr   r   r	   r_   r   r   r   r   r   ÚINTERMEDIATE_SPACE_STAGESr   r   r   r   r   r   r   r   ÚTERMINAL_SPACE_STAGESr    r:   rB   rc   rn   r‚   rŒ   r�   r   r   r   ú<module>r§      sb  ðõ "Ý Ý Ý ç @Ñ @ô2��dô 2ð8 ×ÑØ×ÑØ×ÑØ×#Ñ#ð	Ð ð ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×ÑØ×Ñð	Ð ô!�C˜ô !ôH�3˜ô ð" ÷9ð 9ó ð9ðx ÷ð ó ðð ÷.ð .ó ð.ðb ÷Yð Yó ðYð6 ÷Yð Yó ðYð8 ÷>8ð >8ó ñ>8r   