
    9isP              -       :   S SK r S SKJr  S SKJr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JrJrJrJr  SS	KJrJrJrJr  SS
KJrJ r J!r!J"r"J#r#  SSK$J%r%J&r&J'r'J(r(J)r)  SSK$Jr*  \(RV                  " \,5      r-Sr.\	SSSSSSS\R^                  SSSSSSSSSSS.S\0S\\0   S\\0   S\\0\S4   S\\0\S4   S\\0   S\\0   S\\\1\04      S\2S\3S\\\3\04      S\3S\\\4\0   \04      S\\\4\0   \04      S\5S\\6\      S \\1\0\04      S!\\0   S"\S   S#\04(S$ jj5       r7\	SSSSSSS\R^                  SSSSSSSSSS%S.S\0S\\0   S\\0   S\\0\S4   S\\0\S4   S\\0   S\\0   S\\\1\04      S\2S\3S\\\3\04      S\3S\\\4\0   \04      S\\\4\0   \04      S\5S\\6\      S \\1\0\04      S!\\0   S"\S%   S#\4\   4(S& jj5       r7\	SSSSSSS\R^                  SSSSSSSSSSS.S\0S\\0   S\\0   S\\0\S4   S\\0\S4   S\\0   S\\0   S\\\1\04      S\2S\3S\\\3\04      S\3S\\\4\0   \04      S\\\4\0   \04      S\5S\\6\      S \\1\0\04      S!\\0   S"\3S#\\0\4\   4   4(S' jj5       r7\)SSSSSSS\R^                  SSSSSSSSSSS.S\0S\\0   S\\0   S\\0\S4   S\\0\S4   S\\0   S\\0   S\\\1\04      S\2S\3S\\\3\04      S\3S\\\4\0   \04      S\\\4\0   \04      S\5S\\6\      S \\1\0\04      S!\\0   S"\3S#\\0\4\   4   4(S( jj5       r7g))    N)Path)IterableListLiteralOptionalUnionoverload)tqdm)
thread_map   )	constants)DryRunErrorGatedRepoErrorHfHubHTTPErrorLocalEntryNotFoundErrorRepositoryNotFoundErrorRevisionNotFoundError)REGEX_COMMIT_HASHDryRunFileInfohf_hub_downloadrepo_folder_name)DatasetInfoHfApi	ModelInfoRepoFile	SpaceInfo)OfflineModeIsEnabledfilter_repo_objectsis_tqdm_disabledloggingvalidate_hf_hub_argsi  F   )	repo_typerevision	cache_dir	local_dirlibrary_namelibrary_version
user_agentetag_timeoutforce_downloadtokenlocal_files_onlyallow_patternsignore_patternsmax_workers
tqdm_classheadersendpointdry_runrepo_idr#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   returnc                    g N r5   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   s                      b/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/huggingface_hub/_snapshot_download.pysnapshot_downloadr<      s    ,     Tc                    g r8   r9   r:   s                      r;   r<   r<   6   s    , r=   c                    g r8   r9   r:   s                      r;   r<   r<   O   s    , (+r=   c                R  ^ ^^^^^^^^	^
^^^^!^"^#^$ Tc  [         R                  mUc  [         R                  n[        T[        5      (       a  [        T5      mTc  SmT[         R                  ;  a(  [        ST S[        [         R                  5       35      e[        R                  R                  T[        T TS95      n[        TTTTTT
S9nSnSnU(       d   UR                  T TUS9nUGc  T(       a  [+        S5      UeSm#[,        R.                  " U5      (       a  Um#Oi[        R                  R                  US	U5      n[        R                  R1                  U5      (       a$  [3        U5       nUR5                  5       m#SSS5        T#bJ  TcG  [        R                  R                  US
T#5      n[        R                  R1                  U5      (       a  U$ Tbs  [	        T5      mTR7                  5       (       aS  [9        TR;                  5       5      (       a5  [<        R?                  ST SU S35        [        TRA                  5       5      $ U(       a  [C        S5      e[        U[$        5      (       a  [C        S5      Ue[        U[D        [F        45      (       d/  [        U[(        5      (       a  URH                  RJ                  S:X  a  Ue[C        S5      UeURL                  c   S5       eURN                  b'  URN                   Vs/ s H  nURP                  PM     snO/ nURN                  SL =(       d;    [S        URN                  5      S:H  =(       d    [S        URN                  5      [T        :  nU(       a.  [<        RW                  S5        S URY                  T SUTS9 5       n[[        UUUS9nU(       d  []        U5      nS[S        U5       S3nOSnT(       a  SU-   nURL                  m#[        R                  R                  US
T#5      nUT#:w  az  [        R                  R                  US	U5      n [        R^                  " [        R                  Ra                  U5      SS9  [3        US5       nURc                  T#5        SSS5        / m$U=(       d    [f        nU" S"[i        [<        Rk                  5       S#9SSS$SS%S&9m" " U"4S' jS(5      m!S)[
        S*S4U!UU#UUUU	UUUUU UU$U
U4S+ jjn [m        U UUUUS,9  T"Ro                  S-5        T(       a  [q        S. T$ 5       5      (       d   eT$$ Tb(  [        [        R                  Rs                  T5      5      $ U$ ! [        R                   a    e [        R                   [        R"                  [$        4 a  nUn SnAGNSnAf[&         a    e [(         a  nUn SnAGNSnAff = f! , (       d  f       GNO= fs  snf ! , (       d  f       GNa= f! [d         a'  n[<        R?                  SU S U S!35         SnAGNSnAff = f)/a  Download repo files.

Download a whole snapshot of a repo's files at the specified revision. This is useful when you want all files from
a repo, because you don't know which ones you will need a priori. All files are nested inside a folder in order
to keep their actual filename relative to that folder. You can also filter which files to download using
`allow_patterns` and `ignore_patterns`.

If `local_dir` is provided, the file structure from the repo will be replicated in this location. When using this
option, the `cache_dir` will not be used and a `.cache/huggingface/` folder will be created at the root of `local_dir`
to store some metadata related to the downloaded files. While this mechanism is not as robust as the main
cache-system, it's optimized for regularly pulling the latest version of a repository.

An alternative would be to clone the repo but this requires git and git-lfs to be installed and properly
configured. It is also not possible to filter which files to download when cloning a repository using git.

Args:
    repo_id (`str`):
        A user or an organization name and a repo name separated by a `/`.
    repo_type (`str`, *optional*):
        Set to `"dataset"` or `"space"` if downloading from a dataset or space,
        `None` or `"model"` if downloading from a model. Default is `None`.
    revision (`str`, *optional*):
        An optional Git revision id which can be a branch name, a tag, or a
        commit hash.
    cache_dir (`str`, `Path`, *optional*):
        Path to the folder where cached files are stored.
    local_dir (`str` or `Path`, *optional*):
        If provided, the downloaded files will be placed under this directory.
    library_name (`str`, *optional*):
        The name of the library to which the object corresponds.
    library_version (`str`, *optional*):
        The version of the library.
    user_agent (`str`, `dict`, *optional*):
        The user-agent info in the form of a dictionary or a string.
    etag_timeout (`float`, *optional*, defaults to `10`):
        When fetching ETag, how many seconds to wait for the server to send
        data before giving up which is passed to `httpx.request`.
    force_download (`bool`, *optional*, defaults to `False`):
        Whether the file should be downloaded even if it already exists in the local cache.
    token (`str`, `bool`, *optional*):
        A token to be used for the download.
            - If `True`, the token is read from the HuggingFace config
              folder.
            - If a string, it's used as the authentication token.
    headers (`dict`, *optional*):
        Additional headers to include in the request. Those headers take precedence over the others.
    local_files_only (`bool`, *optional*, defaults to `False`):
        If `True`, avoid downloading the file and return the path to the
        local cached file if it exists.
    allow_patterns (`list[str]` or `str`, *optional*):
        If provided, only files matching at least one pattern are downloaded.
    ignore_patterns (`list[str]` or `str`, *optional*):
        If provided, files matching any of the patterns are not downloaded.
    max_workers (`int`, *optional*):
        Number of concurrent threads to download files (1 thread = 1 file download).
        Defaults to 8.
    tqdm_class (`tqdm`, *optional*):
        If provided, overwrites the default behavior for the progress bar. Passed
        argument must inherit from `tqdm.auto.tqdm` or at least mimic its behavior.
        Note that the `tqdm_class` is not passed to each individual download.
        Defaults to the custom HF progress bar that can be disabled by setting
        `HF_HUB_DISABLE_PROGRESS_BARS` environment variable.
    dry_run (`bool`, *optional*, defaults to `False`):
        If `True`, perform a dry run without actually downloading the files. Returns a list of
        [`DryRunFileInfo`] objects containing information about what would be downloaded.

Returns:
    `str` or list of [`DryRunFileInfo`]:
        - If `dry_run=False`: Local snapshot path.
        - If `dry_run=True`: A list of [`DryRunFileInfo`] objects containing download information.

Raises:
    [`~utils.RepositoryNotFoundError`]
        If the repository to download from cannot be found. This may be because it doesn't exist,
        or because it is set to `private` and you do not have access.
    [`~utils.RevisionNotFoundError`]
        If the revision to download from cannot be found.
    [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
        If `token=True` and the token cannot be found.
    [`OSError`](https://docs.python.org/3/library/exceptions.html#OSError) if
        ETag cannot be determined.
    [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
        if some parameter value is invalid.
NmodelzInvalid repo type: z. Accepted repo types are: )r5   r#   )r'   r(   r)   r3   r2   r,   )r5   r#   r$   zDry run cannot be performed as the repository cannot be accessed. Please check your internet connection or authentication token.refs	snapshotszReturning existing local_dir `z<` as remote repo cannot be accessed in `snapshot_download` (z).zCannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, pass 'local_files_only=False' as input.zCannot find an appropriate cached snapshot folder for the specified revision on the local disk and outgoing traffic has been disabled. To enable repo look-ups and downloads online, set 'HF_HUB_OFFLINE=0' as environment variable.i  zAn error happened while trying to locate the files on the Hub and we cannot find the appropriate snapshot folder for the specified revision on the local disk. Please check your internet connection and try again.z8Repo info returned from server must have a revision sha.r   zaNumber of files in the repo is unreliable. Using `list_repo_tree` to ensure all files are listed.c              3   h   #    U  H(  n[        U[        5      (       d  M  UR                  v   M*     g 7fr8   )
isinstancer   	rfilename).0fs     r;   	<genexpr>$snapshot_download.<locals>.<genexpr>X  s'      
p!X& AKKps   22T)r5   	recursiver$   r#   )itemsr.   r/   z	Fetching z fileszFetching ... filesz
[dry-run] )exist_okwz+Ignored error while writing commit hash to z: .z!Downloading (incomplete total...))	log_levelBz!huggingface_hub.snapshot_download)descdisabletotalinitialunit
unit_scalenamec                   ^   > \ rS rSrSrU 4S jrS rS rSS\\	\
\4      SS4U 4S	 jjjrS
rg)*snapshot_download.<locals>._AggregatedTqdmi  zFake tqdm object to aggregate progress into the parent `bytes_progress` bar.

In practice the `_AggregatedTqdm` object won't be displayed, it's just used to update
the `bytes_progress` bar from each thread/file download.
c                    > UR                  SS 5      nUb%  T=R                  U-  sl        TR                  5         UR                  SS5      nU(       a  TR                  U5        g g )NrT   rU   r   )poprT   refreshupdate)selfargskwargsrT   rU   bytes_progresss        r;   __init__3snapshot_download.<locals>._AggregatedTqdm.__init__  s^    JJw-E $$-$&&( jjA.G%%g. r=   c                     U $ r8   r9   )r_   s    r;   	__enter__4snapshot_download.<locals>._AggregatedTqdm.__enter__  s    Kr=   c                     g r8   r9   )r_   exc_type	exc_value	tracebacks       r;   __exit__3snapshot_download.<locals>._AggregatedTqdm.__exit__  s    r=   nr6   Nc                 (   > TR                  U5        g r8   )r^   )r_   rn   rb   s     r;   r^   1snapshot_download.<locals>._AggregatedTqdm.update  s    !!!$r=   r9   )r   )__name__
__module____qualname____firstlineno____doc__rc   rf   rl   r   r   intfloatr^   __static_attributes__)rb   s   r;   _AggregatedTqdmrZ     s=    	
	/			%HU3:%67 	% 	% 	%r=   ry   	repo_filer6   c                 X   > TR                  [        T4U TTTTTT	T
TTTTTTTS.65        g )N)filenamer#   r$   r3   r%   r&   r'   r(   r)   r*   r+   r,   r2   r1   r4   )appendr   )rz   ry   r%   commit_hashr4   r3   r*   r+   r2   r'   r(   r&   r5   r#   resultsr,   r)   s    r;   _inner_hf_hub_download1snapshot_download.<locals>._inner_hf_hub_download  sL    "#$!##) /%)-*!	
r=   )rR   r0   r1   zDownload completec              3   B   #    U  H  n[        U[        5      v   M     g 7fr8   )rE   r   )rG   rs     r;   rI   rJ     s     B'Q:a00's   ):r   HF_HUB_CACHEDEFAULT_REVISIONrE   r   str
REPO_TYPES
ValueErrorospathjoinr   r   	repo_infohttpx
ProxyErrorConnectErrorTimeoutExceptionr   r   r   r   r   matchexistsopenreadis_diranyiterdirloggerwarningresolver   r   r   responsestatus_codeshasiblingsrF   lenLARGE_REPO_THRESHOLDinfolist_repo_treer   listmakedirsdirnamewriteOSErrorhf_tqdmr   getEffectiveLevelr   set_descriptionallrealpath)%r5   r#   r$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   storage_folderapir   api_call_errorerrorref_pathrH   snapshot_folder
repo_filesunreliable_nb_filesfiltered_repo_files	tqdm_descer   ry   rb   r~   r   s%   `` ````````     ```              @@@@r;   r<   r<   h   s   V **	--)T""	N			,,,.yk9TUXYbYmYmUnTopqqWW\\)-=gYb-cdN
!'C AEI*.N	gU]^I>  S!"
 ""8,,"Kww||NFHEHww~~h''(^q"#&&(K $ "y'8 ggll>;TOww~~o.. '&  YI!!c)*;*;*=&>&>4YK?{  }K  |L  LN  O 9,,.//)5 
 (<==)> "	"
 )@.(QRR~~66>;R;R;^;^be;e !  *" "	" ==$`&``$ NWM_M_Mki6H6H I6H6H IqsJd"tc)*<*<&=&Btc)J\J\F]`tFt  o	

''4RZfo'p

 *=%'* "#67$7 89@	(	 9,	--Kggll>;LO ;77<<A	[KK1DAh$$ %
 13G &wJ
  0 6+C+C+EF0N% %>
# 
$ 
 
 
,  ""#67B'BBBBB277##I.//A  	""E$:$:<PQ 	 #N$ 	 	 #N	B $^f !JJ %$ 	[NNH
RTUVTWWXYZZ	[sl   U  3W	W9>W5 7W#	W5  =W	V%%W	<WW	
W#
W2-W5 2W5 5
X&?X!!X&)8r   pathlibr   typingr   r   r   r   r   r	   r   	tqdm.autor
   	base_tqdmtqdm.contrib.concurrentr    r   errorsr   r   r   r   r   r   file_downloadr   r   r   r   hf_apir   r   r   r   r   utilsr   r   r   r    r!   r   
get_loggerrq   r   r   DEFAULT_ETAG_TIMEOUTr   dictrw   boolr   rv   typer<   r9   r=   r;   <module>r      s   	  E E  ' .   ` _ F F m m " 
		H	%  
  $"(,(,"&%)-1#88 (,"6:7;,0(,"#) } sm	
 S$_% S$_% 3- c] tSy)*   E$)$%  U49c>23 eDIsN34  !" i)#$ d38n%%& sm'( U^)* 	+ 
0 
  $"(,(,"&%)-1#88 (,"6:7;,0(,"!) } sm	
 S$_% S$_% 3- c] tSy)*   E$)$%  U49c>23 eDIsN34  !" i)#$ d38n%%& sm'( T])* 
.+ 
0 
  $"(,(,"&%)-1#88 (,"6:7;,0(,")++ }+ sm	+
 S$_%+ S$_%+ 3-+ c]+ tSy)*+ + + E$)$%+ + U49c>23+ eDIsN34+  !+" i)#+$ d38n%%+& sm'+( )+* 3^$$%++ 
+0   $"(,(,"&%)-1#88 (,"6:7;,0(,")hh }h sm	h
 S$_%h S$_%h 3-h c]h tSy)*h h h E$)$%h h U49c>23h eDIsN34h  !h" i)#h$ d38n%%h& sm'h( )h* 3^$$%+h hr=   