
    RЦi3                        S r SSKrSSKrSSKrSSKrSSKrSSKrSSKrSSKrSSK	r	SSK
JrJrJrJrJr  SSKrSSKJr  SSKJr  SSKJr  SSKJrJr  SSKJrJrJr  SS	KJr  SS
K J!r!J"r"J#r#  SSK$J%r%J&r&J'r'  SSK(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5J6r6  Sr7\8" \" \!5      5      r9\" \#5      r:\Rv                  " S\: V s0 s H  o U _M     sn \<S9r=\\\<   \R|                  " SSR                  \95       S3\4" \95      S94   r@\6" SS9rA\AR                  SSS/S9SSSSSS\-R                  SS4	S\0S\)S\*S \\\=   \R|                  " S!S94   S"\,S#\@S$\+S%\.S&\1S'S4S( jj5       rD\AR                  S)S*S+/S9   SES,\\<\R                  " S-S94   S.\/S#\@S&\1S'S4
S/ jj5       rF\AR                  S0/ S1QS9     SFS,\\<\R                  " S-S94   S2\\\<   \R                  " S3S94   S4\\\<   \R|                  " S5S6S7S94   S8\\G\R|                  " S9S94   S:\\G\R|                  " S;S94   S&\1S'S4S< jj5       rHS=\"S,\<S>\<S?\\<   S&\\<   S'S4S@ jrISArJ\R                  S'\\<   4SB j5       rLS?\<S'\\M\SC   4   4SD jrNgs  sn f )Ga  Contains commands to interact with spaces on the Hugging Face Hub.

Usage:
    # list spaces on the Hub
    hf spaces ls

    # list spaces with a search query
    hf spaces ls --search "chatbot"

    # get info about a space
    hf spaces info enzostvs/deepsite
    N)	AnnotatedLiteralOptionalUnionget_args)version)assert_never)multi_replica_reload_events)ApiGetReloadEventSourceDataReloadRegion)CLIErrorRepositoryNotFoundErrorRevisionNotFoundError)hf_hub_download)ExpandSpaceProperty_THfApiSpaceSort_T)are_progress_bars_disableddisable_progress_barsenable_progress_bars   )	AuthorOpt	FilterOpt	FormatOptLimitOptOutputFormatQuietOptRevisionOpt	SearchOptTokenOptapi_object_to_dict
get_hf_apimake_expand_properties_parserprint_list_outputtyper_factoryz6.1.0SpaceSortEnum)typezMComma-separated properties to expand. Example: '--expand=likes,tags'. Valid: , .)helpcallbackz Interact with spaces on the Hub.)r*   lszhf spaces ls --limit 10z4hf spaces ls --search "chatbot" --author huggingface)examples
   FsearchauthorfiltersortzSort results.limitexpandformatquiettokenreturnc	           	          [        US9n	U(       a  UR                  OSn
U	R                  X!X
XES9 Vs/ s H  n[        U5      PM     nn[	        XUS9  gs  snf )zList spaces on the Hub.r7   N)r1   r0   r/   r2   r3   r4   )r5   r6   )r"   valuelist_spacesr!   r$   )r/   r0   r1   r2   r3   r4   r5   r6   r7   apisort_key
space_inforesultss                Y/var/www/html/ai-image-ml/venv/lib/python3.13/site-packages/huggingface_hub/cli/spaces.py	spaces_lsrB   W   sl    , 5
!C!tzztH //e * 

J 	:&
   gE:s   Ainfoz hf spaces info enzostvs/deepsitez>hf spaces info gradio/theme_builder --expand sdk,runtime,likesspace_idz)The space ID (e.g. `username/repo-name`).revisionc                 
   [        US9n UR                  XUS9n[        [        R                  " [        U5      S	S
95        g! [         a  n[        SU  S35      UeSnAf[         a  n[        SU SU  S35      UeSnAff = f)z"Get info about a space on the Hub.r:   )repo_idrE   r4   zSpace 'z' not found.Nz
Revision 'z' not found on 'z'.   )indent)	r"   r?   r   r   r   printjsondumpsr!   )rD   rE   r4   r7   r=   rC   es          rA   spaces_inforN   x   s     5
!CS~~h&~Q
 
$**'-a
89	 # @
,78a?  SH:-=hZrJKQRRSs#   A 
BAB*A==Bz
hot-reload)zshf spaces hot-reload username/repo-name app.py               # Open an interactive editor to the remote app.py filezhf spaces hot-reload username/repo-name -f app.py            # Take local version from ./app.py and patch app.py in remote repozhf spaces hot-reload username/repo-name app.py -f src/app.py # Take local version from ./src/app.py and patch app.py in remote repofilenamez~Path to the Python file in the Space repository. Can be omitted when --local-file is specified and path in repository matches.
local_filez--local-filez-fz<Path of local file. Interactive editor mode if not specifiedskip_checksz%Skip hot-reload compatibility checks.skip_summaryz2Skip summary display after hot-reload is triggeredc                    [         R                  " S[         R                  R                  S9  [	        US9nU(       d  UR                  U 5      nUR                  S:w  a  [        SUR                   S35      eUR                  =nc  [        SU  35      eUR                  =n	c  [        S	U  S
35      e[        R                  " U	5      [        R                  " [        5      :  a  [        S[         SU	 S35      eU(       a
  Un
Uc  UOUnOU(       a  U(       d   UR                  SU SS9  [         R"                  " 5       n[$        R&                  R)                  UR*                  U5      n
[-        5       =n(       d
  [/        5          [1        SU UUR*                  S9  U(       d
  [3        5         [5        U
5      nUS:X  a  [        S5      eUS:X  a  [        S5      eUS:w  a  [        SU
 35      eO[        S5      eUR7                  SU U
USS9nU(       d>  [9        UU UR:                  U(       a  U
O[$        R&                  R=                  U
5      US9  gg! [         a  n[        SU  S35      UeSnAff = f! U(       d  [3        5         f f = f)u  
Hot-reload any Python file of a Space without a full rebuild + restart.

⚠ This feature is experimental ⚠

Only works with Gradio SDK (6.1+)
Opens an interactive editor unless --local-file/-f is specified.

This command patches the live Python process using https://github.com/breuleux/jurigged
(AST-based diffing, in-place function updates, etc.), integrated with Gradio's native hot-reload support
(meaning that Gradio demo object changes are reflected in the UI)
z2This feature is experimental and subject to change)fgr:   gradioz5Hot-reloading is only available on Gradio SDK. Found z SDKNz"Unable to read cardData for Space z Unable to read sdk_version from z	 cardDataz!Hot-reloading requires Gradio >= z (found )spaceT)	repo_typerG   writezWrite access check to z8 repository failed. Make sure that you are authenticated)rX   rG   rO   	local_dirno-ttyzICannot open an editor (no TTY). Use -f flag to hot-reload from local path	no-editorzONo editor found in local environment. Use -f flag to hot-reload from local pathr   z>Editor returned a non-zero exit code while attempting to edit z4Either filename or --local-file/-f must be specified)rX   rG   path_or_fileobjpath_in_repo_hot_reload)r=   rD   
commit_sha
local_pathr7   )typersechocolorsBRIGHT_BLACKr"   r?   sdkr   	card_datasdk_versionr   parseVersionHOT_RELOADING_MIN_GRADIO
auth_checkr   tempfileTemporaryDirectoryospathjoinnamer   r   r   r   _editor_openupload_file_spaces_hot_reload_summaryoidbasename)rD   rO   rP   rQ   rR   r7   r=   r?   rg   rh   ra   rM   temp_dirpbar_disabled
editor_rescommit_infos                   rA   spaces_hot_reloadr|      s   \ 
KKDIbIbc
5
!C^^H-
>>X%RS]SaSaRbbfghh#---I6?zJKK$000K9=hZyQRR==%8P(QQ>?W>XX`al`mmnopp
!)!1:x		%$   ..0WW\\(--:
!;!===!#		'! !"--	 !$&!*-
!fgg$lmm?[\f[ghii  MNN//" " K ""%/zRWW5E5Ej5Q	
 I + ,XJ6no  !$& !s$   I I6 
I3I..I36J
r=   r`   ra   c                   ^^ U R                  U5      nUR                  =nc  [        SU S35      eUR                  =nc  [        SU S35      eUR                  S:w  a%  [
        R                  " SUR                  < 35        g UR                  =nc  [        S5      eUR                  =n	c  [        S5      eS	[        S
[        4U4S jjmS[        S
S 4U4S jjn
[        UUU	UR                   VVs/ s H  u  pUPM	     snnUS9 Hm  nUS   S:X  a  U
" US   5        M  US   S:X  a  [
        R                  " SUS    S35        MA  US   S:X  a  [
        R                  " S5        Mb  [        U5        Mo     g s  snnf )Nz!Unable to read SpaceRuntime from z infoszSpace z2 current running version has not been hot-reloadedcreatedzDFailed creating hot-reloaded commit. hot_reloading.replica_statuses=z)Unexpected None host on hotReloaded Spacez.Unexpected None subdomain on hotReloaded Spaceregionr8   c                    > SnTb  UT S3-  nU S   U S   :X  a  USU S   S-
   3-  nU$ USU S   S-
   SU S    3-  nU$ )	N r(   	startLineendLinezline r   zlines - )r   resra   s     rA   render_region1_spaces_hot_reload_summary.<locals>.render_region  s    !j\$$C+&"33U6+.2344C 
 VF;/!34AfY6G5HIIC
    eventc                   > U S   S   S:X  a1  [         R                  " SSS9  [         R                  " U S   S   SS9  g U S   S   S	:X  a@  [         R                  " S
T" U S   S   5       3SS9  [         R                  " U S   S   SS9  g U S   S   S:X  a(  [         R                  " SU S   S    SU S   S    3SS9  g U S   S   S:X  a(  [         R                  " SU S   S    SU S   S    3SS9  g U S   S   S:X  a(  [         R                  " SU S   S    SU S   S    3SS9  g U S   S   S:X  a@  [         R                  " ST" U S   S   5       3SS9  [         R                  " U S   S   SS9  g U S   S   S:X  a9  U S   S   (       a  [         R                  " SSS9  g [         R                  " SSS9  g [        U S   S   5        g )Ndatakinderroru"   ✘ Unexpected hot-reloading errorT)bold	traceback)italic	exceptionu   ✘ Exception at r   addu   ✔︎ Created 
objectName 
objectTypedeleteu   ∅ Deleted updateu   ✔︎ Updated runu   ▶ Run 	codeLinesuiupdatedu   ⟳ UI updatedu   ∅ UI untouched)rb   rc   r	   )r   r   s    rA   display_event1_spaces_hot_reload_summary.<locals>.display_event%  s   = G+KK<4HKKfk24@6]6"k1KK+M%-:Q,R+ST[_`KKfk24@6]6"e+KK/%-*E)FafVbHcGdelpq6]6"h.KK,uV}\'B&C1U6]S_E`Dabimn6]6"h.KK/%-*E)FafVbHcGdelpq6]6"e+KK(=vx1H#I"JKRVWKKfk24@6]6"d*V}Y',48.T:vv./r   )r`   host	subdomainreplica_hashesr7   r   replicaHashz---- Replica hashz ----	fullMatchu   ✔︎ Same as first replica)r?   runtimer   hot_reloadingstatusrb   echoreplica_statusesr   r   r   strr   r
   rc   r	   )r=   rD   r`   ra   r7   r?   r   r   
space_hostspace_subdomainr   r   _replica_stream_eventr   s      `          @rA   ru   ru     s    )J%%%.:8*FKLL ...7z)[\]]y(

Z=;Y;Y:[\] oo%
.BCC%///8GHHl s 08 0T 00 !<!,9,J,JK,J,JK!  '72.w78!&)]:KK-(<V(D'EUKL!&)[8JJ56-.! Ls   4E;))codezcode --wait)nvimr   )nanor   )vimr   )vir   c                      S H3  n [         R                  " U S5      R                  5       =n(       d  M1  Us  $    [         H   u  p#[        R
                  " U5      c  M  Us  $    g )N)	HF_EDITORVISUALEDITORr   )ro   getenvstripPREFERRED_EDITORSshutilwhich)envcommandbinary_patheditor_commands       rA   _get_editor_commandr   W  sY    0iiR(..0070N 1 (9#<<$0!! (9 r   )r[   r\   c                 "   [         R                  R                  5       (       a#  [         R                  R                  5       (       d  g[	        5       =nc  g/ [
        R                  " U5      QU Pn[        R                  " USS9nUR                  $ )Nr[   r\   T)start_new_session)
sysstdinisattystdoutr   shlexsplit
subprocessr   
returncode)ra   r   r   r   s       rA   rs   rs   b  sm    II3::#4#4#6#6-//88N+8Z8G
..D
9C>>r   )NNN)NNFFN)O__doc__enum	functoolsrK   ro   r   r   r   r   rm   typingr   r   r   r   r   rb   	packagingr   typing_extensionsr	   "huggingface_hub._hot_reload.clientr
   !huggingface_hub._hot_reload.typesr   r   huggingface_hub.errorsr   r   r   huggingface_hub.file_downloadr   huggingface_hub.hf_apir   r   r   huggingface_hub.utilsr   r   r   
_cli_utilsr   r   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   rk   sorted_EXPAND_PROPERTIES_SORT_OPTIONSEnumr   r&   Optionrq   	ExpandOpt
spaces_clir   tablerB   ArgumentrN   boolr|   ru   r   cacher   intrs   )ss   0rA   <module>r      s      	    
  @ @   * J W [ [ 9 L L i i   $ #  H%:;< %		/-+H-QqD-+HsS SM	LL\]a]f]fgy]z\{{|}./AB	  BC
 !>    	$**;;; ; /*	,	; ; ; ; ; ; 
;;4 
*H   !	:U^^1\]]^:: : 	:
 
::"   ( 	 	_dmr/k
<	
	k
  R	
	k
 O	
	k
* 43Z![[\+k
, D%,,4h"iij-k
. /k
0 
1k
k
\E/	E/E/ E/ 	E/
 C=E/ 
E/P  Xc]  S U38M0N+N%O u ,Is    I9
