§
    }Štjp4  ã                   ób  — 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j        ej        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#dS )é    )Ú	dataclass)Údatetime)ÚEnum)ÚLiteral)ÚHfMountÚHfUriÚparse_datetimec                   óB   — 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S )Ú
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   © ó    úX/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/huggingface_hub/_space_api.pyr   r      sZ   € € € € € ð	ð 	ð  €KØ!€LØ€HØ€KØ€GØ)ÐØ#€MØ€HØ€GØ€FØ!€LØ1ÐÐÐr   r   c                   óV   — 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S )Ú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   ss   € € € € € ð	ð 	ð €IØ€Kð €Ið €HØ€IØ€DØ€DØ€FØ€FØ€FØ€JØ€JØ!€LØ!€LØ€JØ€FØ€F€F€Fr   r    c                   ó   — e Zd ZdZdZdZdZdS )Ú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Ø€E€E€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dS )Ú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                 óp  — |                      dd¦  «        | _        |d         | _        |                      d¦  «        }|�|n|d         | _        |                      d¦  «        | _        |                      d¦  «        }|�|n|                      d¦  «        | _        |                      d	¦  «        | _        d S )
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Ô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   NrJ   rP   rL   )rG   rH   rI   rJ   rK   rL   ©rR   Údatas     r   Úto_dictzVolume.to_dictž   sa   € ð ”IØ”kØœð
ð 
ˆð
 Œ=Ð$Ø#œ}ˆD�ÑØŒ>Ð%Ø#œ~ˆD�ÑØŒ9Ð Øœ9ˆD�‰LØˆr   c                 ó¬   — t          t          | j        | j        | j        | j        pd¬¦  «        | 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­   sR   € åÝ˜dœi¨D¬KÀ$Ä-Ð^bÔ^gÐ^mÐkmÐnÑnÔnØ”Ø”nð
ñ 
ô 
÷ Š&‰(Œ(ð		r   )rM   N)r   r   r   r   r   Ú__annotations__ÚstrrJ   rK   ÚboolrL   rT   ÚdictrX   r]   r   r   r   rB   rB   y   sÌ   € € € € € € ðð ð$ Ð7Ô
8Ð8Ð8Ñ8Ø€K€K�KØ€O€O�OØ€Hˆc�D‰jÐÐÑØ!€Iˆt�d‰{Ð!Ð!Ñ!Ø€Dˆ#�‰*ÐÐÑð'ð 'ð 'ð 'ð˜ð ð ð ð ð˜ð ð ð ð ð ð r   rB   c                   ól   — 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	dS )	ÚSpaceHotReloading)ÚcreatedÚcanceledÚstatusNÚreplica_statusesÚrawrW   rM   c                 óH   — |d         | _         |d         | _        || _        d S )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   ¶   sq   € € € € € € àÐ)Ô*Ð*Ð*Ñ*Ø˜5  c¨D¡j Ô1Ô2Ð2Ð2Ñ2Ø	€I€I�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dS )Ú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                 ó2  — |d         | _         |                     di ¦  «                             d¦  «        | _        |                     di ¦  «                             d¦  «        | _        |                     d¦  «        | _        |                     d¦  «        | _        |                     dd¦  «        | _        |                     d	¦  «        x}�t          |¦  «        nd | _        |                     d
¦  «        }|�d„ |D ¦   «         nd | _	        || _
        d S )Nro   rp   ÚcurrentÚ	requestedÚ	gcTimeoutrs   ÚdevModeFÚhotReloadingrv   c                 ó&   — g | ]}t          d i |¤Ž‘ŒS )r   )rB   )Ú.0Úvs     r   ú
<listcomp>z)SpaceRuntime.__init__.<locals>.<listcomp>ð   s"   € Ð9Ð9Ð9¨�˜˜ ˜˜Ð9Ð9Ð9r   )ro   rQ   rp   rq   rr   rs   rt   rc   ru   rv   rh   )rR   rW   Úraw_hrÚraw_volumess       r   rT   zSpaceRuntime.__init__ç   sù   € Ø˜'”]ˆŒ
ØŸš ¨RÑ0Ô0×4Ò4°YÑ?Ô?ˆŒØ"&§(¢(¨:°rÑ":Ô":×">Ò">¸{Ñ"KÔ"KˆÔØŸ(š( ;Ñ/Ô/ˆŒØ—x’x 	Ñ*Ô*ˆŒØŸš ¨EÑ2Ô2ˆŒØEIÇXÂXÈnÑE]ÔE]Ð;]¸6Ð:jÕ.¨vÑ6Ô6Ð6ÐptˆÔØ—h’h˜yÑ)Ô)ˆØ=HÐ=TÐ9Ð9¨[Ð9Ñ9Ô9Ð9ÐZ^ˆŒØˆŒˆˆr   )r   r   r   r   r   r^   r    Úintr:   r`   rc   rk   rB   ra   rT   r   r   r   rn   rn   Â   sË   € € € € € € ðð ð2 ÐÐÑØ˜dÑ"Ð"Ð"Ñ"Ø%¨Ñ,Ð,Ð,Ñ,Ø�d‘
ÐÐÑØ˜DÑ Ð Ð Ñ Ø€N€N�NØ$ tÑ+Ð+Ð+Ñ+Ø�&Œ\˜DÑ Ð Ð Ñ Ø	€I€I�Ið
˜Tð 
 dð 
ð 
ð 
ð 
ð 
ð 
r   rn   c                   óR   — 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dS )	Ú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                 ó¢   — || _         |                     d¦  «        | _        |                     d¦  «        }|�t          |¦  «        nd | _        d S )Nr‡   Ú	updatedAt)r†   rQ   r‡   r	   rˆ   ©rR   r†   r‰   rˆ   s       r   rT   zSpaceSecret.__init__	  sL   € ØˆŒØ!Ÿ:š: mÑ4Ô4ˆÔØ—Z’Z Ñ,Ô,ˆ
Ø8BÐ8N�.¨Ñ4Ô4Ð4ÐTXˆŒˆˆr   ©	r   r   r   r   r_   r^   r   ra   rT   r   r   r   r…   r…   ô   s}   € € € € € € ðð ð 
€H€H�HØ�t‘ÐÐÑØ˜4‘ÐÐÑðY˜Cð Y¨ð Y°$ð Yð Yð Yð Yð Yð Yr   r…   c                   ó\   — 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dS )
Ú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         | _        |                     d¦  «        | _        |                     d¦  «        }|�t	          |¦  «        nd | _        d S )Nr�   r‡   r‹   )r†   r�   rQ   r‡   r	   rˆ   rŒ   s       r   rT   zSpaceVariable.__init__%  sW   € ØˆŒØ˜G”_ˆŒ
Ø!Ÿ:š: mÑ4Ô4ˆÔØ—Z’Z Ñ,Ô,ˆ
Ø8BÐ8N�.¨Ñ4Ô4Ð4ÐTXˆŒˆˆr   r�   r   r   r   r�   r�     s†   € € € € € € ðð ð 
€H€H�HØ€J€J�JØ�t‘ÐÐÑØ˜4‘ÐÐÑðY˜Cð Y¨ð Y°$ð Yð Yð Yð 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dS )Ú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                 ó¾  — |                      d¦  «        }|d         | _        |                      dd¦  «        | _        |                      dd¦  «        | _        |                      d¦  «        | _        |                      d¦  «        | _        |                      dd	¦  «        | _        |                      d
d¦  «        | _        |                      d¦  «        | _        |rt          |¦  «        nd | _
        |                      d¦  «        | _        |                      d¦  «        | _        |                      d¦  «        | _        |                      d¦  «        | _        d S )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Ô1ˆŒØ—H’H˜VÑ$Ô$ˆŒ	Ø07ÐA•| GÑ,Ô,Ð,¸TˆŒØ$(§H¢HÐ-CÑ$DÔ$DˆÔ!ØŸ8š8 MÑ2Ô2ˆÔØ(,¯ªÐ1IÑ(JÔ(JˆÔ%Ø"Ÿhšh Ñ7Ô7ˆÔÐÐr   )r   r   r   r   r_   r^   rƒ   r`   rk   rn   Úfloatra   rT   r   r   r   r“   r“   -  sõ   € € € € € € ðð ðB 	€G€G�GØ€K€K�KØ€J€J�JØ�‰:ÐÐÑØ	ˆt‰€O€O�OØ€J€J�JØ€M€M�MØ
ˆsŒ)�dÑ
ÐÐÑØ˜DÑ Ð Ð Ñ Ø ™*Ð$Ð$Ñ$Ø�t‘ÐÐÑØ# d™lÐ*Ð*Ñ*Ø˜$‘JÐÐÑð8˜Tð 8 dð 8ð 8ð 8ð 8ð 8ð 8r   r“   c                   óL   — 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dS )
Ú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_privaterW   rM   Nc                 ón   — |d         | _         |d         | _        |d         | _        |d         | _        d S )Nr¦   ÚrepoIdr—   ÚpreferredPrivate)r¦   r§   r—   r¨   rV   s     r   rT   zSpaceTemplate.__init__‡  s7   € Ø˜”LˆŒ	Ø˜H”~ˆŒØ˜”;ˆŒØ!%Ð&8Ô!9ˆÔÐÐr   )	r   r   r   r   r_   r^   r`   ra   rT   r   r   r   r¥   r¥   o  sk   € € € € € € ðð ð" €I€I�IØ€L€L�LØ	€H€H�HØÐÐÑð:˜Tð : dð :ð :ð :ð :ð :ð :r   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   r   ú<module>r²      s×  ðð "Ð !Ð !Ð !Ð !Ð !Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð Ø Ð Ð Ð Ð Ð à @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @Ð @ð2ð 2ð 2ð 2ð 2��dñ 2ô 2ð 2ð8 ÔØÔØÔØÔ#ð	Ð ð ÔØÔØÔØÔØÔØÔØÔØÔð	Ð ð!ð !ð !ð !ð !�C˜ñ !ô !ð !ðHð ð ð ð �3˜ñ ô ð ð" ð9ð 9ð 9ð 9ð 9ñ 9ô 9ñ „ð9ðx ðð ð ð ð ñ ô ñ „ðð ð.ð .ð .ð .ð .ñ .ô .ñ „ð.ðb ðYð Yð Yð Yð Yñ Yô Yñ „ðYð6 ðYð Yð Yð Yð Yñ Yô Yñ „ðYð8 ð>8ð >8ð >8ð >8ð >8ñ >8ô >8ñ „ð>8ðB ð:ð :ð :ð :ð :ñ :ô :ñ „ð:ð :ð :r   