
    Y 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\	\5      r
 " S S	\	\5      r " S
 S\	\5      r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       r\ " S S5      5       rg)    )	dataclass)datetime)Enum)Literal)parse_datetimec                   H    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrg)
SpaceStage   a  
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_STARTING N)__name__
__module____qualname____firstlineno____doc__r   r   r   r   r   r   r   r   r   r   r   r   __static_attributes__r       k/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/huggingface_hub/_space_api.pyr	   r	      sG    	  K!LHKG)#MHGF!L1r   r	   c                   |    \ rS rSrSrSrSrSrSrSr	Sr
S	rS
rSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrSrg)SpaceHardware1   a!  
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cpu-performancezcpu-xlsprx8z	zero-a10gzt4-smallz	t4-mediuml4x1l4x4l40sx1l40sx4l40sx8z
a10g-smallz
a10g-largeza10g-largex2za10g-largex4z
a100-largea100x4a100x8h200h200x2h200x4h200x8inf2x6r   N)r   r   r   r   r   	CPU_BASICCPU_UPGRADECPU_PERFORMANCECPU_XLSPRX8	ZERO_A10GT4_SMALL	T4_MEDIUML4X1L4X4L40SX1L40SX4L40SX8
A10G_SMALL
A10G_LARGEA10G_LARGEX2A10G_LARGEX4
A100_LARGEA100X4A100X8H200H200X2H200X4H200X8INF2X6r   r   r   r   r!   r!   1   s    	 IK'OFE I HIDDFFFJJ!L!LJFFDFFF Fr   r!   c                   $    \ rS rSrSrSrSrSrSrg)SpaceStorage_   a  
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larger   N)	r   r   r   r   r   SMALLMEDIUMLARGEr   r   r   r   rJ   rJ   _   s    	 EFEr   rJ   c                       \ rS rSr% Sr\S   \S'   \\S'   \\S'   Sr\S-  \S'   Sr	\
S-  \S	'   Sr\S-  \S
'   SS jrS\4S jrS\4S jrSrg)Volumep   a  
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                 6   UR                  SS5      U l        US   U l        UR                  S5      nUb  UOUS   U l        UR                  S5      U l        UR                  S5      nUb  UOUR                  S5      U l        UR                  S	5      U l        g )
NrY   rV   rZ   	mountPathr[   r\   readOnlyr]   r^   )getrY   rZ   r[   r\   r]   r^   )selfkwargsr[   r]   s       r   __init__Volume.__init__   s    JJvw/	X&ZZ,
(2(>*F<DX

:.JJz*	&/&;KAXJJv&	r   c                     U R                   U R                  U R                  S.nU R                  b  U R                  US'   U R                  b  U R                  US'   U R
                  b  U R
                  US'   U$ )z6Serialize to the JSON payload expected by the Hub API.)rY   rZ   ra   r\   rb   r^   )rY   rZ   r[   r\   r]   r^   rd   datas     r   to_dictVolume.to_dict   sn     IIkk

 ==$#}}D>>%#~~D99 99DLr   c           	      (   U R                   (       a  SU R                    3OSnU R                  (       a  SU R                   3OSnSSSS.R                  U R                  S5      nSU R                   SU R
                   U U S	U R                   U 3	$ )
zDReturn the volume as an HF handle in the format expected by the CLI./ @z:roz:rw)TFNzhf://zs/:)r^   r\   rc   r]   rY   rZ   r[   )rd   r^   r\   ros       r   to_hf_handleVolume.to_hf_handle   s    "&))499+*.--Qt}}o&R%r266t~~rJtyykDKK=
4&$//ARSURVWWr   )r[   r^   r]   r\   rZ   rY   )r_   N)r   r   r   r   r   r   __annotations__strr\   r]   boolr^   rf   dictrk   rs   r   r   r   r   rS   rS   p   sh    $ 7
88KOHcDj!Itd{!D#*' Xc Xr   rS   c                   b    \ rS rSr% \S   \S'   \\\\S-  4      \S'   \	\S'   S\	SS4S	 jr
S
rg)SpaceHotReloading   )createdcanceledstatusNreplica_statusesrawrj   r_   c                 8    US   U l         US   U l        Xl        g )Nr~   replicaStatuses)r~   r   r   ri   s     r   rf   SpaceHotReloading.__init__   s     8n $%6 7r   )r   r   r~   )r   r   r   r   r   ru   listtuplerv   rx   rf   r   r   r   r   rz   rz      s>    )**5cDj122	IT d r   rz   c                       \ rS rSr% Sr\\S'   \S-  \S'   \S-  \S'   \S-  \S'   \	S-  \S'   \
S-  \S	'   \\   S-  \S
'   \\S'   S\SS4S jrSrg)SpaceRuntime   a+  
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hot_reloadingvolumesr   rj   r_   c                    US   U l         UR                  S0 5      R                  S5      U l        UR                  S0 5      R                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      =nb  [        U5      OS U l        UR                  S5      nUb  U Vs/ s H  n[        S	0 UD6PM     snOS U l	        Xl
        g s  snf )
Nr   r   current	requested	gcTimeoutr   hotReloadingr   r   )r   rc   r   r   r   r   rz   r   rS   r   r   )rd   rj   raw_hrraw_volumesvs        r   rf   SpaceRuntime.__init__   s    ']
R044Y?"&((:r":">">{"K((;/xx	*EIXXnE];]6:j.v6pthhy)=H=T[9[[9Z^ :s   C')r   r   r   r   r   r   r   r   )r   r   r   r   r   r	   ru   r!   intrJ   rz   r   rS   rx   rf   r   r   r   r   r   r      sl    2 d""%,,d
D  $t++&\D  	I	T 	d 	r   r   c                   Z    \ rS rSr% Sr\\S'   \S-  \S'   \S-  \S'   S\S\SS4S	 jr	S
r
g)SpaceSecret   a  
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valuesr_   c                     Xl         UR                  S5      U l        UR                  S5      nUb  [        U5      U l        g S U l        g )Nr   	updatedAt)r   rc   r   r   r   rd   r   r   r   s       r   rf   SpaceSecret.__init__   s>    !::m4ZZ,
8B8N.4TXr   )r   r   r   r   r   r   r   r   rv   ru   r   rx   rf   r   r   r   r   r   r      s@     
Ht4YC Y Y$ Yr   r   c                   d    \ rS rSr% Sr\\S'   \\S'   \S-  \S'   \S-  \S'   S\S\S	S4S
 jr	Sr
g)SpaceVariablei  a  
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   r_   c                     Xl         US   U l        UR                  S5      U l        UR                  S5      nUb  [	        U5      U l        g S U l        g )Nr   r   r   )r   r   rc   r   r   r   r   s       r   rf   SpaceVariable.__init__  sI    G_
!::m4ZZ,
8B8N.4TXr   )r   r   r   r   r   r   r   r   r   r     sE     
HJt4YC Y Y$ Yr   r   c                       \ rS rSr% Sr\\S'   \\S'   \\S'   \S-  \S'   \S-  \S'   \\S	'   \\S
'   \	\   S-  \S'   \
S-  \S'   \S-  \S'   \S-  \S'   \S-  \S'   \S-  \S'   S\SS4S jrSrg)SpaceSearchResulti!  a  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.
idauthortitleNemojisdklikesprivatetagsruntimeai_short_descriptionai_categorysemantic_relevancy_scoretrending_scorerj   r_   c                 X   UR                  S5      nUS   U l        UR                  SS5      U l        UR                  SS5      U l        UR                  S5      U l        UR                  S5      U l        UR                  SS	5      U l        UR                  S
S5      U l        UR                  S5      U l        U(       a  [        U5      OS U l
        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        UR                  S5      U l        g )Nr   r   r   ro   r   r   r   r   r   r   Fr   r   r   semanticRelevancyScoretrendingScore)rc   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )rd   rj   r   s      r   rf   SpaceSearchResult.__init__R  s    ((9%t*hhx,XXgr*
XXg&
88E?XXgq)
xx	51HHV$	07|G,T$(HH-C$D!88M2(,1I(J%"hh7r   )r   r   r   r   r   r   r   r   r   r   r   r   r   )r   r   r   r   r   rv   ru   r   rw   r   r   floatrx   rf   r   r   r   r   r   r   !  s    B 	GKJ:	tOJM
s)d
D  *$t#dl*$J8T 8d 8r   r   N)dataclassesr   r   enumr   typingr   huggingface_hub.utilsr   rv   r	   r!   rJ   rS   rz   r   r   r   r   r   r   r   <module>r      s    "    02d 26+C +\3 " 8X 8X 8Xv    , , ,^ Y Y Y6 Y Y Y8 >8 >8 >8r   