Ë
    çÍ:jå  ã                   óª   — 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:
    hf download --help

    # Download file
    hf download gpt2 config.json

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

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

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

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

    # Download to local dir
    hf 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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--force-downloadÚ
store_truezFIf True, the files will be downloaded even if they are already cached.)Úactionr   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     úq/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/huggingface_hub/cli/download.pyÚregister_subcommandz#DownloadCommand.register_subcommand6   s™  € à ×+Ñ+¨JÐ=ZÐ+Ó[ˆØ×$Ñ$ØœCÐ&dð 	%ô 	
ð 	×$Ñ$Øœc¨Ð3sð 	%ô 	
ð 	×$Ñ$ØÚ1ØØGð	 	%ô 	
ð 	×$Ñ$ØÜØcð 	%ô 	
ð
 	×$Ñ$Ø˜s¬Ð3^ð 	%ô 	
ð 	×$Ñ$Ø˜s¬Ð3eð 	%ô 	
ð 	×$Ñ$Ø¤Ð*eð 	%ô 	
ð 	×$Ñ$ØÜðð	 	%ô 	
ð 	×$Ñ$ØØØYð 	%ô 	
ð
 	×$Ñ$ØœCÐ&qð 	%ô 	
ð 	×$Ñ$ØØØjð 	%ô 	
ð
 	×$Ñ$ØÜØØXð	 	%ô 	
ð 	×$Ñ$¬/Ð$Õ:ó    ÚargsÚreturnNc                 óœ  — |j                   | _         |j                  | _        |j                  | _        |j                  | _        |j                  | _        |j
                  | _        |j                  | _        |j                  | _        |j                  | _        |j                  | _	        |j                  | _
        |j                  | _        y )N)Útokenr   r   Ú	repo_typeÚrevisionÚincludeÚexcludeÚ	cache_dirÚ	local_dirÚforce_downloadÚquietÚmax_workers)Úselfr*   s     r'   Ú__init__zDownloadCommand.__init__q   sŒ   € Ø—Z‘ZˆŒ
Ø ŸL™LˆŒØ$(§N¡NˆŒØ"Ÿn™nˆŒØ'+§}¡}ˆŒØ,0¯L©LˆŒØ,0¯L©LˆŒØ(,¯©ˆŒØ(,¯©ˆŒØ$(×$7Ñ$7ˆÔØŸ:™:ˆŒ
Ø $× 0Ñ 0ˆÕr)   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)r5   r   ÚwarningsÚcatch_warningsÚsimplefilterÚprintÚ	_downloadr   r   Úset_verbosity_infoÚset_verbosity_warning)r7   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(  rgt        | j                  | j                  | j                  | j                  d   | j                  | j                  | j                  | j                  d¬«	      S t        | j                  «      dk(  r| j                  }| j
                  }n| j                  }d }t        | 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   r.   r/   Úfilenamer2   r4   r-   r3   Úlibrary_name)r   r.   r/   Úallow_patternsÚignore_patternsr4   r2   r-   r3   rF   r6   )Úlenr   r0   r;   Úwarnr1   r
   r   r.   r/   r2   r4   r-   r3   r   r6   )r7   rG   rH   s      r'   r?   zDownloadCommand._download‹   sH  € äˆt�~‰~Ó Ò"Ø�|‰|Ð'¬C°·±Ó,=ÀÒ,AÜ—‘Ð_Ô`Ø�|‰|Ð'¬C°·±Ó,=ÀÒ,AÜ—‘Ð_Ô`ô ˆt�~‰~Ó !Ò#Ü"ØŸ™ØŸ.™.ØŸ™ØŸ™¨Ñ*ØŸ.™.Ø#×2Ñ2Ø—j‘jØŸ.™.Ø.ô
ð 
ô �—‘Ó  AÒ%Ø!Ÿ\™\ˆNØ"Ÿl™l‰Oà!Ÿ^™^ˆNØ"ˆOä Ø—L‘LØ—n‘nØ—]‘]Ø)Ø+Ø×.Ñ.Ø—n‘nØ—*‘*Ø—n‘nØ*Ø×(Ñ(ô
ð 	
r)   )r+   N)Ú__name__Ú
__module__Ú__qualname__Ústaticmethodr   r(   r   r8   rB   r#   r?   © r)   r'   r   r   5   sA   „ Øð8;Ð$5ò 8;ó ð8;ðt1˜Yð 1¨4ó 1ó
,ð*
˜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_loggerrK   Úloggerr   rO   r)   r'   ú<module>rZ      sG   ðñó0 ß 1ß !å #Ý @Ý >Ý 9ß Mð 
ˆ×	Ñ	˜HÓ	%€ô@
Ð/õ @
r)   