Ë
    Q^(h÷  ã                   óª   — d Z ddlZddlmZmZ ddlmZmZ 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  e	j&                  e«      Z G d
„ de«      Zy)aº  Contains command to download files from the Hub with the CLI.

Usage:
    huggingface-cli download --help

    # Download file
    huggingface-cli download gpt2 config.json

    # Download entire repo
    huggingface-cli download fffiloni/zeroscope --repo-type=space --revision=refs/pr/78

    # Download repo with filters
    huggingface-cli download gpt2 --include="*.safetensors"

    # Download with token
    huggingface-cli download Wauplin/private-model --token=hf_***

    # Download quietly (no progress bar, no warnings, only the returned path)
    huggingface-cli download gpt2 config.json --quiet

    # Download to local dir
    huggingface-cli download gpt2 --local-dir=./models/gpt2
é    N)Ú	NamespaceÚ_SubParsersAction)ÚListÚOptional)Úlogging)Úsnapshot_download)ÚBaseHuggingfaceCLICommand)Úhf_hub_download)Údisable_progress_barsÚenable_progress_barsc                   óF   — e Zd Zedefd„«       Zdeddfd„Zd	d„Zde	fd„Z
y)
ÚDownloadCommandÚparserc                 óà  — | j                  dd¬«      }|j                  dt        d¬«       |j                  dt        dd	¬
«       |j                  dg d¢dd¬«       |j                  dt        d¬«       |j                  ddt        d¬«       |j                  ddt        d¬«       |j                  dt        d¬«       |j                  dt        d¬«       |j                  dg d¢d¬«       |j                  dd d!¬"«       |j                  d#d d$¬"«       |j                  d%t        d&¬«       |j                  d'd d(¬"«       |j                  d)t        d*d+¬,«       |j	                  t
        ¬-«       y ).NÚdownloadzDownload files from the Hub)ÚhelpÚrepo_idz<ID of the repo to download from (e.g. `username/repo-name`).)Útyper   Ú	filenamesÚ*z>Files to download (e.g. `config.json`, `data/metadata.jsonl`).)r   Únargsr   z--repo-type)ÚmodelÚdatasetÚspacer   z4Type of repo to download from (defaults to 'model').)ÚchoicesÚdefaultr   z
--revisionzPAn optional Git revision id which can be a branch name, a tag, or a commit hash.z	--includez)Glob patterns to match files to download.)r   r   r   z	--excludez0Glob patterns to exclude from files to download.z--cache-dirz9Path to the directory where to save the downloaded files.z--local-dirz·If set, the downloaded file will be placed under this directory. Check out https://huggingface.co/docs/huggingface_hub/guides/download#download-files-to-local-folder for more details.z--local-dir-use-symlinks)ÚautoÚTrueÚFalsezWDeprecated and ignored. Downloading to a local directory does not use symlinks anymore.)r   r   z--force-downloadÚ
store_truezFIf True, the files will be downloaded even if they are already cached.)Úactionr   z--resume-downloadz“Deprecated and ignored. Downloading a file to local dir always attempts to resume previously interrupted downloads (unless hf-transfer is enabled).z--tokenzIA User Access Token generated from https://huggingface.co/settings/tokensz--quietzWIf True, progress bars are disabled and only the path to the download files is printed.z--max-workersé   zEMaximum number of workers to use for downloading files. Default is 8.)r   r   r   )Úfunc)Ú
add_parserÚadd_argumentÚstrÚintÚset_defaultsr   )r   Údownload_parsers     ú_/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/huggingface_hub/commands/download.pyÚregister_subcommandz#DownloadCommand.register_subcommand6   sØ  € à ×+Ñ+¨JÐ=ZÐ+Ó[ˆØ×$Ñ$ØœCÐ&dð 	%ô 	
ð 	×$Ñ$Øœc¨Ð3sð 	%ô 	
ð 	×$Ñ$ØÚ1ØØGð	 	%ô 	
ð 	×$Ñ$ØÜØcð 	%ô 	
ð
 	×$Ñ$Ø˜s¬Ð3^ð 	%ô 	
ð 	×$Ñ$Ø˜s¬Ð3eð 	%ô 	
ð 	×$Ñ$Ø¤Ð*eð 	%ô 	
ð 	×$Ñ$ØÜðð	 	%ô 	
ð 	×$Ñ$Ø&Ú-Økð 	%ô 	
ð
 	×$Ñ$ØØØYð 	%ô 	
ð
 	×$Ñ$ØØð gð 	%ô 	
ð
 	×$Ñ$ØœCÐ&qð 	%ô 	
ð 	×$Ñ$ØØØjð 	%ô 	
ð
 	×$Ñ$ØÜØØXð	 	%ô 	
ð 	×$Ñ$¬/Ð$Õ:ó    ÚargsÚreturnNc                 ó  — |j                   | _         |j                  | _        |j                  | _        |j                  | _        |j                  | _        |j
                  | _        |j                  | _        |j                  | _        |j                  | _        |j                  | _	        |j                  xs d | _
        |j                  | _        |j                  | _        |j                  �t        j                  dt         «       y y )NzbIgnoring --local-dir-use-symlinks. Downloading to a local directory does not use symlinks anymore.)Útokenr   r   Ú	repo_typeÚrevisionÚincludeÚexcludeÚ	cache_dirÚ	local_dirÚforce_downloadÚresume_downloadÚquietÚmax_workersÚlocal_dir_use_symlinksÚwarningsÚwarnÚFutureWarning)Úselfr-   s     r*   Ú__init__zDownloadCommand.__init__{   sÂ   € Ø—Z‘ZˆŒ
Ø ŸL™LˆŒØ$(§N¡NˆŒØ"Ÿn™nˆŒØ'+§}¡}ˆŒØ,0¯L©LˆŒØ,0¯L©LˆŒØ(,¯©ˆŒØ(,¯©ˆŒØ$(×$7Ñ$7ˆÔØ/3×/CÑ/CÒ/KÀtˆÔØŸ:™:ˆŒ
Ø $× 0Ñ 0ˆÔà×&Ñ&Ð2Ü�M‰MØtÜõð 3r,   c                 óŠ  — | j                   r`t        «        t        j                  «       5  t        j                  d«       t        | j                  «       «       d d d «       t        «        y t        j                  «        t        | j                  «       «       t        j                  «        y # 1 sw Y   t        «        y xY w)NÚignore)r9   r   r<   Úcatch_warningsÚsimplefilterÚprintÚ	_downloadr   r   Úset_verbosity_infoÚset_verbosity_warning)r?   s    r*   ÚrunzDownloadCommand.run�   s   € Ø�:Š:Ü!Ô#Ü×(Ñ(Ó*ñ (Ü×%Ñ% hÔ/Ü�d—n‘nÓ&Ô'÷(ô !Õ"ä×&Ñ&Ô(Ü�$—.‘.Ó"Ô#Ü×)Ñ)Õ+÷(ô !Õ"ús   «/B/Â/Cc                 óŠ  — t        | j                  «      dkD  rr| j                  �-t        | j                  «      dkD  rt        j                  d«       | j
                  �-t        | j
                  «      dkD  rt        j                  d«       t        | j                  «      dk(  rrt        | j                  | j                  | j                  | j                  d   | j                  | j                  | j                  | j                  | j                  d¬«
      S t        | j                  «      dk(  r| j                  }| j
                  }n| j                  }d }t        | j                  | j                  | j                  ||| j                  | j                  | j                  | j                  | j                  d| j                   ¬«      S )Nr   z?Ignoring `--include` since filenames have being explicitly set.z?Ignoring `--exclude` since filenames have being explicitly set.é   zhuggingface-cli)
r   r1   r2   Úfilenamer5   r8   r7   r0   r6   Úlibrary_name)r   r1   r2   Úallow_patternsÚignore_patternsr8   r7   r5   r0   r6   rM   r:   )Úlenr   r3   r<   r=   r4   r
   r   r1   r2   r5   r8   r7   r0   r6   r   r:   )r?   rN   rO   s      r*   rF   zDownloadCommand._downloadœ   sZ  € äˆt�~‰~Ó Ò"Ø�|‰|Ð'¬C°·±Ó,=ÀÒ,AÜ—‘Ð_Ô`Ø�|‰|Ð'¬C°·±Ó,=ÀÒ,AÜ—‘Ð_Ô`ô ˆt�~‰~Ó !Ò#Ü"ØŸ™ØŸ.™.ØŸ™ØŸ™¨Ñ*ØŸ.™.Ø $× 4Ñ 4Ø#×2Ñ2Ø—j‘jØŸ.™.Ø.ôð ô �—‘Ó  AÒ%Ø!Ÿ\™\ˆNØ"Ÿl™l‰Oà!Ÿ^™^ˆNØ"ˆOä Ø—L‘LØ—n‘nØ—]‘]Ø)Ø+Ø ×0Ñ0Ø×.Ñ.Ø—n‘nØ—*‘*Ø—n‘nØ*Ø×(Ñ(ô
ð 	
r,   )r.   N)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr   r+   r   r@   rI   r&   rF   © r,   r*   r   r   5   sD   „ ØðB;Ð$5ò B;ó ðB;ðH˜Yð ¨4ó ó*
,ð,
˜3ô ,
r,   r   )Ú__doc__r<   Úargparser   r   Útypingr   r   Úhuggingface_hubr   Ú"huggingface_hub._snapshot_downloadr   Úhuggingface_hub.commandsr	   Úhuggingface_hub.file_downloadr
   Úhuggingface_hub.utilsr   r   Ú
get_loggerrQ   Úloggerr   rU   r,   r*   ú<module>r`      sG   ðñó0 ß 1ß !å #Ý @Ý >Ý 9ß Mð 
ˆ×	Ñ	˜HÓ	%€ôS
Ð/õ S
r,   