
    HTh                     X   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  S SKJ	r	  S SK
JrJrJrJrJrJrJr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  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'  \"RP                  " \)5      r* " S S5      r+S\\,\	4   S\-4S jr.S\\,\	4   S\,S\-4S jr/S\\,\	4   S\-4S jr0S\\,\	4   S\-4S jr1S\\,\	4   S\-4S jr2S"S\,S\\,\	S4   S\\,   4S jjr3S\\,\	4   S\-4S jr4S#S\\,\	4   S\\,   S\54S jjr6 " S S\5      r7\S 5       r8 " S  S!5      r9g)$    N)contextmanager)Path)CallableDictIteratorListOptionalTuple	TypedDictUnion)urlparse)	constants)metadata_loadmetadata_save   )HfApirepo_type_and_id_from_hf_id)LFS_MULTIPART_UPLOAD_COMMAND)SoftTemporaryDirectory	get_tokenloggingrun_subprocesstqdmvalidate_hf_hub_args)_deprecate_methodc                       \ rS rSrSr SS\S\S\S\R                  S\	\   4
S	 jjr
\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       r\S
\4S j5       rS rSrg)CommandInProgress   z5
Utility to follow commands launched asynchronously.
Ntitleis_done_methodstatus_methodprocesspost_methodc                 \    Xl         X l        X0l        X@l        SU l        SU l        XPl        g )N )r   _is_done_status_process_stderr_stdout_post_method)selfr   r    r!   r"   r#   s         R/var/www/auris/envauris/lib/python3.13/site-packages/huggingface_hub/repository.py__init__CommandInProgress.__init__$   s,     
&$'    returnc                 |    U R                  5       nU(       a$  U R                  b  U R                  5         SU l        U$ )z
Whether the process is done.
N)r&   r+   )r,   results     r-   is_doneCommandInProgress.is_done4   s6    
 d''3 $Dr0   c                 "    U R                  5       $ )z
The exit code/status of the current action. Will return `0` if the
command has completed successfully, and a number between 1 and 255 if
the process errored-out.

Will return -1 if the command is still ongoing.
)r'   r,   s    r-   statusCommandInProgress.statusA   s     ||~r0   c                      U R                   S:  $ )z"
Whether the process errored-out.
r   )r8   r7   s    r-   failedCommandInProgress.failedL   s    
 {{Qr0   c                     U R                   R                  b7  U =R                  U R                   R                  R                  5       -  sl        U R                  $ )z3
The current output message on the standard error.
)r(   stderrr)   readr7   s    r-   r>   CommandInProgress.stderrS   ?    
 ==+LLDMM005577L||r0   c                     U R                   R                  b7  U =R                  U R                   R                  R                  5       -  sl        U R                  $ )z4
The current output message on the standard output.
)r(   stdoutr*   r?   r7   s    r-   rC   CommandInProgress.stdout\   rA   r0   c           	          U R                   nUS:X  a  SnSU R                   SU SU R                  (       d  SOS SU R                  R                   S	3	$ )
Nrunning[z command, status code: z, zin progress.z	finished.z PID: ])r8   r   r4   r(   pid)r,   r8   s     r-   __repr__CommandInProgress.__repr__e   s`    R<F 

|26( ;&*llD E!!"!%	
r0   )r&   r+   r(   r'   r)   r*   r   N)__name__
__module____qualname____firstlineno____doc__strr   
subprocessPopenr	   r.   propertyboolr4   intr8   r;   r>   rC   rK   __static_attributes__ r0   r-   r   r      s     +/(( !(  	(
 !!( h'(  
 
 
            

r0   r   folderr1   c                 .   [         R                  R                  [         R                  R                  U S5      5      n[        R
                  " SR                  5       U [        R                  [        R                  S9nU=(       a    UR                  S:H  $ )z
Check if the folder is the root or part of a git repository

Args:
    folder (`str`):
        The folder in which to run the command.

Returns:
    `bool`: `True` if the repository is part of a repository, `False`
    otherwise.
z.gitz
git branch)cwdrC   r>   r   )	ospathexistsjoinrT   runsplitPIPE
returncode)r[   folder_exists
git_branchs      r-   is_git_reporh   r   sc     GGNN277<<#?@M 2 2 4&akapapqJ7Z22a77r0   
remote_urlc                     [        U 5      (       d  g[        SU 5      R                  n[        R                  " SSU5      nUR                  5        Vs/ s H  n[        R                  " SSU5      PM     nnX;   $ s  snf )aE  
Check if the folder is a local clone of the remote_url

Args:
    folder (`str` or `Path`):
        The folder in which to run the command.
    remote_url (`str`):
        The url of a git repository.

Returns:
    `bool`: `True` if the repository is a local clone of the remote
    repository specified, `False` otherwise.
Fzgit remote -vhttps://.*@https://)rh   r   rC   resubrc   )r[   ri   remotesremotes       r-   is_local_clonerq      sn     v_f5<<G 
J?JHOXfrvvnj&9GX   Ys   "A:filenamec                 6   [        U 5      R                  n[        U 5      R                  n  [        SR	                  5       U /-   U5      nUR
                  R                  5       n[        U5      S:X  a  gSSSS.nUR	                  S5       H-  nUR                  5        H  nXv;   d  M
  SU;   d  M  SXW'   M     M/     [        UR                  5       5      $ ! [        R                   a/  n[        U5      (       d   SnAg[        UR                  5      eSnAff = f)	z
Check if the file passed is tracked with git-lfs.

Args:
    filename (`str` or `Path`):
        The filename to check.

Returns:
    `bool`: `True` if the file passed is tracked with git-lfs, `False`
    otherwise.
zgit check-attr -aNFr   )diffmergefilter
lfsT)r   parentnamer   rc   rC   striprT   CalledProcessErrorrh   OSErrorr>   lenkeysallvalues)rr   r[   p
attributesexcfound_lfs_tag	attributetags           r-   is_tracked_with_lfsr      s     (^""FH~""H&.446(CVLXX^^%
 :!"UeDM%%d+	 %%'CEY$6%)" ( ,
 }##%&&! (( &6""#**%%	&s   8C D)D>DDc                 ,   [        U 5      R                  n[        U 5      R                  n  [        SR	                  5       U /-   USS9n[        UR                  5      (       + nU$ ! [        R                   a  n[        UR                  5      eSnAff = f)z
Check if file is git-ignored. Supports nested .gitignore files.

Args:
    filename (`str` or `Path`):
        The filename to check.

Returns:
    `bool`: `True` if the file passed is ignored by `git`, `False`
    otherwise.
zgit check-ignoreFcheckN)r   ry   rz   r   rc   rW   re   rT   r|   r}   r>   )rr   r[   r   
is_ignoredr   s        r-   is_git_ignoredr      s     (^""FH~""H"-335
BFRWXall++
  (( "cjj!!"s   7A% %B9BBc           	          [        U S5       nUR                  S5      nSSS5        [        1 Sk[        [	        SS5      5      S1-
  -  5      n[        WR                  SU5      5      $ ! , (       d  f       NP= f! [         a     gf = f)	z
Check if file is a binary file.

Args:
    filename (`str` or `Path`):
        The filename to check.

Returns:
    `bool`: `True` if the file passed is a binary file, `False` otherwise.
rbi   N>         	   
                      T)openr?   	bytearraysetrangerW   	translateUnicodeDecodeError)rr   fcontent
text_charss       r-   is_binary_filer      s    	(D!Qff^,G "
 83uT5?Q;RVZU[;[[\
G%%dJ788 "!  s(   A; A*A	A; *
A84A; ;
BBpatternc                 R    [        SR                  5       U /-   U5      n[        UR                  R	                  5       5      (       a+  UR                  R	                  5       R                  S5      nU$ / n U$ ! [
        R                   a  n[        UR                  5      eSnAff = f)a-  
Returns a list of filenames that are to be staged.

Args:
    pattern (`str` or `Path`):
        The pattern of filenames to check. Put `.` to get all files.
    folder (`str` or `Path`):
        The folder in which to run the command.

Returns:
    `List[str]`: List of files that are to be staged.
z#git ls-files --exclude-standard -morw   N)	r   rc   r~   rC   r{   rT   r|   EnvironmentErrorr>   )r   r[   r   filesr   s        r-   files_to_be_stagedr      s    +@FFHG9TV\]qxx~~  HHNN$**40E L	 E L (( +szz**+s   A/A8 3A8 8B&B!!B&c                      [        SU 5        g! [        R                   a%  nSUR                  ;   a  [	        S5      e SnAgSnAff = f)z
Check if the current checked-out branch is tracked upstream.

Args:
    folder (`str` or `Path`):
        The folder in which to run the command.

Returns:
    `bool`: `True` if the current checked-out branch is tracked upstream,
    `False` otherwise.
z4git rev-parse --symbolic-full-name --abbrev-ref @{u}THEADzNo branch checked outNF)r   rT   r|   r>   r}   )r[   r   s     r-   is_tracked_upstreamr   
  sF    MvV(( SZZ122	s    AAAupstreamc                      [        SU=(       d    S 3U 5      n[        UR                  R                  S5      5      S-
  $ ! [        R
                   a  n[        UR                  5      eSnAff = f)a  
    Check the number of commits that would be pushed upstream

    Args:
        folder (`str` or `Path`):
            The folder in which to run the command.
        upstream (`str`, *optional*):
The name of the upstream repository with which the comparison should be
made.

    Returns:
        `int`: Number of commits that would be pushed upstream were a `git
        push` to proceed.
zgit cherry -v r%   rw   r   N)r   r~   rC   rc   rT   r|   r   r>   )r[   r   r3   r   s       r-   commits_to_pushr      sc    +.R0@ A6J6==&&t,-11(( +szz**+s   >A A/A**A/c                   *    \ rS rSr% \\S'   \\S'   Srg)PbarTi6  bar
past_bytesrZ   N)rN   rO   rP   rQ   r   __annotations__rX   rY   rZ   r0   r-   r   r   6  s    	IOr0   r   c               #   B  #    [         R                  5       [        R                  :  a   Sv   gS[
        R                  4S jn [        R                  R                  SS5      n[        5        n[        R                  R                  US5      [        R                  S'   [         R                  S[        R                  S    35        [
        R                  " 5       n[
        R                  " X4SS	9nUR                  5          Sv   UR!                  5         UR                  5         U[        R                  S'    SSS5        g! [         a     gf = f! UR!                  5         UR                  5         U[        R                  S'   f = f! , (       d  f       g= f7f)
zj
This is a context manager that will log the Git LFS progress of cleaning,
smudging, pulling and pushing.
Nstopping_eventc                 P  ^ ^^ 0 mU4S jmS[         [           4UU 4S jjn[        R                  R	                  [        R
                  S   5      (       dj  T R                  5       (       a  T" 5         g[        R                  " S5        [        R                  R	                  [        R
                  S   5      (       d  Mj  U" [        R
                  S   5       H  n UR                  5       u  p4pVUR                  5        SU 3nUR                  S	5      u  p[        U	5      n[        U
5      nTR                  X645      nUc!  [        UUUS
SSSS9[        U	5      S.TX64'   M  US   R                  XS   -
  5        XS'   M     g! [         a  n[        SU 35      UeSnAff = f)zT
To be launched as a separate thread with an event meaning it should stop
the tail.
c                     > TR                  5        HP  n U S   R                  U S   R                  U S   -
  5        U S   R                  5         U S   R	                  5         MR     g )Nr   r   )r   updatetotalrefreshclose)pbarpbarss    r-   close_pbars?_lfs_log_progress.<locals>.output_progress.<locals>.close_pbarsR  sY    U""4;#4#4tL7I#IJU##%U!!# 'r0   r1   c              3   l  >#    [        U S5       nSn TR                  5       (       a  T" 5         OiUR                  5       nUb>  [        UR	                  5       5      S:X  d!  X#-  nUR                  S5      (       a  Uv   SnO[        R                  " S5        M  SSS5        g! , (       d  f       g= f7f)z
Creates a generator to be iterated through, which will return each
line one by one. Will stop tailing the file if the stopping_event is
set.
rr%   Nr   rw   r   )r   is_setreadliner~   r{   endswithtimesleep)rr   filecurrent_lineline_bitr   r   s       r-   	tail_file=_lfs_log_progress.<locals>.output_progress.<locals>.tail_fileX  s      h$!%,,..##}}H+C8H4IQ4N$0'0066"..+-L

1  %$$s   B4B
B#	B4#
B1-B4GIT_LFS_PROGRESSN   z!Cannot unpack LFS progress line:
z file /BTi   zhuggingface_hub.lfs_upload)descinitialr   unit
unit_scaleunit_divisorrz   )r   r   r   r   )r   rS   r^   r_   r`   environr   r   r   rc   
ValueError
capitalizerX   getr   r   )r   r   linestatefile_progressbyte_progressrr   errordescriptioncurrent_bytestotal_bytescurrent_bytes_inttotal_bytes_intr   r   r   s   `             @@r-   output_progress*_lfs_log_progress.<locals>.output_progressJ  s    /1	$	&8C= 	& 	&0 ''..,>!?@@$$&&JJqM ''..,>!?@@ bjj);<=DY@D

=m #--/0xjAK)6)<)<S)A&M #M 2!+.O99e./D|  ( 1- #'%)9 #&m"4,u'( U""#4L7I#IJ%6\"= >  Y #EdV!LMSXXYs   F
F%F  F%r   r%   lfs_progresszFollowing progress in T)targetargsdaemon)loggergetEffectiveLevelr   ERROR	Exception	threadingEventr^   r   r   r   r_   ra   debugThreadstartr   )r   current_lfs_progress_valuetmpdir
exit_eventxs        r-   _lfs_log_progressr   <  s<     !W]]2	 	K7	 K7Z "$0BB!G		!V)+fn)M

%&-bjj9K.L-MNO__&
O-PTU			HNNFFH-GBJJ)* 
"	!g  		| NNFFH-GBJJ)* 
"	!sY   'FE A F.BFE	3F=	F
EFEF5FF
FFc                      \ rS rSr% Sr\\   \S'   \\	" SSS9        SFS\
\\4   S	\\   S
\\   S\
\\4   S\\   S\\   S\\   S\S\\   4S jj5       5       r\S\4S j5       rS r\SGS\S\
\\S4   4S jj5       rSHS\\   S\\   4S jjrS rS\4S jrS\4S jrS\4S jrS\\   4S jrSIS\
\\\   4   S\4S jjrS\
\\\   4   4S  jrS! rSJS"\S\\   4S# jjrSJS"\S\\   4S$ jjrSIS% jr SKS&\S'\4S( jjr!SLS"\S)\4S* jjr"SMS+\4S, jjr#   SNS-\\   S.\S/\S\
\\$\\4   4   4S0 jjr%SIS\S1\4S2 jjr&SGS3\S4\\   S\4S5 jjr'SGS3\S4\\   S\4S6 jjr(SHS3\S7\\   S4\\   4S8 jjr)S\4S9 jr*    SOS+\S.\S:\S/\S\
S\\$\\4   4   4
S; jjr+\,    SPS+\S<\\   S=\S.\S/\4
S> jj5       r-S\\.   4S? jr/S@\.SS4SA jr0\SB 5       r1\SC 5       r2SD r3SEr4g)Q
Repositoryi  a&  
Helper class to wrap the git and git-lfs commands.

The aim is to facilitate interacting with huggingface.co hosted model or
dataset repos, though not a lot here (if any) is actually specific to
huggingface.co.

<Tip warning={true}>

[`Repository`] is deprecated in favor of the http-based alternatives implemented in
[`HfApi`]. Given its large adoption in legacy code, the complete removal of
[`Repository`] will only happen in release `v1.0`. For more details, please read
https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http.

</Tip>
command_queuez1.0zPlease prefer the http-based alternatives instead. Given its large adoption in legacy code, the complete removal is only planned on next major release.
For more details, please read https://huggingface.co/docs/huggingface_hub/concepts/git_vs_http.)versionmessageN	local_dir
clone_from	repo_typetokengit_user	git_emailrevisionskip_lfs_filesclientc
                    [        U[        5      (       a  [        U5      n[        R                  " USS9  [        R
                  R                  [        R                  " 5       U5      U l        X0l	        / U l
        Xl        U	b  U	O	[        5       U l        U R                  5         [        U[        5      (       a  X@l        OUSL a  SU l        O[!        5       U l        Ub  U R#                  US9  O;[%        U R                  5      (       a  [&        R)                  S5        O[+        S5      eU R                  bS  Ub  UcM  U R                  R-                  U R                  5      n
Uc  U
R/                  S5      nUc  U
R/                  S	5      nUc  Ub  U R1                  XV5        U R3                  5         U R5                  5         Ub  U R7                  USS
9  [8        R:                  " U R<                  5        g)a  
Instantiate a local clone of a git repo.

If `clone_from` is set, the repo will be cloned from an existing remote repository.
If the remote repo does not exist, a `EnvironmentError` exception will be thrown.
Please create the remote repo first using [`create_repo`].

`Repository` uses the local git credentials by default. If explicitly set, the `token`
or the `git_user`/`git_email` pair will be used instead.

Args:
    local_dir (`str` or `Path`):
        path (e.g. `'my_trained_model/'`) to the local directory, where
        the `Repository` will be initialized.
    clone_from (`str`, *optional*):
        Either a repository url or `repo_id`.
        Example:
        - `"https://huggingface.co/philschmid/playground-tests"`
        - `"philschmid/playground-tests"`
    repo_type (`str`, *optional*):
        To set when cloning a repo from a repo_id. Default is model.
    token (`bool` or `str`, *optional*):
        A valid authentication token (see https://huggingface.co/settings/token).
        If `None` or `True` and machine is logged in (through `huggingface-cli login`
        or [`~huggingface_hub.login`]), token will be retrieved from the cache.
        If `False`, token is not sent in the request header.
    git_user (`str`, *optional*):
        will override the `git config user.name` for committing and
        pushing files to the hub.
    git_email (`str`, *optional*):
        will override the `git config user.email` for committing and
        pushing files to the hub.
    revision (`str`, *optional*):
        Revision to checkout after initializing the repository. If the
        revision doesn't exist, a branch will be created with that
        revision name from the default branch's current HEAD.
    skip_lfs_files (`bool`, *optional*, defaults to `False`):
        whether to skip git-LFS files or not.
    client (`HfApi`, *optional*):
        Instance of [`HfApi`] to use when calling the HF Hub API. A new
        instance will be created if this is left to `None`.

Raises:
    [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
        If the remote repository set in `clone_from` does not exist.
T)exist_okNF)repo_urlz [Repository] is a valid git repozNIf not specifying `clone_from`, you need to pass Repository a valid git clone.emailfullnamecreate_branch_ok)
isinstancer   rS   r^   makedirsr_   ra   getcwdr   
_repo_typer   r  r   r  check_git_versionshuggingface_tokenr   r   rh   r   r   r   whoamir   git_config_username_and_emaillfs_enable_largefilesgit_credential_helper_storegit_checkoutatexitregisterwait_for_commands)r,   r   r   r   r   r   r  r  r  r  users              r-   r.   Repository.__init__  s   F i&&II
I-biik9=#, & 2f!eS!!49"e^%)D" &/[D"!OOZO04>>**?@ !qrr!!-93DHX;;%%d&<&<=D  HHW-	88J/9#8..xC""$((*h> 	../r0   r1   c                      [        SU R                  5      R                  R                  5       nU$ ! [        R
                   a  n[        UR                  5      eSnAff = f)zZ
Returns the current checked out branch.

Returns:
    `str`: Current checked out branch.
zgit rev-parse --abbrev-ref HEADNr   r   rC   r{   rT   r|   r   r>   )r,   r3   r   s      r-   current_branchRepository.current_branch3  sU    	/#$Et~~V]]cceF  ,, 	/"3::..	/s   .2 A AA c                 Z    [        SU R                  5      R                  R                  5       n [        SU R                  5      R                  R                  5       n[        R                  US-   U-   5        g! [         a    [        S5      ef = f! [         a    [        S5      ef = f)z
Checks that `git` and `git-lfs` can be run.

Raises:
    [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
        If `git` or `git-lfs` are not installed.
zgit --versionz9Looks like you do not have git installed, please install.zgit-lfs --versionzLooks like you do not have git-lfs installed, please install. You can install from https://git-lfs.github.com/. Then run `git lfs install` (you only have to do this once).rw   N)r   r   rC   r{   FileNotFoundErrorr   r   info)r,   git_versionlfs_versions      r-   r  Repository.check_git_versionsB  s    	`($..IPPVVXK	()<dnnMTTZZ\K 	K$&45 ! 	`"#^__	`
 ! 	"O 	s   .A; .B ;BB*r  c                    [        U[        5      (       a  UOUSL a  SOU R                  nUb!  UR                  S5      (       a  [	        S5      eU R
                  R                  nX1;   d$  SU;  a  [        UR                  S5      5      S::  a  [        XS9u  pEnUb  U SU 3OUnUb  X@l
        US-   nU R                  [        R                  ;   a   U[        R                  U R                     -  nUb0  [        U5      R                  nUR                  U S	3U S
U S35      nX-  n[         R"                  " SSU5      n	 [%        SU R&                  5        [        [(        R*                  " U R&                  5      5      S:X  a  [,        R/                  SU	 S35        [1        5          [(        R2                  R5                  5       n
U R6                  (       a  U
R9                  SS05        [%        U R6                  (       a  SOS SU S3U R&                  U
S9  SSS5        g[;        U R&                  5      (       d&  [=        SU R&                   SU R&                   S35      e[?        U R&                  U5      (       a&  [,        R/                  U R&                   SU	 S35        g[%        SU R&                  SS9nS U	 S!U	 S"3nUR@                  S:X  a*  [         R"                  " S#S$URB                  5      nUS%U 3-  n[=        U5      e! , (       d  f       g= f! [D        RF                   a  n[=        URH                  5      eSnAff = f)&a  
Clone from a remote. If the folder already exists, will try to clone the
repository within it.

If this folder is a git repository with linked history, will try to
update the repository.

Args:
    repo_url (`str`):
        The URL from which to clone the repository
    token (`Union[str, bool]`, *optional*):
        Whether to use the authentication token. It can be:
         - a string which is the token itself
         - `False`, which would not use the authentication token
         - `True`, which would fetch the authentication token from the
           local folder and use it (you should be logged in for this to
           work).
        - `None`, which would retrieve the value of
          `self.huggingface_token`.

<Tip>

Raises the following error:

    - [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
      if an organization token (starts with "api_org") is passed. Use must use
      your own personal access token (see https://hf.co/settings/tokens).

    - [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
      if you are trying to clone the repository in a non-empty folder, or if the
      `git` operations raise errors.

</Tip>
FNapi_orgzgYou must use your personal access token, not an Organization token (see https://hf.co/settings/tokens).httpr   r   )hub_urlz://z://user:@z(https?)://.*@z\1://zgit lfs installr   zCloning z into local empty directory.GIT_LFS_SKIP_SMUDGE1z	git clonezgit lfs clone z .)envzPTried to clone a repository in a non-empty folder that isn't a git repository ('z7'). If you really want to do this, do it manually:
 cd z && git init && git remote add origin && git pull origin main
 or clone repo to a new folder and move your existing files there afterwards.z is already a clone of z?. Make sure you pull the latest changes with `repo.git_pull()`.zgit remote get-url originr   zTried to clone zn in an unrelated git repository.
If you believe this is an error, please add a remote with the following URL: .rk   rl   z'
Local path has its origin defined as: )%r  rS   r  
startswithr   r  endpointr~   rc   r   r  r   REPO_TYPES_URL_PREFIXESr   schemereplacerm   rn   r   r   r^   listdirr   warningr   r   copyr  r   rh   r   rq   re   rC   rT   r|   r>   )r,   r  r   r)  r   	namespace	repo_namerepo_idr3  clean_repo_urlr.  output	error_msgclean_local_remote_urlr   s                  r-   r   Repository.clone_fromY  s8   L %%%  E> ++ 	 !1!1)!<!<8 
 ++&&6#9c(..QTBU>VZ[>[.I(.d+I)4=4I1YK0yG$"+}H)"C"CCI==dooNN !(+22#++vhcNvhhugUV<WXH  18XF5	/,dnn= 2::dnn-.!3.)99UVW&(**//+C**

$93#?@" +/*=*=;?SSTU]T^^`a )(  #4>>22*//3~~.> ?::>..9I J''  "$..(;;NN>>**A.AQ R. . ,,G_deF *.)9 :==K<LAO 
 ((A-13
TZTaTa1b.!'OPfOg%hh	*955W )(Z ,, 	/"3::..	/sF   A&L (A1LL "B L #A#L 
LL L M+M  Mc                     Ub(  [        SR                  5       U/-   U R                  5        Ub(  [        SU 3R                  5       U R                  5        gg! [        R                   a  n[        UR                  5      eSnAff = f)z
Sets git username and email (only in the current repo).

Args:
    git_user (`str`, *optional*):
        The username to register through `git`.
    git_email (`str`, *optional*):
        The email to register through `git`.
Nzgit config user.namezgit config user.email )r   rc   r   rT   r|   r   r>   )r,   r   r  r   s       r-   r  (Repository.git_config_username_and_email  s{    	/#5;;=
JDNN[$!7	{CIIKT^^\ %,, 	/"3::..	/s   AA B-BBc                      [        SU R                  5        g! [        R                   a  n[	        UR
                  5      eSnAff = f)z+
Sets the git credential helper to `store`
z"git config credential.helper storeN)r   r   rT   r|   r   r>   )r,   r   s     r-   r  &Repository.git_credential_helper_store  s;    	/?P,, 	/"3::..	/s    AAAc                      [        SU R                  5      nUR                  R                  5       $ ! [        R
                   a  n[        UR                  5      eSnAff = f)zY
Get commit sha on top of HEAD.

Returns:
    `str`: The current checked out commit SHA.
zgit rev-parse HEADNr  )r,   r   r   s      r-   git_head_hashRepository.git_head_hash  sN    	/3T^^DA88>>##,, 	/"3::..	/s   /2 A AA c                      [        SU R                  5      nUR                  R                  5       n[        R
                  " SSU5      $ ! [        R                   a  n[        UR                  5      eSnAff = f)zP
Get URL to origin remote.

Returns:
    `str`: The URL of the `origin` remote.
z"git config --get remote.origin.urlrk   rl   N)
r   r   rC   r{   rm   rn   rT   r|   r   r>   )r,   r   urlr   s       r-   git_remote_urlRepository.git_remote_url  s`    	/CT^^TA((.."C66.*c::,, 	/"3::..	/s   AA
 
A8A33A8c                     U R                  5       nU R                  5       nUR                  S5      (       a  USS nU SU 3$ )z
Get URL to last commit on HEAD. We assume it's been pushed, and the url
scheme is the same one as for GitHub or HuggingFace.

Returns:
    `str`: The URL to the current checked-out commit.
r   NrF   z/commit/)rE  rI  r   )r,   sharH  s      r-   git_head_commit_urlRepository.git_head_commit_url  sK       "!!#<<cr(Chse$$r0   c                     [        SU R                  5      R                  R                  5       n[        U5      S:X  a  / $ UR                  S5       Vs/ s H  o3R                  5       PM     nnU Vs/ s H  nSUR                  5       S   ;   d  M  UPM      nnU Vs/ s H#  o3R                  5       S   R                  5       PM%     nnU$ ! [        R
                   a  n[        UR                  5      eSnAff = fs  snf s  snf s  snf )z
Returns a list of the files that are deleted in the working directory or
index.

Returns:
    `List[str]`: A list of files that have been deleted in the working
    directory or index.
zgit status -sNr   rw   DrF   
r   r   rC   r{   rT   r|   r   r>   r~   rc   )r,   
git_statusr   r8   modified_files_statusesdeleted_files_statusesdeleted_filess          r-   list_deleted_filesRepository.list_deleted_files  s    	/'HOOUUWJ z?aI AK@P@PQU@V"W@Vf<<>@V"W 8O!k7NVRUY_YeYeYghiYjRj&7N!k CYYBX+113BXY- ,, 	/"3::..	/ #X "l Zs/   .C C=3DD*DC: C55C:patternsrr   c                     [        U[        5      (       a  U/n U H(  n[        SU(       a  SOS SU 3U R                  5        M*     g! [        R
                   a  n[        UR                  5      eSnAff = f)a  
Tell git-lfs to track files according to a pattern.

Setting the `filename` argument to `True` will treat the arguments as
literal filenames, not as patterns. Any special glob characters in the
filename will be escaped when writing to the `.gitattributes` file.

Args:
    patterns (`Union[str, List[str]]`):
        The pattern, or list of patterns, to track with git-lfs.
    filename (`bool`, *optional*, defaults to `False`):
        Whether to use the patterns as literal filenames.
zgit lfs track z
--filenamer%   r-  N)r  rS   r   r   rT   r|   r   r>   )r,   rX  rr   r   r   s        r-   	lfs_trackRepository.lfs_trackB  sr     h$$ zH	/#$X\2$FayQNN $
 ,, 	/"3::..	/s   .A	 	A7A22A7c                     [        U[        5      (       a  U/n U H+  n[        SR                  5       U/-   U R                  5        M-     g! [
        R                   a  n[        UR                  5      eSnAff = f)z
Tell git-lfs to untrack those files.

Args:
    patterns (`Union[str, List[str]]`):
        The pattern, or list of patterns, to untrack with git-lfs.
zgit lfs untrackN)	r  rS   r   rc   r   rT   r|   r   r>   )r,   rX  r   r   s       r-   lfs_untrackRepository.lfs_untrack[  sk     h$$ zH	/#0668G9DdnnU $,, 	/"3::..	/s   1A A: A55A:c                      Sn[        U S3U R                  5        [        U S[         3U R                  5        g! [        R                   a  n[        UR                  5      eSnAff = f)z9
HF-specific. This enables upload support of files >5GB.
z'git config lfs.customtransfer.multipartz.path huggingface-cliz.args N)r   r   r   rT   r|   r   r>   )r,   
lfs_configr   s      r-   r   Repository.lfs_enable_largefilesk  sh    	/BJj\)>?P,f%A$BC ,, 	/"3::..	/s   := A+A&&A+r   c                 8   / nU R                  5       n[        XR                  S9 H  nXC;   a  M
  [        R                  R                  [        R                  " 5       U R                  U5      n[        U5      (       a  MZ  [        U5      (       a  Ml  [        R                  R                  U5      S-  nUS:  a  [        R                  S5        [        U5      nU(       d  M  U R                  U5        UR                  U5        M     U R                  U5        U$ )a  
Automatically track binary files with git-lfs.

Args:
    pattern (`str`, *optional*, defaults to "."):
        The pattern with which to track files that are binary.

Returns:
    `List[str]`: List of filenames that are now tracked due to being
    binary files
r[      r   zParsing a large file to check if binary or not. Tracking large files using `repository.auto_track_large_files` is recommended so as to not load the full file in memory.)rV  r   r   r^   r_   ra   r  r   r   getsizer   r6  r   rZ  appendr]  )r,   r   files_to_be_tracked_with_lfsrU  rr   path_to_file
size_in_mb	is_binarys           r-   auto_track_binary_files"Repository.auto_track_binary_filesy  s     (*$//1*7>>JH(77<<		T^^XNL'559U9UWW__\:kJ
#NNR +<8	9NN8,077A) K. 	'++r0   c                    / nU R                  5       n[        XR                  S9 H  nXC;   a  M
  [        R                  R                  [        R                  " 5       U R                  U5      n[        R                  R                  U5      S-  nUS:  d  Mr  [        U5      (       a  M  [        U5      (       a  M  U R                  U5        UR                  U5        M     U R                  U5        U$ )a(  
Automatically track large files (files that weigh more than 10MBs) with
git-lfs.

Args:
    pattern (`str`, *optional*, defaults to "."):
        The pattern with which to track files that are above 10MBs.

Returns:
    `List[str]`: List of filenames that are now tracked due to their
    size.
rc  rd  r   )rV  r   r   r^   r_   ra   r  re  r   r   rZ  rf  r]  )r,   r   rg  rU  rr   rh  ri  s          r-   auto_track_large_files!Repository.auto_track_large_files  s     (*$//1*7>>JH(77<<		T^^XNL6+FJR(;L(I(IR`amRnRnx(,33H= K 	'++r0   c                 2    [        5          [        SU(       a  SOS 3U R                  5      n[        R	                  UR
                  5        SSS5        g! , (       d  f       g= f! [        R                   a  n[        UR                  5      eSnAff = f)a_  
git lfs prune

Args:
    recent (`bool`, *optional*, defaults to `False`):
        Whether to prune files even if they were referenced by recent
        commits. See the following
        [link](https://github.com/git-lfs/git-lfs/blob/f3d43f0428a84fc4f1e5405b76b5a73ec2437e65/docs/man/git-lfs-prune.1.ronn#recent-files)
        for more information.
zgit lfs prune z--recentr%   N
r   r   r   r   r"  rC   rT   r|   r   r>   )r,   recentr3   r   s       r-   	lfs_pruneRepository.lfs_prune  so    	/"$'.vSU8V(WY]YgYghFMM* %$$ ,, 	/"3::..	/s5   
A( AAA( 
A%!A( %A( (B<BBrebaserx   c                 F   U(       d  SOSnU(       a  US-  n [        5          [        X0R                  5      n[        R	                  UR
                  5        SSS5        g! , (       d  f       g= f! [        R                   a  n[        UR                  5      eSnAff = f)a  
git pull

Args:
    rebase (`bool`, *optional*, defaults to `False`):
        Whether to rebase the current branch on top of the upstream
        branch after fetching.
    lfs (`bool`, *optional*, defaults to `False`):
        Whether to fetch the LFS files too. This option only changes the
        behavior when a repository was cloned without fetching the LFS
        files; calling `repo.git_pull(lfs=True)` will then fetch the LFS
        file from the remote repository.
zgit pullzgit lfs pullz	 --rebaseNrq  )r,   ru  rx   commandr3   r   s         r-   git_pullRepository.git_pull  su     %(*^{"G	/"$'@FMM* %$$ ,, 	/"3::..	/s4   
A2 5A!A2 !
A/+A2 /A2 2B BB auto_lfs_trackc                    U(       aQ  U R                  U5      nUR                  U R                  U5      5        U(       a  [        R	                  SU S35         [        SR                  5       U/-   U R                  5      n[        R                  SUR                   S35        g! [        R                   a  n[        UR                  5      eSnAff = f)a  
git add

Setting the `auto_lfs_track` parameter to `True` will automatically
track files that are larger than 10MB with `git-lfs`.

Args:
    pattern (`str`, *optional*, defaults to "."):
        The pattern with which to add files to staging.
    auto_lfs_track (`bool`, *optional*, defaults to `False`):
        Whether to automatically track large and binary files with
        git-lfs. Any file over 10MB in size, or in binary format, will
        be automatically tracked.
z!Adding files tracked by Git LFS: z5. This may take a bit of time if the files are large.z
git add -vzAdding to index:
rw   N)rn  extendrk  r   r6  r   rc   r   r"  rC   rT   r|   r   r>   )r,   r   rz  tracked_filesr3   r   s         r-   git_addRepository.git_add  s      77@M   !=!=g!FG7 G; ;
	/#L$6$6$8G9$DdnnUFKK,V]]O2>?,, 	/"3::..	/s   AB& &C:CCcommit_messagec                 Z    [        SR                  5       U/-   U R                  5      n[        R	                  SUR
                   S35        g! [        R                   aH  n[        UR                  5      S:  a  [        UR                  5      e[        UR
                  5      eSnAff = f)z
git commit

Args:
    commit_message (`str`, *optional*, defaults to "commit files to HF hub"):
        The message attributed to the commit.
zgit commit -v -mzCommitted:
rw   r   N)r   rc   r   r   r"  rC   rT   r|   r~   r>   r   )r,   r  r3   r   s       r-   
git_commitRepository.git_commit  s    	3#$6$<$<$>.AQ$QSWSaSabFKK,v}}oR89,, 	33::"&szz22&szz22		3s   AA B*"AB%%B*r   blockingauto_lfs_prunec           	         ^ SnU(       a  USU 3-  n[        U R                  U5      nUS:  a5  [        R                  SU S35        U(       a  [        R                  S5         [	        5          [
        R                  " UR                  5       [
        R                  [
        R                  SU R                  S9mU(       a~  TR                  5       u  pgTR                  5       nTR                  5         [        U5      (       a  [        R                  U5        U(       a   [
        R                  " UTR                  XgS	9eS
S
S
5        U(       dW  U4S jn
[#        SU4S jU
TU(       a  U R$                  OS
S9nU R&                  R)                  U5        U R+                  5       U4$ U(       a  U R%                  5         U R+                  5       $ ! , (       d  f       N= f! [
        R                   a  n	[        U	R                   5      eS
n	A	ff = f)a  
git push

If used without setting `blocking`, will return url to commit on remote
repo. If used with `blocking=True`, will return a tuple containing the
url to commit and the command object to follow for information about the
process.

Args:
    upstream (`str`, *optional*):
        Upstream to which this should push. If not specified, will push
        to the lastly defined upstream or to the default one (`origin
        main`).
    blocking (`bool`, *optional*, defaults to `True`):
        Whether the function should return only when the push has
        finished. Setting this to `False` will return an
        `CommandInProgress` object which has an `is_done` property. This
        property will be set to `True` when the push is finished.
    auto_lfs_prune (`bool`, *optional*, defaults to `False`):
        Whether to automatically prune files once they have been pushed
        to the remote.
zgit pushz --set-upstream r   zSeveral commits (z) will be pushed upstream.z$The progress bars may be unreliable.zutf-8)r>   rC   encodingr]   )r<  r>   Nc                  0   > TR                  5       n U c  gU $ )NrF   poll)r8   r"   s    r-   r!   *Repository.git_push.<locals>.status_methodd  s     >!Mr0   pushc                  (   > T R                  5       S L$ rM   r  )r"   s   r-   <lambda>%Repository.git_push.<locals>.<lambda>m  s    w||~T'Ar0   )r    r!   r"   r#   )r   r   r   r6  r   rT   rU   rc   rd   communicater  killr~   r|   r   r   r>   r   rs  r   rf  rM  )r,   r   r  r  rw  number_of_commitsrC   r>   return_coder   r!   command_in_progressr"   s               @r-   git_pushRepository.git_push"  s   8 )(44G+DNNHEq NN./@.AA[\]EF	/"$$**MMO%??%??$ %,%8%8%:NF"),,.KLLN6{{v."(;;K^dtt% %. " #4A+.<DNN$# %%&9:++-/BBBNN''))_ %$( ,, 	/"3::..	/s7   %
G /CGG 
GG G H3HHr  c                 H    [        SU 3U R                  5      n[        R                  SU SU R                   S35        [        R                  UR
                  5        g	! [        R                   a  nU(       d  [        UR                  5      e [        SU 3U R                  5      n[        R                  SU SU S35        [        R                  UR
                  5         S	nAg	! [        R                   a  n[        UR                  5      eS	nAff = fS	nAff = f)
a  
git checkout a given revision

Specifying `create_branch_ok` to `True` will create the branch to the
given revision if that revision doesn't exist.

Args:
    revision (`str`):
        The revision to checkout.
    create_branch_ok (`str`, *optional*, defaults to `False`):
        Whether creating a branch named with the `revision` passed at
        the current checked-out reference if `revision` isn't an
        existing revision is allowed.
zgit checkout zChecked out z from r/  zgit checkout -b z
Revision `z2` does not exist. Created and checked out branch `z`.N)
r   r   r   r6  r  rC   rT   r|   r   r>   )r,   r  r  r3   r   s        r-   r  Repository.git_checkout|  s    	7#mH:$>OFNN\(6$:M:M9NaPQNN6==),, 	7#&szz227+.>xj,I4>>ZFNN$XJ.`ai`jjlm NN6==11!44 7*3::667	7s7   AA! !D!5DAC++D?DDDD!tag_namerp   c                    U(       a@   [        SU 3U R                  5      R                  R                  5       n[        U5      S:g  $  [        SU R                  5      R                  R                  5       nUR                  S5      nX;   $ ! [        R
                   a  n[        UR                  5      eSnAff = f! [        R
                   a  n[        UR                  5      eSnAff = f)a'  
Check if a tag exists or not.

Args:
    tag_name (`str`):
        The name of the tag to check.
    remote (`str`, *optional*):
        Whether to check if the tag exists on a remote. This parameter
        should be the identifier of the remote.

Returns:
    `bool`: Whether the tag exists.
zgit ls-remote origin refs/tags/Nr   zgit tagrw   rQ  )r,   r  rp   r3   r   git_tagss         r-   
tag_existsRepository.tag_exists  s     3'*I((TVZVdVdellrrt v;!##3))T^^DKKQQS  ~~d+H'' 00 3&szz223 00 3&szz223s/   1B 	.B= B: B55B:=C+C&&C+c                 (   SnSnU R                  U5      (       d  SnU R                  XS9(       d  SnU(       a3   [        SSSU/U R                  5      R                  R	                  5         U(       a=  U(       a6   [        SU S	U 3U R                  5      R                  R	                  5         gg! [
        R                   a  n[        UR                  5      eSnAff = f! [
        R                   a  n[        UR                  5      eSnAff = f)
aH  
Delete a tag, both local and remote, if it exists

Args:
    tag_name (`str`):
        The tag name to delete.
    remote (`str`, *optional*):
        The remote on which to delete the tag.

Returns:
     `bool`: `True` if deleted, `False` if the tag didn't exist.
        If remote is not passed, will just be updated locally
TF)rp   gitr   z-dN	git push z
 --delete )	r  r   r   rC   r{   rT   r|   r   r>   )r,   r  rp   delete_locallydelete_remotelyr   s         r-   
delete_tagRepository.delete_tag  s     x(("Nx7#O3udH=t~~NUU[[] o36(*XJGX__eeg  00 3&szz223 00 3&szz223s/   2B2 <4C# 2C CC #D7DDr   c                    U(       a	  SSSUSU/nOSSU/n [        X@R                  5      R                  R                  5         U(       a6   [        SU SU 3U R                  5      R                  R                  5         gg! [        R
                   a  n[        UR                  5      eSnAff = f! [        R
                   a  n[        UR                  5      eSnAff = f)a  
Add a tag at the current head and push it

If remote is None, will just be updated locally

If no message is provided, the tag will be lightweight. if a message is
provided, the tag will be annotated.

Args:
    tag_name (`str`):
        The name of the tag to be added.
    message (`str`, *optional*):
        The message that accompanies the tag. The tag will turn into an
        annotated tag if a message is passed.
    remote (`str`, *optional*):
        The remote on which to add the tag.
r  r   z-az-mNr  r-  r  )r,   r  r   rp   tag_argsr   s         r-   add_tagRepository.add_tag  s    $ udHdGDHuh/H	/8^^4;;AAC 36(!H:>OVV\\^  ,, 	/"3::..	/ 00 3&szz223s/   -B 4B3 B0B++B03C!CC!c                      [        SU R                  5      R                  R                  5       n[        U5      S:H  $ ! [        R
                   a  n[        UR                  5      eSnAff = f)z
Return whether or not the git status is clean or not

Returns:
    `bool`: `True` if the git status is clean, `False` otherwise.
zgit status --porcelainNr   )	r   r   rC   r{   rT   r|   r   r>   r~   )r,   rR  r   s      r-   is_repo_cleanRepository.is_repo_clean  s_    	/'(@$..QXX^^`J :!## ,, 	/"3::..	/s   .> A,A''A,clean_okc                     U(       a+  U R                  5       (       a  [        R                  S5        gU R                  SS9  U R	                  U5        U R                  SU R                   3UUS9$ )a  
Helper to add, commit, and push files to remote repository on the
HuggingFace Hub. Will automatically track large files (>10MB).

Args:
    commit_message (`str`):
        Message to use for the commit.
    blocking (`bool`, *optional*, defaults to `True`):
        Whether the function should return only when the `git push` has
        finished.
    clean_ok (`bool`, *optional*, defaults to `True`):
        If True, this function will return None if the repo is
        untouched. Default behavior is to fail because the git command
        fails.
    auto_lfs_prune (`bool`, *optional*, defaults to `False`):
        Whether to automatically prune files once they have been pushed
        to the remote.
z*Repo currently clean. Ignoring push_to_hubNTrz  origin r   r  r  )r  r   r"  r~  r  r  r  )r,   r  r  r  r  s        r-   push_to_hubRepository.push_to_hub  sl    2 **,,KKDED)'}}t2234)  
 	
r0   branchtrack_large_filesc              #   <  #    [        SU R                  S9n[        U5      (       aG  [        U5      S:  a  [        USS 5      SS S-   O
[        U5      n[        R                  SU S35        Ub  U R                  US	S
9  [        U R                  5      (       a%  [        R                  S5        U R                  S	S9  O#[        R                  SU R                   S35        [        R                  " 5       n[        R                  " [        R                  R                  XR                  5      5         U v   U R!                  US9   U R#                  U5         U R'                  SU R                   3UUS9  [        R                  " U5        g! [$         a  n	S[        U	5      ;  a  U	e Sn	A	NVSn	A	ff = f! [$         a"  n	S[        U	5      ;   a  [%        S5      U	eU	eSn	A	ff = f! U R!                  US9   U R#                  U5        O(! [$         a  n	S[        U	5      ;  a  U	e Sn	A	OSn	A	ff = f U R'                  SU R                   3UUS9  O/! [$         a"  n	S[        U	5      ;   a  [%        S5      U	eU	eSn	A	ff = f[        R                  " U5        f = f7f)aU  
Context manager utility to handle committing to a repository. This
automatically tracks large files (>10Mb) with git-lfs. Set the
`track_large_files` argument to `False` if you wish to ignore that
behavior.

Args:
    commit_message (`str`):
        Message to use for the commit.
    branch (`str`, *optional*):
        The branch on which the commit will appear. This branch will be
        checked-out before any operation.
    track_large_files (`bool`, *optional*, defaults to `True`):
        Whether to automatically track large files or not. Will do so by
        default.
    blocking (`bool`, *optional*, defaults to `True`):
        Whether the function should return only when the `git push` has
        finished.
    auto_lfs_prune (`bool`, defaults to `True`):
        Whether to automatically prune files once they have been pushed
        to the remote.

Examples:

```python
>>> with Repository(
...     "text-files",
...     clone_from="<user>/text-files",
...     token=True,
>>> ).commit("My first file :)"):
...     with open("file.txt", "w+") as f:
...         f.write(json.dumps({"hey": 8}))

>>> import torch

>>> model = torch.nn.Transformer()
>>> with Repository(
...     "torch-model",
...     clone_from="<user>/torch-model",
...     token=True,
>>> ).commit("My cool model :)"):
...     torch.save(model.state_dict(), "model.pt")
```

r/  rc     NrF   z, ...]zPThere exists some updated files in the local repository that are not committed: z|. This may lead to errors if checking out a branch. These files and their modifications will be added to the current commit.Tr
  zPulling changes ...)ru  z@The current branch has no upstream branch. Will push to 'origin 'r  znothing to commitr  r  zcould not read UsernamezCCouldn't authenticate user for push. Did you set `token` to `True`?)r   r   r~   rS   r   r   r  r   r6  rx  r  r^   r  chdirr_   ra   r~  r  r}   r  )
r,   r  r  r  r  r  files_to_stagefiles_in_msgcurrent_working_directoryes
             r-   commitRepository.commit3  sy    n ,CG~FI.FY\]F]3~bq123B7(BcfgucvLLL+n -## ft<t~~..NN01MMM&NN]^b^q^q]rrstu$&IIK!
7HI	0JLL(9L:/&t':':&;<%#1   HH./%  &c!f4G 5  ,A6!"ghnooG LL(9L:/ &c!f4G 5
&t':':&;<%#1  
  ,A6!"ghnooG HH./s   D3J6G( :J
F F9 :J
F6F1,J1F66J9
G%G  G%%J(J9H
J
H0H+&J+H00J4IJ
I?I::I??JJc                     [         R                  R                  U R                  [        R
                  5      n[         R                  R                  U5      (       a  [        U5      $ g rM   )r^   r_   ra   r   r   REPOCARD_NAMEisfiler   )r,   filepaths     r-   repocard_metadata_load!Repository.repocard_metadata_load  sA    77<<	0G0GH77>>(## **r0   datac                     [        [        R                  R                  U R                  [
        R                  5      U5      $ rM   )r   r^   r_   ra   r   r   r  )r,   r  s     r-   repocard_metadata_save!Repository.repocard_metadata_save  s)    RWW\\$..):Q:QRTXYYr0   c                 h    U R                    Vs/ s H  oR                  S:  d  M  UPM     sn$ s  snf )z0
Returns the asynchronous commands that failed.
r   )r   r8   r,   cs     r-   commands_failedRepository.commands_failed  s,    
  -->-aA->>>s   //c                 j    U R                    Vs/ s H  oR                  (       a  M  UPM     sn$ s  snf )zC
Returns the asynchronous commands that are currently in progress.
)r   r4   r  s     r-   commands_in_progressRepository.commands_in_progress  s(    
  --?-aYY-???s   00c                    SnU R                    H\  n[        R                  SUR                   SUR                  R
                   S35        [        R                  UR                  5        M^     U R                  (       a[  US-  S:X  a#  [        R                  SU R                   S35        US-  n[        R                  " S5        U R                  (       a  MZ  g	g	)
zZ
Blocking method: blocks all subsequent execution until all commands have
been processed.
r   zThe z command with PID z failed.r   zCWaiting for the following commands to finish before shutting down: r/  r   N)r  r   r   r   r(   rJ   r>   r  r6  r   r   )r,   indexcommand_faileds      r-   r  Repository.wait_for_commands  s    
 "22NLL4 4 455GH_H_HcHcGddlmnLL../ 3 ''rzQYZ^ZsZsYttuv QJEJJqM '''r0   )r  r  r   r  r   r  )NNTNNNFNrM   )NN)F)r/  )FF)r/  F)commit files to HF hub)NTF)r  TTF)NTTF)5rN   rO   rP   rQ   rR   r   r   r   r   r   r   rS   r   r	   rW   r   r.   rV   r  r  r   r  r  rE  rI  rM  rV  rZ  r]  r  rk  rn  rs  rx  r~  r  r
   r  r  r  r  r  r  r  r   r  r   r  r  r  r  r  rY   rZ   r0   r-   r   r     s   " )**Q %)#'"&"&#'"&$"&j0d#j0 SMj0 C=	j0
 T3Yj0 3-j0 C=j0 3-j0 j0 j0 j0X   6. }/3 }/uT3_/E }/ }/~/hsm /W_`cWd /&//s // /%S %!DI !F/%T#Y"7 /4 /2/E#tCy.$9 / /),s ),T#Y ),V,c ,DI ,B/$/t /$ /0 /s  /$  /D3 3& #'$	X*3-X* X* 	X*
 
sE#0011	2X*t7S 7D 7@(3 ( ( (<#3 # # #J 3  3hsm  3HUXM  3D$t $  7$"
"
 "
 	"

 "
 
tS%%6 677	8"
H  !%"&$f0f0 f0  	f0
 f0 f0 f0P Z4 ZD Z ? ? @ @r0   r   )r/  NrM   ):r  r^   rm   rT   r   r   
contextlibr   pathlibr   typingr   r   r   r   r	   r
   r   r   urllib.parser   huggingface_hubr   huggingface_hub.repocardr   r   hf_apir   r   rx   r   utilsr   r   r   r   r   r   utils._deprecationr   
get_loggerrN   r   r   rS   rW   rh   rq   r   r   r   r   r   rX   r   r   r   r   rZ   r0   r-   <module>r     s    	 	    %  T T T ! % A 6 -  2 
		H	%P
 P
f8c4i( 8T 8"!5d+ ! ! !2"'%T	"2 "'t "'JU39- $ 2U39- $ . 5dD3I UYZ]U^ 2c4i 0 T ,+E#t), + +QT +,I  jH jHZ[ [r0   