
    g                         d dl mZ d dlmZ d dlmZ d dlmZmZ d dlm	Z	  G d de
e      Z G d d	e
e      Z G d
 de
e      Ze G d d             Ze G d d             Zy)    )	dataclass)datetime)Enum)DictOptional)parse_datetimec                   8    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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PAUSEDN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r   r        O/var/www/openai/venv/lib/python3.12/site-packages/huggingface_hub/_space_api.pyr
   r
      s<    	  K!LHKG)#MHGFr   r
   c                   L    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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/moon-landing/blob/main/server/repo_types/SpaceInfo.ts#L73 (private url).
    z	cpu-basiczcpu-upgradezt4-smallz	t4-mediuml4x1l4x4z	zero-a10gz
a10g-smallz
a10g-largeza10g-largex2za10g-largex4z
a100-largezv5e-1x1zv5e-2x2zv5e-2x4N)r   r   r   r   	CPU_BASICCPU_UPGRADET4_SMALL	T4_MEDIUML4X1L4X4	ZERO_A10G
A10G_SMALL
A10G_LARGEA10G_LARGEX2A10G_LARGEX4
A100_LARGEV5E_1X1V5E_2X2V5E_2X4r   r   r   r   r   0   sT    	 IKHIDDIJJ!L!LJGGGr   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   r0   r0   M   s    	 EFEr   r0   c                   v    e Zd ZU dZeed<   ee   ed<   ee   ed<   ee   ed<   ee	   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 than `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.
        raw (`dict`):
            Raw response from the server. Contains more information about the Space
            runtime like number of replicas, number of cpu, memory size,...
    stagehardwarerequested_hardware
sleep_timestoragerawdatareturnNc                    |d   | _         |j                  di       j                  d      | _        |j                  di       j                  d      | _        |j                  d      | _        |j                  d      | _        || _        y )Nr9   r:   current	requested	gcTimeoutr=   )r9   getr:   r;   r<   r=   r>   )selfr?   s     r   __init__zSpaceRuntime.__init__}   so    ']
R044Y?"&((:r":">">{"K((;/xx	*r   )r   r   r   r   r
   __annotations__r   r   intr0   r   rG   r   r   r   r8   r8   ^   sR    , }%% //l##	IT d r   r8   c                   Z    e Zd ZU dZeed<   eed<   ee   ed<   ee   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).
    keyvaluedescription
updated_atvaluesr@   Nc                     || _         |d   | _        |j                  d      | _        |j                  d      }|t	        |      | _        y d | _        y )NrM   rN   	updatedAt)rL   rM   rE   rN   r   rO   )rF   rL   rP   rO   s       r   rG   zSpaceVariable.__init__   sK    G_
!::m4ZZ,
8B8N.4TXr   )
r   r   r   r   strrH   r   r   r   rG   r   r   r   rK   rK      sF     
HJ#""YC Y Y$ Yr   rK   N)dataclassesr   r   enumr   typingr   r   huggingface_hub.utilsr   rS   r
   r   r0   r8   rK   r   r   r   <module>rX      sv    "   ! 0d 2C :3 " $ $ $N Y Y Yr   