Ë
    ëÿæiùA  ã            (       óš  — d Z ddlZddlmZ ddlZddlmZmZ ddlm	Z	m
Z
mZmZ ddlmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZmZ ddlm Z m!Z!  ed	¬
«      Z"e"jG                  d¬«      dejH                  ddfd„«       Z% ed¬
«      Z& ed¬
«      Z'e"jQ                  e&d¬«       e"jQ                  e'd¬«        G d„ de)ejT                  «      Z+ee,dz   ejZ                  dd¬
«      f   Z.ee,dz   ejZ                  dd¬
«      f   Z/eedz   ejZ                  dd¬
«      f   Z0eedz   ejZ                  dd¬
«      f   Z1ee2dz   ejZ                  dd ¬
«      f   Z3e"ji                  d!g d"¢¬#«      ejj                  dddddd$ddddddddde jl                  fd%ed&ed'ee)dz   ejZ                  d(¬
«      f   d)ed*e.d+e/d,ed-ee, ejZ                  d.¬
«      f   d/ee)dz   ejZ                  d0¬
«      f   d1e0d2e1d3e3d4ed5ed6ed7ed8ed9eddf&d:„«       Z7e"ji                  d;g d<¢¬#«      dejj                  ddddd$dddddddde jl                  fd=ed>ee)dz   ejp                  d?¬
«      f   d&ed)ed*e.d+e/d,ed-ee, ejZ                  d.¬
«      f   d1e0d2e1d3e3d4ed5ed6ed7ed8ed9eddf$d@„«       Z9e"ji                  dAdBg¬#«      ejj                  dd$d$e jl                  fd%ed&ed,edCee, ejZ                  dD¬
«      f   dEee, ejZ                  dFdGdH¬
«      f   d9eddfdI„«       Z:e"ji                  dJdKg¬#«      dejj                  e jl                  fd=ed>ed,ed&ed9eddfdL„«       Z;e"ji                  dMg dN¢¬#«      dddddejj                  e jl                  fd%edOee+dz   ejZ                  dP¬
«      f   d)ed*e.d+e/d,ed&ed9eddfdQ„«       Z<e"ji                  dRg dS¢¬#«      ejj                  dddd$de jl                  fd%edTee=e)    ejp                  dU¬
«      f   d&edVedWee)dz   ejZ                  dX¬
«      f   dYee)dz   ejZ                  dZ¬
«      f   d[ee, ejZ                  d\¬
«      f   d,ed9eddfd]„«       Z>e'ji                  d!d^d_g¬#«      ddejj                  d$e jl                  fd%edee) ejp                  d`¬
«      f   dVed,ed&ed-ee, ejZ                  da¬
«      f   d9eddfdb„«       Z?e'ji                  dAdcg¬#«      dejj                  e jl                  fd%edee) ejp                  dd¬
«      f   d,ed&ed9eddfde„«       Z@e&ji                  d!dfdgg¬#«      dddejj                  e jl                  fd%edee) ejp                  dh¬
«      f   diee)dz   ejZ                  djdkdl¬
«      f   dVed,ed&ed9eddfdm„«       ZAe&ji                  dndog¬#«      dejj                  e jl                  fd%ed,ed&ed9eddf
dp„«       ZBe&ji                  dAdqg¬#«      d$dejj                  e jl                  fd%edee) ejp                  dr¬
«      f   dEee, ejZ                  dFdGds¬
«      f   d,ed&ed9eddfdt„«       ZCy)uae  Contains commands to interact with repositories on the Hugging Face Hub.

Usage:
    # create a new dataset repo on the Hub
    hf repos create my-cool-dataset --repo-type=dataset

    # create a private model repo on the Hub
    hf repos create my-cool-model --private

    # delete files from a repo on the Hub
    hf repos delete-files my-model file.txt
é    N)Ú	Annotated)ÚSpaceHardwareÚSpaceStorage)ÚCLIErrorÚHfHubHTTPErrorÚRepositoryNotFoundErrorÚRevisionNotFoundErroré   )Ú
EnvFileOptÚEnvOptÚFormatWithAutoOptÚ
PrivateOptÚ	RepoIdArgÚRepoTypeÚRepoTypeOptÚRevisionOptÚSecretsFileOptÚ
SecretsOptÚTokenOptÚ
VolumesOptÚenv_map_to_key_value_listÚ
get_hf_apiÚparse_env_mapÚparse_volumesÚtyper_factory)ÚOutputFormatWithAutoÚoutzManage repos on the Hub.)ÚhelpT)Úinvoke_without_commandÚctxÚreturnc                 óN   — | j                   dk(  rt        j                  d«       y y )NÚrepoz/`hf repo` is deprecated in favor of `hf repos`.)Ú	info_namer   Úwarning)r    s    ún/Volumes/fast/ai/experiments/voice-extract-mac/.venv/lib/python3.12/site-packages/huggingface_hub/cli/repos.pyÚ_repos_callbackr'   <   s    € à
‡}�}˜ÒÜ�‰ÐEÕFð ó    z"Manage tags for a repo on the Hub.z&Manage branches for a repo on the Hub.Útag)ÚnameÚbranchc                   ó   — e Zd ZdZdZdZy)ÚGatedChoicesÚautoÚmanualÚfalseN)Ú__name__Ú
__module__Ú__qualname__r.   r/   r0   © r(   r&   r-   r-   H   s   „ Ø€DØ€FØ�Er(   r-   z--publiczDWhether to make the repo public. Ignored if the repo already exists.z--protectedzVWhether to make the Space protected (Spaces only). Ignored if the repo already exists.z--flavorzOSpace hardware flavor (e.g. 'cpu-basic', 't4-medium', 'l4x4'). Only for Spaces.z	--storagezq(Deprecated, use volumes instead) Space persistent storage tier ('small', 'medium', or 'large'). Only for Spaces.z--sleep-timez[Seconds of inactivity before the Space is put to sleep. Use -1 to disable. Only for Spaces.Úcreate)zhf repos create my-modelz8hf repos create my-dataset --repo-type dataset --privatezxhf repos create my-space --type space --space-sdk gradio --flavor t4-medium --secrets HF_TOKEN -e THEME=dark --protectedzihf repos create my-space --type space --space-sdk gradio -v hf://gpt2:/models -v hf://buckets/org/b:/data)ÚexamplesFÚrepo_idÚ	repo_typeÚ	space_sdkzEHugging Face Spaces SDK type. Required when --type is set to 'space'.ÚprivateÚpublicÚ	protectedÚtokenÚexist_okz-Do not raise an error if repo already exists.Úresource_group_idzoResource group in which to create the repo. Resource groups is only available for Enterprise Hub organizations.ÚhardwareÚstorageÚ
sleep_timeÚsecretsÚsecrets_fileÚenvÚenv_fileÚvolumeÚformatc                 ó8  — t        |¬«      }|j                  | |j                  |rdn	|rdn|rdnd|||||	|
|t        t	        ||«      «      t        t	        ||«      «      t        |«      ¬«      }t        j                  d|j                  t        |«      ¬«       y)	zCreate a new repo on the Hub.©r=   r:   r;   r<   N)r7   r8   Ú
visibilityr=   r>   r?   r9   Úspace_hardwareÚspace_storageÚspace_sleep_timeÚspace_secretsÚspace_variablesÚspace_volumeszRepo created)r7   Úurl)
r   Úcreate_repoÚvaluer   r   r   r   Úresultr7   Ústr)r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   rA   rB   rC   rD   rE   rF   rG   rH   ÚapiÚrepo_urls                       r&   Úrepo_createrY   v   s”   € ôZ ˜5Ô
!€CØ�‰ØØ—/‘/Ù '‘9¹©XÑT]Á[ÐcgØØØ+ØØØØ#Ü/´¸gÀ|Ó0TÓUÜ1´-ÀÀXÓ2NÓOÜ# FÓ+ð ó €Hô ‡J�Jˆ~ x×'7Ñ'7¼SÀ»]ÖKr(   Ú	duplicate)z/hf repos duplicate openai/gdpval --type datasetzzhf repos duplicate multimodalart/dreambooth-training my-dreambooth --type space --flavor l4x4 --secrets HF_TOKEN --privatezfhf repos duplicate org/my-space my-space --type space -v hf://gpt2:/models -v hf://buckets/org/b:/dataÚfrom_idÚto_idz_Destination repo ID (e.g. `myorg/my-copy`). Defaults to your namespace with the same repo name.c                 ó8  — t        |¬«      }|j                  | ||j                  |rdn	|rdn|rdnd||||	|
t        t	        ||«      «      t        t	        ||«      «      t        |«      ¬«      }t        j                  d| |j                  t        |«      ¬«       y)	z7Duplicate a repo on the Hub (model, dataset, or Space).rJ   r:   r;   r<   N)r[   r\   r8   rK   r=   r>   rL   rM   rN   rO   rP   rQ   zRepo duplicated)r[   r\   rR   )
r   Úduplicate_reporT   r   r   r   r   rU   r7   rV   )r[   r\   r8   r:   r;   r<   r=   r>   r@   rA   rB   rC   rD   rE   rF   rG   rH   rW   rX   s                      r&   Úrepo_duplicater_   ¶   s—   € ôL ˜5Ô
!€CØ×!Ñ!ØØØ—/‘/Ù '‘9¹©XÑT]Á[ÐcgØØØØØ#Ü/´¸gÀ|Ó0TÓUÜ1´-ÀÀXÓ2NÓOÜ# FÓ+ð "ó €Hô ‡J�JÐ ¨'¸×9IÑ9IÌsÐS[Ë}Ö]r(   Údeletezhf repos delete my-modelÚ
missing_okz=If set to True, do not raise an error if repo does not exist.Úyesz-yz--yesz#Answer Yes to prompt automatically.c                 óÖ   — t        j                  d|j                  › d| › d�|¬«       t        |¬«      }|j	                  | |j                  |¬«       t        j
                  d| ¬«       y	)
z>Delete a repo from the Hub. This is an irreversible operation.z$You are about to permanently delete ú 'z'. Proceed?©rb   rJ   )r7   r8   ra   zRepo deleted©r7   N)r   ÚconfirmrT   r   Údelete_reporU   )r7   r8   r=   ra   rb   rH   rW   s          r&   Úrepo_deleteri   î   sa   € ô, ‡K�KÐ6°y·±Ð6GÀrÈ'ÈÐR]Ð^ÐdgÕhÜ
˜5Ô
!€CØ‡O�OØØ—/‘/Øð ô ô
 ‡J�Jˆ~ wÖ/r(   Úmovez;hf repos move old-namespace/my-model new-namespace/my-modelc                 óˆ   — t        |¬«      }|j                  | ||j                  ¬«       t        j                  d| |¬«       y)z8Move a repository from a namespace to another namespace.rJ   )r[   r\   r8   z
Repo moved)r[   r\   N)r   Ú	move_reporT   r   rU   )r[   r\   r=   r8   rH   rW   s         r&   Ú	repo_moverm     s>   € ô ˜5Ô
!€CØ‡M�MØØØ—/‘/ð ô ô
 ‡J�Jˆ| W°EÖ:r(   Úsettings)z$hf repos settings my-model --privatez'hf repos settings my-model --gated autoz8hf repos settings my-space --repo-type space --protectedÚgatedz$The gated status for the repository.c                 óä   — t        |¬«      }|j                  | |€dn|t        j                  u rdn|j                  |rdn	|rdn|rdnd|j                  ¬«       t        j                  d| ¬	«       y)
z$Update the settings of a repository.rJ   NFr:   r;   r<   )r7   ro   rK   r8   zRepo settings updatedrf   )r   Úupdate_repo_settingsr-   r0   rT   r   rU   )	r7   ro   r:   r;   r<   r=   r8   rH   rW   s	            r&   Úrepo_settingsrr      sl   € ô0 ˜5Ô
!€CØ×ÑØØ�}‰t°5¼L×<NÑ<NÑ3N©%ÐTY×T_ÑT_Ù '‘9¹©XÑT]Á[ÐcgØ—/‘/ð	 ô ô ‡J�JÐ&°Ö8r(   zdelete-files)z'hf repos delete-files my-model file.txtz'hf repos delete-files my-model "*.json"z&hf repos delete-files my-model folder/ÚpatternszXGlob patterns to match files to delete. Based on fnmatch, '*' matches files recursively.ÚrevisionÚcommit_messagez9The summary / title / first line of the generated commit.Úcommit_descriptionz(The description of the generated commit.Ú	create_prz7Whether to create a new Pull Request for these changes.c	           	      ó�   — t        |¬«      }	|	j                  || |j                  ||||¬«      }
t        j                  d| |
¬«       y)z$Delete files from a repo on the Hub.rJ   )Údelete_patternsr7   r8   rt   ru   rv   rw   zFiles deleted)r7   Ú
commit_urlN)r   Údelete_filesrT   r   rU   )r7   rs   r8   rt   ru   rv   rw   r=   rH   rW   rR   s              r&   Úrepo_delete_filesr|   B  sO   € ôP ˜5Ô
!€CØ
×
Ñ
Ø ØØ—/‘/ØØ%Ø-Øð ó €Cô ‡J�Jˆ¨¸CÖ@r(   z#hf repos branch create my-model devz5hf repos branch create my-model dev --revision abc123z!The name of the branch to create.z?If set to True, do not raise an error if branch already exists.c                 ó¢   — t        |¬«      }|j                  | |||j                  |¬«       t        j                  d||j                  | ¬«       y)z*Create a new branch for a repo on the Hub.rJ   )r7   r+   rt   r8   r>   zBranch created©r+   r8   r7   N)r   Úcreate_branchrT   r   rU   )r7   r+   rt   r=   r8   r>   rH   rW   s           r&   Úbranch_creater€   w  sN   € ô6 ˜5Ô
!€CØ×ÑØØØØ—/‘/Øð ô ô ‡J�JÐ¨¸)¿/¹/ÐSZÖ[r(   z#hf repos branch delete my-model devz!The name of the branch to delete.c                 óž   — t        |¬«      }|j                  | ||j                  ¬«       t        j                  d||j                  | ¬«       y)z'Delete a branch from a repo on the Hub.rJ   )r7   r+   r8   zBranch deletedr~   N)r   Údelete_branchrT   r   rU   )r7   r+   r=   r8   rH   rW   s         r&   Úbranch_deleterƒ   �  sH   € ô ˜5Ô
!€CØ×ÑØØØ—/‘/ð ô ô
 ‡J�JÐ¨¸)¿/¹/ÐSZÖ[r(   z!hf repos tag create my-model v1.0z4hf repos tag create my-model v1.0 -m "First release"zThe name of the tag to create.Úmessagez-mz	--messagez%The description of the tag to create.c                 ó   — |j                   }t        |¬«      }	 |j                  | ||||¬«       t        j                  d||| ¬«       y# t        $ r%}	t	        |j                  «       › d| › d�«      |	‚d}	~	wt        $ r}	t	        d|› d�«      |	‚d}	~	wt        $ r2}	|	j                  j                  dk(  rt	        d|› d	| › d
�«      |	‚‚ d}	~	ww xY w)zCreate a tag for a repo.rJ   )r7   r)   Útag_messagert   r8   rd   ú' not found.Nz
Revision 'i™  úTag 'z' already exists on 'ú'.zTag created©r)   r8   r7   )rT   r   Ú
create_tagr   r   Ú
capitalizer	   r   ÚresponseÚstatus_coder   rU   )
r7   r)   r„   rt   r=   r8   rH   Úrepo_type_strrW   Úes
             r&   Ú
tag_creater‘   ´  sÚ   € ð: —O‘O€MÜ
˜5Ô
!€Cð	Ø�‰˜w¨C¸WÈxÐcpˆÔqô ‡J�Jˆ} #°ÈÖPøô #ò VÜ˜-×2Ñ2Ó4Ð5°R¸°yÀÐMÓNÐTUÐUûÜ ò CÜ˜ H :¨\Ð:Ó;ÀÐBûÜò Ø�:‰:×!Ñ! SÒ(Ü˜U 3 %Ð'<¸W¸IÀRÐHÓIÈqÐPØûðús/   šA
 Á
	CÁ A3Á3CÁ?BÂCÂ-CÃCz	list | lszhf repos tag list my-modelc                 óh  — |j                   }t        |¬«      }	 |j                  | |¬«      }|j                  D �cg c]&  }|j                  |j                  |j                  dœ‘Œ( }	}t        j                  |	«       y# t        $ r%}t	        |j                  «       › d| › d�«      |‚d}~ww xY wc c}w )zList tags for a repo.rJ   )r7   r8   rd   r‡   N)r*   Útarget_commitÚref)rT   r   Úlist_repo_refsr   r   rŒ   Útagsr*   r“   r”   r   Útable)
r7   r=   r8   rH   r�   rW   Úrefsr�   ÚtÚitemss
             r&   Útag_listr›   à  s­   € ð —O‘O€MÜ
˜5Ô
!€CðVØ×!Ñ!¨'¸]Ð!ÓKˆð X\×W`ÒW`ÓaÑW`ÐRS�a—f‘f¨q¯©ÀqÇuÁuÓMÐW`€EÐaÜ‡I�IˆeÕøô #ò VÜ˜-×2Ñ2Ó4Ð5°R¸°yÀÐMÓNÐTUÐUûðVüâas   šA> »+B/Á>	B,Â B'Â'B,z!hf repos tag delete my-model v1.0zThe name of the tag to delete.z"Answer Yes to prompt automaticallyc                 óš  — |j                   }t        j                  d|› d|› d| › �«       t        j                  d|¬«       t	        |¬«      }	 |j                  | ||¬«       t        j                  d||| ¬«       y
# t        $ r%}t        |j                  «       › d| › d	�«      |‚d
}~wt        $ r}t        d|› d| › d�«      |‚d
}~ww xY w)zDelete a tag for a repo.zYou are about to delete tag z on Ú zProceed?re   rJ   )r7   r)   r8   rd   r‡   Nrˆ   z' not found on 'r‰   zTag deletedrŠ   )rT   r   Útextrg   r   Ú
delete_tagr   r   rŒ   r	   rU   )	r7   r)   rb   r=   r8   rH   r�   rW   r�   s	            r&   Ú
tag_deleter    ò  sÑ   € ð, —O‘O€MÜ‡H�HÐ+¨C¨5°°]°OÀ1ÀWÀIÐNÔOÜ‡K�K�
 Õ$Ü
˜5Ô
!€CðHØ�‰˜w¨C¸=ˆÔIô
 ‡J�Jˆ} #°ÈÖPøô	 #ò VÜ˜-×2Ñ2Ó4Ð5°R¸°yÀÐMÓNÐTUÐUûÜ ò HÜ˜˜s˜eÐ#3°G°9¸BÐ?Ó@ÀaÐGûðHús$   ÁA= Á=	C
Â B&Â&C
Â2CÃC
)DÚ__doc__ÚenumÚtypingr   ÚtyperÚhuggingface_hubr   r   Úhuggingface_hub.errorsr   r   r   r	   Ú
_cli_utilsr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   Ú_outputr   r   Ú	repos_cliÚcallbackÚContextr'   Útag_cliÚ
branch_cliÚ	add_typerrV   ÚEnumr-   ÚboolÚOptionÚ	PublicOptÚProtectedOptÚSpaceHardwareOptÚSpaceStorageOptÚintÚSpaceSleepTimeOptÚcommandÚmodelr.   rY   ÚArgumentr_   ri   rm   rr   Úlistr|   r€   rƒ   r‘   r›   r    r4   r(   r&   Ú<module>r¼      sµ  ðñó Ý ã ç 7ß kÓ k÷÷ ÷ ÷ õ ÷& /ñ Ð9Ô:€	ð ×Ñ¨4ÐÓ0ðG˜Ÿ™ð G¨4ò Gó 1ðGñ
 ÐAÔ
B€ÙÐ HÔI€
Ø 	× Ñ �G %Ð Ô (Ø 	× Ñ �J XÐ Ô .ô�3˜Ÿ	™	ô ð Øˆ4�KØ€E‡L�LØØSôðñ€	ð Øˆ4�KØ€E‡L�LØØeôðñ€ð Ø�DÑØ€E‡L�LØØ^ôðñÐ ð Ø�4ÑØ€E‡L�LØð Aôðñ€ð Øˆ$�JØ€E‡L�LØØjôðñÐ ð ×ÑØòð ó ð &Ÿ^™^ð 	ØØØ"Øð 	ð 	Ø!%Ø#Ø$(ØØ#'ØØØØ 4× 9Ñ 9ñC4LØð4Làð4Lð Øˆd‰
Øˆ�‰ØXô	
ð	ñð4Lð ð4Lð ð4Lð ð4Lð ð4Lð ØØˆ�‰Ø@ô	
ð	ñð4Lð& !Øˆd‰
Øˆ�‰ð Cô	
ð	ñð'4Lð2 ð34Lð4 ð54Lð6 "ð74Lð8 ð94Lð: !ð;4Lð< 
ð=4Lð> ð?4Lð@ ðA4LðB ðC4LðD 
òE4Lóð4Lðn ×ÑØòð ó ð 	Ø%Ÿ^™^ØØØ"Øð 	Ø!%Ø#Ø$(ØØ#'ØØØØ 4× 9Ñ 9ñ7-^Øð-^àØˆd‰
Øˆ�‰Ørô	
ð	ñð-^ð ð-^ð ð-^ð ð-^ð ð-^ð ð-^ð ØØˆ�‰Ø@ô	
ð	ñð-^ð& ð'-^ð( ð)-^ð* "ð+-^ð, ð--^ð. !ð/-^ð0 
ð1-^ð2 ð3-^ð4 ð5-^ð6 ð7-^ð8 
ò9-^óð-^ð` ×Ñ�8Ð'AÐ&BÐÓCð &Ÿ^™^Øð 	ð 	Ø 4× 9Ñ 9ñ%0Øð0àð0ð ð0ð ØØˆ�‰ØPô	
ð	ñð	0ð 
ØØˆ�‰ØØØ6ô	
ð	ñ
ð0ð$ ð%0ð& 
ò'0ó Dð0ð> ×Ñ�6Ð%bÐ$cÐÓdð Ø%Ÿ^™^Ø 4× 9Ñ 9ñ;Øð;àð;ð ð;ð ð	;ð
 ð;ð 
ò;ó eð;ð" ×ÑØòð ó ð 	ØØØ"ØØ%Ÿ^™^Ø 4× 9Ñ 9ñ9Øð9àØ�tÑØˆ�‰Ø7ô	
ð	ñð9ð ð9ð ð9ð ð9ð ð9ð ð9ð ð9ð 
ò9óð9ð4 ×ÑØòð ó ð  &Ÿ^™^Ø ð 	ð 	ð 	ØØ 4× 9Ñ 9ñ;*AØð*AàØˆS‰	Øˆ�‰Økô	
ð	ñð*Að ð*Að ð*Að Øˆd‰
Øˆ�‰ØLô	
ð	ñð*Að  "Øˆd‰
Øˆ�‰Ø;ô	
ð	ñð!*Að, ØØˆ�‰ØJô	
ð	ñð-*Að8 ð9*Að: ð;*Að< 
ò=*Aóð*AðZ ×ÑØà-Ø?ðð ó ð !ØØ%Ÿ^™^ð 	Ø 4× 9Ñ 9ñ#\Øð\àØØˆ�‰Ø4ô	
ð	ñð\ð ð\ð ð\ð ð\ð ØØˆ�‰ØRô	
ð	ñð\ð" ð#\ð$ 
ò%\óð\ð> ×Ñ�HÐ(MÐ'NÐÓOð Ø%Ÿ^™^Ø 4× 9Ñ 9ñ\Øð\àØØˆ�‰Ø4ô	
ð	ñð\ð ð\ð ð\ð ð\ð 
ò\ó Pð\ð, 	‡�Øà+Ø>ðð ó ð, 	Ø ØØ%Ÿ^™^Ø 4× 9Ñ 9ñ'"QØð"Qà	ØØˆ�‰Ø1ô	
ð	ñ
ð"Qð Øˆd‰
Øˆ�‰ØØØ8ô	
ð	ñð"Qð  ð!"Qð" ð#"Qð$ ð%"Qð& ð'"Qð( 
ò)"Qóð"QðJ 	‡��Ð(DÐ'E€ÓFð Ø%Ÿ^™^Ø 4× 9Ñ 9ñ	Øðàðð ðð ð	ð
 
òó Gðð" 	‡��Ð%HÐ$I€ÓJð  	ØØ%Ÿ^™^Ø 4× 9Ñ 9ñ%QØðQà	ØØˆ�‰Ø1ô	
ð	ñ
ðQð 
ØØˆ�‰ØØØ5ô	
ð	ñ
ðQð  ð!Qð" ð#Qð$ ð%Qð& 
ò'Qó KñQr(   