
    gQy                     |   d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
mZ ddlmZ ddlmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ 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'm(Z( d
dl)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 d
dl)m2Z3 erd
dl4m5Z5  e.jl                  e7      Z8ed   Z9dZ:e
 G d d             Z;e
 G d d             Z<e
 G d d             Z=de>de>fdZ?ee=e<e;f   Z@dee@   ddfdZAe1dddd d!ee=   d"e>d#e>d$ee>e>f   d%ee>   d&eBd'ee>   fd(       ZCd)eDfd*ZEe1	 	 	 d6d!ee=   d"e>d#e>d$ee>e>f   d'e>d%ee>   d+eFd,ee>   ddfd-       ZGe1	 d7d.ee<   d"e>d#e>d$ee>e>f   d'e>d%ee>   deee>ee>   f   ed/eHf   f   fd0       ZI	 	 d8dee@   d1eee>ee>   f   ed/eHf   f   d2e>d3ee>   d4ee>   deee>ef      fd5ZJy)9z<
Type definitions and utilities for the `create_commit` API
    N)defaultdict)contextmanager)	dataclassfield)groupby)PathPurePosixPath)TYPE_CHECKINGAnyBinaryIODictIterableIteratorListLiteralOptionalTupleUnion)
thread_map   )	constants)EntryNotFoundError)
hf_hub_url)
UploadInfo
lfs_uploadpost_lfs_batch_info)FORBIDDEN_FOLDERSchunk_iterableget_sessionhf_raise_for_statusloggingshatqdm_stream_filevalidate_hf_hub_args)tqdm)RepoFilelfsregulari  c                   @    e Zd ZU dZeed<   dZeee	d   f   ed<   d Z
y)CommitOperationDeletea  
    Data structure holding necessary info to delete a file or a folder from a repository
    on the Hub.

    Args:
        path_in_repo (`str`):
            Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"`
            for a file or `"checkpoints/1fec34a/"` for a folder.
        is_folder (`bool` or `Literal["auto"]`, *optional*)
            Whether the Delete Operation applies to a folder or not. If "auto", the path
            type (file or folder) is guessed automatically by looking if path ends with
            a "/" (folder) or not (file). To explicitly set the path type, you can set
            `is_folder=True` or `is_folder=False`.
    path_in_repoauto	is_folderc                     t        | j                        | _        | j                  dk(  r | j                  j                  d      | _        t	        | j                  t
              st        d| j                   d      y )Nr-   /zNWrong value for `is_folder`. Must be one of [`True`, `False`, `'auto'`]. Got 'z'.)_validate_path_in_repor,   r.   endswith
isinstancebool
ValueErrorselfs    P/var/www/openai/venv/lib/python3.12/site-packages/huggingface_hub/_commit_api.py__post_init__z#CommitOperationDelete.__post_init__G   sn    243D3DE>>V#!..77<DN$..$/`aeaoao`pprs  0    N)__name__
__module____qualname____doc__str__annotations__r.   r   r4   r   r9    r:   r8   r+   r+   3   s,     .4IuT76?*+4r:   r+   c                   @    e Zd ZU dZeed<   eed<   dZee   ed<   d Zy)CommitOperationCopyab  
    Data structure holding necessary info to copy a file in a repository on the Hub.

    Limitations:
      - Only LFS files can be copied. To copy a regular file, you need to download it locally and re-upload it
      - Cross-repository copies are not supported.

    Note: you can combine a [`CommitOperationCopy`] and a [`CommitOperationDelete`] to rename an LFS file on the Hub.

    Args:
        src_path_in_repo (`str`):
            Relative filepath in the repo of the file to be copied, e.g. `"checkpoints/1fec34a/weights.bin"`.
        path_in_repo (`str`):
            Relative filepath in the repo where to copy the file, e.g. `"checkpoints/1fec34a/weights_copy.bin"`.
        src_revision (`str`, *optional*):
            The git revision of the file to be copied. Can be any valid git revision.
            Default to the target commit revision.
    src_path_in_repor,   Nsrc_revisionc                 l    t        | j                        | _        t        | j                        | _        y N)r1   rD   r,   r6   s    r8   r9   z!CommitOperationCopy.__post_init__k   s(     6t7L7L M243D3DEr:   )	r;   r<   r=   r>   r?   r@   rE   r   r9   rA   r:   r8   rC   rC   R   s)    & "&L(3-&Fr:   rC   c                   V   e Zd ZU dZeed<   eeeee	f   ed<    e
dd      Zeed<    e
ddd      Zee   ed	<    e
ddd      Zee   ed
<    e
ddd      Zee   ed<    e
ddd      Zeed<    e
ddd      Zeed<   ddZeddedee	   fd       ZdefdZedee   fd       Zy)CommitOperationAdda  
    Data structure holding necessary info to upload a file to a repository on the Hub.

    Args:
        path_in_repo (`str`):
            Relative filepath in the repo, for example: `"checkpoints/1fec34a/weights.bin"`
        path_or_fileobj (`str`, `Path`, `bytes`, or `BinaryIO`):
            Either:
            - a path to a local file (as `str` or `pathlib.Path`) to upload
            - a buffer of bytes (`bytes`) holding the content of the file to upload
            - a "file object" (subclass of `io.BufferedIOBase`), typically obtained
                with `open(path, "rb")`. It must support `seek()` and `tell()` methods.

    Raises:
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If `path_or_fileobj` is not one of `str`, `Path`, `bytes` or `io.BufferedIOBase`.
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If `path_or_fileobj` is a `str` or `Path` but not a path to an existing file.
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If `path_or_fileobj` is a `io.BufferedIOBase` but it doesn't support both
            `seek()` and `tell()`.
    r,   path_or_fileobjF)initreprupload_infoN)rK   rL   default_upload_mode_should_ignore_remote_oid_is_uploaded_is_committedreturnc                    t        | j                        | _        t        | j                  t              rt        | j                        | _        t        | j                  t
              rtt        j                  j                  t        j                  j                  | j                              }t        j                  j                  |      sDt        d| d      t        | j                  t        j                  t        f      st        d      t        | j                  t        j                        rE	 | j                  j                          | j                  j!                  dt        j"                         t        | j                  t
              r%t)        j*                  | j                        | _        yt        | j                  t              r%t)        j.                  | j                        | _        yt)        j0                  | j                        | _        y# t$        t&        f$ r}t        d      |d}~ww xY w)z6Validates `path_or_fileobj` and compute `upload_info`.zProvided path: 'z(' is not a file on the local file systemzpath_or_fileobj must be either an instance of str, bytes or io.BufferedIOBase. If you passed a file-like object, make sure it is in binary mode.r   zNpath_or_fileobj is a file-like object but does not implement seek() and tell()N)r1   r,   r3   rJ   r   r?   ospathnormpath
expanduserisfiler5   ioBufferedIOBasebytestellseekSEEK_CUROSErrorAttributeErrorr   	from_pathrM   
from_bytesfrom_fileobj)r7   rJ   excs      r8   r9   z CommitOperationAdd.__post_init__   s   243D3DE d**D1#&t';';#<D d**C0 gg..rww/A/A$BVBV/WXO77>>/2 #3O3DDl!mnnD0023D3De2LM# 
 d**B,=,=>$$))+$$))!R[[9 d**C0)33D4H4HID,,e4)44T5I5IJD)66t7K7KLD ^,  ds   7AH H>-H99H>	with_tqdmc              #     K   t        | j                  t              st        | j                  t              rI|r#t	        | j                        5 }| ddd       yt        | j                  d      5 }| ddd       yt        | j                  t              r"t        j                  | j                         yt        | j                  t        j                        rS| j                  j                         }| j                   | j                  j                  |t        j                         yy# 1 sw Y   yxY w# 1 sw Y   yxY ww)u  
        A context manager that yields a file-like object allowing to read the underlying
        data behind `path_or_fileobj`.

        Args:
            with_tqdm (`bool`, *optional*, defaults to `False`):
                If True, iterating over the file object will display a progress bar. Only
                works if the file-like object is a path to a file. Pure bytes and buffers
                are not supported.

        Example:

        ```python
        >>> operation = CommitOperationAdd(
        ...        path_in_repo="remote/dir/weights.h5",
        ...        path_or_fileobj="./local/weights.h5",
        ... )
        CommitOperationAdd(path_in_repo='remote/dir/weights.h5', path_or_fileobj='./local/weights.h5')

        >>> with operation.as_file() as file:
        ...     content = file.read()

        >>> with operation.as_file(with_tqdm=True) as file:
        ...     while True:
        ...         data = file.read(1024)
        ...         if not data:
        ...              break
        config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s]

        >>> with operation.as_file(with_tqdm=True) as file:
        ...     requests.put(..., data=file)
        config.json: 100%|█████████████████████████| 8.19k/8.19k [00:02<00:00, 3.72kB/s]
        ```
        Nrb)r3   rJ   r?   r   r#   openr]   r[   BytesIOr\   r^   r_   SEEK_SET)r7   rg   fileprev_poss       r8   as_filezCommitOperationAdd.as_file   s     H d**C0Jt?S?SUY4Z%d&:&:;tJ <; $..5J 65,,e4**T1122,,b.?.?@++002H&&&  %%h< A <; 65s7   AED4E2E 7B=E4D=9E E	Ec                     | j                         5 }t        j                  |j                               cddd       S # 1 sw Y   yxY w)z[
        The base64-encoded content of `path_or_fileobj`

        Returns: `bytes`
        N)ro   base64	b64encodereadr7   rm   s     r8   
b64contentzCommitOperationAdd.b64content   s-     \\^t##DIIK0 ^^s	   #>Ac                    | j                   y| j                   dk(  r$| j                  j                  j                         S | j	                         5 }t        j                  |j                               cddd       S # 1 sw Y   yxY w)a  Return the OID of the local file.

        This OID is then compared to `self._remote_oid` to check if the file has changed compared to the remote one.
        If the file did not change, we won't upload it again to prevent empty commits.

        For LFS files, the OID corresponds to the SHA256 of the file content (used a LFS ref).
        For regular files, the OID corresponds to the SHA1 of the file content.
        Note: this is slightly different to git OID computation since the oid of an LFS file is usually the git-SHA1 of the
              pointer file content (not the actual file content). However, using the SHA256 is enough to detect changes
              and more convenient client-side.
        Nr(   )rO   rM   sha256hexro   r"   git_hashrs   rt   s     r8   
_local_oidzCommitOperationAdd._local_oid   se     $%'##**..00 4||DIIK0  s   #A>>BrT   N)F)r;   r<   r=   r>   r?   r@   r   r   r]   r   r   rM   r   rO   r   
UploadModerP   r4   rQ   rR   rS   r9   r   r   ro   ru   propertyrz   rA   r:   r8   rI   rI   p   s   . 3eX566#U;K;
 */Et)TL(:&T &+E4%PNHTNP "'Et!LK#L EuEL$E  UFM4F!MF /= /=(82D /= /=b1E 1 1HSM 1 1r:   rI   r,   rT   c                 4   | j                  d      r| dd  } | dk(  s| dk(  s| j                  d      rt        d|  d      | j                  d      r| d	d  } t        D ]7  t        fd
| j	                  d      D              s't        d d|  d       | S )Nr0   r   .z..z../z,Invalid `path_in_repo` in CommitOperation: ''z./   c              3   (   K   | ]	  }|k(    y wrG   rA   ).0part	forbiddens     r8   	<genexpr>z)_validate_path_in_repo.<locals>.<genexpr>  s     E-DTty -Ds   zHInvalid `path_in_repo` in CommitOperation: cannot update files under a 'z/' folder (path: 'z').)
startswithr5   r   anysplit)r,   r   s    @r8   r1   r1     s    s##AB'sld2l6M6Me6TG~UVWXXt$#AB'&	E\-?-?-DEEZ[dZe f!N#'  ' r:   
operationsc                    t        t              }| D ]  }|j                  }t        |t              r^||   dkD  rt        j                  d| d       ||xx   dz  cc<   t        |      j                  D ]  }|t        |      xx   dz  cc<    t        |t              s|t        t        |               dkD  s|j                  rt        j                  d| d       t        j                  d| d        y)a  
    Warn user when a list of operations is expected to overwrite itself in a single
    commit.

    Rules:
    - If a filepath is updated by multiple `CommitOperationAdd` operations, a warning
      message is triggered.
    - If a filepath is updated at least once by a `CommitOperationAdd` and then deleted
      by a `CommitOperationDelete`, a warning is triggered.
    - If a `CommitOperationDelete` deletes a filepath that is then updated by a
      `CommitOperationAdd`, no warning is triggered. This is usually useless (no need to
      delete before upload) but can happen if a user deletes an entire folder and then
      add new files to it.
    r   zBAbout to update multiple times the same file in the same commit: 'z9'. This can cause undesired inconsistencies in your repo.r   z_About to delete a folder containing files that have just been updated within the same commit: 'zLAbout to delete a file that have just been updated within the same commit: 'N)r   intr,   r3   rI   warningswarnr	   parentsr?   r+   r.   )r   nb_additions_per_path	operationr,   parents        r8   _warn_on_overwriting_operationsr   *  s    -8,<	 --i!34$\2Q6% '""
 ",/14/'5== &c&k2a72 > i!67$S|)D%EFJ&&MM==IN KII MM**6 899/  r:      )endpointnum_threadsrevision	additions	repo_typerepo_idheadersr   r   r   c                 f   g }t        | d      D ]  }t        |D 	cg c]  }	|	j                   c}	|||d      \  }
}|radj                  |D cg c]8  }d|j	                  d       d|j	                  d	i       j	                  d
       : c}      }t        d|       ||
z  } | D ci c]'  }|j                  j                  j                         |) c}g }|D ]N  }|j	                  d      *t        j                  d|d      j                   d       >|j                  |       P t        |      dk(  rt        j                  d       ydfd}t        j                  r=t        j                  dt        |       d       t        |d      D ]
  } ||        yt        |      dk(  r!t        j                  d        ||d          yt        j                  dt        |       d| d       t!        ||dt        |       d|t               yc c}	w c c}w c c}w )a2  
    Uploads the content of `additions` to the Hub using the large file storage protocol.

    Relevant external documentation:
        - LFS Batch API: https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md

    Args:
        additions (`List` of `CommitOperationAdd`):
            The files to be uploaded
        repo_type (`str`):
            Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
        repo_id (`str`):
            A namespace (user or an organization) and a repo name separated
            by a `/`.
        headers (`Dict[str, str]`):
            Headers to use for the request, including authorization headers and user agent.
        num_threads (`int`, *optional*):
            The number of concurrent threads to use when uploading. Defaults to 5.
        revision (`str`, *optional*):
            The git revision to upload to.

    Raises:
        [`EnvironmentError`](https://docs.python.org/3/library/exceptions.html#EnvironmentError)
            If an upload failed for any reason
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If the server returns malformed responses
        [`HTTPError`](https://requests.readthedocs.io/en/latest/api/#requests.HTTPError)
            If the LFS batch endpoint returned an HTTP error.
       )
chunk_sizeN)upload_infosr   r   r   r   r   token
z$Encountered error for file with OID oidz: `errormessagez$LFS batch endpoint returned errors:
actionszContent of file z/ is already present upstream - skipping upload.r   zNo LFS files to upload.c                     	 | d      }t        ||        y # t        $ r}t        dj                   d      |d }~ww xY w)Nr   )r   lfs_batch_actionr   r   zError while uploading 'z' to the Hub.)r   	ExceptionRuntimeErrorr,   )batch_actionr   rf   r   r   	oid2addops      r8   _wrapped_lfs_uploadz._upload_lfs_files.<locals>._wrapped_lfs_upload  sZ    	i!,u"56I\SZemn 	i!89O9O8PP]^_ehh	is    	A>Az
Uploading z* LFS files to the Hub using `hf_transfer`.zhuggingface_hub.lfs_upload)namer   zUploading 1 LFS file to the Hubz" LFS files to the Hub using up to z threads concurrentlyzUpload z
 LFS files)descmax_workers
tqdm_classr{   )r   r   rM   joingetr5   rw   rx   loggerdebugr,   appendlenr   HF_HUB_ENABLE_HF_TRANSFERhf_tqdmr   )r   r   r   r   r   r   r   batch_actionschunkopbatch_actions_chunkbatch_errors_chunkerrr   add_opfiltered_actionsactionr   r   s      ``             @r8   _upload_lfs_filesr   X  s\   V !#M	c:2E3895R"..593
// ii  21 ;3775>:J#cggV]_aNbNfNfgpNqMrs1G DWINOO,,+ ;, HQQyV##**..0&8yQI ::i (LL"9VE]#;#H#H"I J7 7
 ##F+   !./i **z#&6"7!88bcd.5QRF' S		!	#67,Q/0-.//QR]Q^^st	
 	3/01<#	
q : Rs   H$
=H)
1,H.preupload_infoc                 ,   | j                  d      }t        |t              st        d      |D ]b  }t        |t              rFt        |j                  d      t
              r't        |j                  d      t
              r|d   dv rYt        d       | S )Nfilesz&preupload_info is improperly formattedrW   
uploadModer'   z'preupload_info is improperly formatted:)r   r3   listr5   dictr?   )r   r   	file_infos      r8   _validate_preupload_infor     s    w'EeT"ABB	y$'9==0#69==6<<(,>>FGG  r:   	create_prgitignore_contentc                    ||nt         j                  }i }i }	i }
t        | d      D ]P  }d|D cg c]\  }|j                  t	        j
                  |j                  j                        j                  d      |j                  j                  d^ c}i}|||d<   t               j                  | d| d| d	| |||rd
dind      }t        |       t        |j                               } |j                  di |d   D ci c]  }|d   |d    c}  |	j                  di |d   D ci c]  }|d   |d    c}  |
j                  di |d   D ci c]  }|d   |j!                  d       c} S | D ]>  }||j                     |_        |	|j                     |_        |
|j                     |_        @ | D ]#  }|j                  j                  dk(  sd|_        % yc c}w c c}w c c}w c c}w )a  
    Requests the Hub "preupload" endpoint to determine whether each input file should be uploaded as a regular git blob
    or as git LFS blob. Input `additions` are mutated in-place with the upload mode.

    Args:
        additions (`Iterable` of :class:`CommitOperationAdd`):
            Iterable of :class:`CommitOperationAdd` describing the files to
            upload to the Hub.
        repo_type (`str`):
            Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
        repo_id (`str`):
            A namespace (user or an organization) and a repo name separated
            by a `/`.
        headers (`Dict[str, str]`):
            Headers to use for the request, including authorization headers and user agent.
        revision (`str`):
            The git revision to upload the files to. Can be any valid git revision.
        gitignore_content (`str`, *optional*):
            The content of the `.gitignore` file to know which files should be ignored. The order of priority
            is to first check if `gitignore_content` is passed, then check if the `.gitignore` file is present
            in the list of files to commit and finally default to the `.gitignore` file already hosted on the Hub
            (if any).
    Raises:
        [`~utils.HfHubHTTPError`]
            If the Hub API returned an error.
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If the Hub API response is improperly formatted.
    Nr   r   ascii)rW   samplesize	gitIgnorez/api/zs/z/preupload/r   1)jsonr   paramsrW   r   shouldIgnorer   r   r)   rA   )r   ENDPOINTr   r,   rq   rr   rM   r   decoder   r   postr    r   r   updater   rO   rP   rQ   )r   r   r   r   r   r   r   r   upload_modesshould_ignore_infooid_infor   r   payloadrespr   rm   additions                     r8   _fetch_upload_modesr     s7   N $/xY5G5GH +-L*,)+H	3/    B	 OO$..r~~/D/DELLWUNN//
  	
 (#4GK }!!ji[7);xjI)2K%	 " 
 	D!1$))+>eN[bLcdLcDtF|T,-??Lcde!!!mTbcjTk$lTkDT&\43G%GTk$lm^^T[E\]E\T4<%8E\]^1 06  ,X-B-B C"4X5J5J"K'(=(=>  $$)$-H! A( e$l]s   A!G'G,-G1G6copiesr&   c           
         ddl m}m}  |||      }i }	t        | d       D ]>  \  }
}t	        |      }|D cg c]  }|j
                   }}t        dt        |      t              D ]  }|j                  ||||t        z    |
xs ||      }|D ]  }t        ||      rt        d      |j                  r||	|j                  |
f<   8t        ||||
xs ||j                  	      }t               j!                  ||
      }t#        |       |j$                  |	|j                  |
f<     |D ]2  }|j
                  |
f|	vst'        d|j
                   d|
xs | d       A |	S c c}w )a;  
    Fetch information about the files to copy.

    For LFS files, we only need their metadata (file size and sha256) while for regular files
    we need to download the raw content from the Hub.

    Args:
        copies (`Iterable` of :class:`CommitOperationCopy`):
            Iterable of :class:`CommitOperationCopy` describing the files to
            copy on the Hub.
        repo_type (`str`):
            Type of the repo to upload to: `"model"`, `"dataset"` or `"space"`.
        repo_id (`str`):
            A namespace (user or an organization) and a repo name separated
            by a `/`.
        headers (`Dict[str, str]`):
            Headers to use for the request, including authorization headers and user agent.
        revision (`str`):
            The git revision to upload the files to. Can be any valid git revision.

    Returns: `Dict[Tuple[str, Optional[str]], Union[RepoFile, bytes]]]`
        Key is the file path and revision of the file to copy.
        Value is the raw content as bytes (for regular files) or the file information as a RepoFile (for LFS files).

    Raises:
        [`~utils.HfHubHTTPError`]
            If the Hub API returned an error.
        [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError)
            If the Hub API response is improperly formatted.
    r   )HfApi
RepoFolder)r   r   c                     | j                   S rG   )rE   )r   s    r8   <lambda>z&_fetch_files_to_copy.<locals>.<lambda>V  s    2??r:   )keyr   )r   pathsr   r   z$Copying a folder is not implemented.)r   r   r   r   filename)r   zCannot copy z at revision z: file is missing on repo.)hf_apir   r   r   r   rD   ranger   FETCH_LFS_BATCH_SIZEget_paths_infor3   NotImplementedErrorr(   rW   r   r   r   r    contentr   )r   r   r   r   r   r   r   r   r   files_to_copyrE   r   r   r   offsetsrc_repo_filessrc_repo_fileurlresponser   s                       r8   _fetch_files_to_copyr   +  s   N *Hg6FOQM$+F8R$S$S j*%
/9:z$$z:As5z+?@F#22FV.B%BC%1#	 3 N "0mZ8-.TUU $$HUM=#5#5|"DE %!)"+ '!-!9!.!3!3C  +}00g0FH'1HPHXHXM=#5#5|"DE! "0 A0 $I**L9N("9#=#=">m#/x00JL  $7 %TB ? ;s   E'r   commit_messagecommit_descriptionparent_commitc              #     K   ||nd}||d}|||d<   d|d d}| D ]  }t        |t              r5|j                  r)t        j	                  d|j
                   d	       |d
z  }It        |t              rA|j                  dk(  r2d|j                         j                         |j
                  ddd t        |t              r]|j                  dk(  rNd|j
                  d|j                  j                  j                         |j                  j                  dd t        |t              r#|j                  rdndd|j
                  id :t        |t              r||j                   |j"                  f   }t        |t$              r8dt'        j(                  |      j                         |j
                  ddd |j*                  r+d|j
                  d|j*                  j                  dd t-        d      t-        d| dt/        |dd              |dkD  rt        j1                  d| d       yyw)aG  
    Builds the payload to POST to the `/commit` API of the Hub.

    Payload is returned as an iterator so that it can be streamed as a ndjson in the
    POST request.

    For more information, see:
        - https://github.com/huggingface/huggingface_hub/issues/1085#issuecomment-1265208073
        - http://ndjson.org/
    N )summarydescriptionparentCommitheader)r   valuer   zSkipping file 'z(' in commit (ignored by gitignore file).r   r)   rm   rq   )r   rW   encodingr(   lfsFilerw   )rW   algor   r   deletedFolderdeletedFilerW   )rW   r  r   z_Malformed files_to_copy (should be raw file content as bytes or RepoFile objects with LFS info.z(Unknown operation to commit. Operation: z. Upload mode: rO   zSkipped z/ file(s) in commit (ignored by gitignore file).)r3   rI   rP   r   r   r,   rO   ru   r   rM   rw   rx   r   r+   r.   rC   rD   rE   r]   rq   rr   r(   r5   getattrinfo)	r   r   r   r   r   header_valuenb_ignored_filesr   file_to_copys	            r8   _prepare_commit_payloadr  z  sz    " 0B/M+SU  .>PQL '4^$\
22  	i!349Q9QLL?9+A+A*BBjkl! i!349O9OS\9\(335<<>%22 (  	#569;Q;QUZ;Z %22$$0077;;=%1166	  	#89*3*=*== )"8"89 
 	#67()*D*DiF\F\)]^L,.!#)#3#3L#A#H#H#J ) 6 6$,  !!$ ) 6 6 (+//66  !u 
 :9+ FI~t<=? {  D !h/00_`a s   I
I)NFNrG   )NN)Kr>   rq   r[   rV   r   collectionsr   
contextlibr   dataclassesr   r   	itertoolsr   pathlibr   r	   typingr
   r   r   r   r   r   r   r   r   r   r   tqdm.contrib.concurrentr   r   r   errorsr   file_downloadr   r(   r   r   r   utilsr   r   r   r    r!   r"   r#   r$   r%   r   r   r&   
get_loggerr;   r   r|   r   r+   rC   rI   r?   r1   CommitOperationr   r   r   r   r   r4   r   r]   r   r  rA   r:   r8   <module>r     sl    	 	  # % (  ' p p p p .  & % < <	 	 	 #   
		H	% %&
     < F F F: b1 b1 b1J  " *,?AVVW+_0E +$ +\  #"k
&'k
 k
 	k

 #s(^k
 smk
 k
 smk
 k
\T   #'+Q.*+Q.Q. Q. #s(^	Q.
 Q. smQ. Q.  }Q. 
Q. Q.h  #K()KK K #s(^	K
 K smK 
%Xc]"
#U:u+<%=
=>K Kd )-#'_b)_bc8C=015U9J3KKL_b _b !	_b
 C=_b d38n_br:   