§
    }Štj®P  ã            
       óð  — d Z ddl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	m
Z
mZ ddlmZ  ej        e¦  «        ZdZe G d„ d	¦  «        ¦   «         Z ed
¬¦  «         G d„ d¦  «        ¦   «         Ze G d„ d¦  «        ¦   «         Ze G d„ d¦  «        ¦   «         Zdeddfd„Zde	dedefd„Zde	dedefd„Zde	dededz  fd„Zde	dedefd„Zde	dedededdf
d„Zde	de	fd„Zde	ddfd„Zdedefd „ZdS )!u$  Contains utilities to handle the `../.cache/huggingface` folder in local directories.

First discussed in https://github.com/huggingface/huggingface_hub/issues/1738 to store
download metadata when downloading files from the hub to a local directory (without
using the cache).

./.cache/huggingface folder structure:
[4.0K]  data
â”œâ”€â”€ [4.0K]  .cache
â”‚   â””â”€â”€ [4.0K]  huggingface
â”‚       â””â”€â”€ [4.0K]  download
â”‚           â”œâ”€â”€ [  16]  file.parquet.metadata
â”‚           â”œâ”€â”€ [  16]  file.txt.metadata
â”‚           â””â”€â”€ [4.0K]  folder
â”‚               â””â”€â”€ [  16]  file.parquet.metadata
â”‚
â”œâ”€â”€ [6.5G]  file.parquet
â”œâ”€â”€ [1.5K]  file.txt
â””â”€â”€ [4.0K]  folder
    â””â”€â”€ [   16]  file.parquet


Download metadata file structure:
```
# file.txt.metadata
11c5a3d5811f50298f278a704980280950aedb10
a16a55fda99d2f2e7b69cce5cf93ff4ad3049930
1712656091.123

# file.parquet.metadata
11c5a3d5811f50298f278a704980280950aedb10
7c5d3f4b8b76583b422fcb9189ad6c89d5d97a094541ce8932dce3ecabde1421
1712656091.123
}
```
é    N)Ú	dataclass)ÚPathÚPurePosixPathÚPureWindowsPathé   )ÚWeakFileLockz¿Signature: 8a477f597d28d172789f06886806bc55
# This file is a cache directory tag created by huggingface_hub.
# For information about cache directory tags, see:
#	https://bford.info/cachedir/
c                   óB   — e Zd ZU dZeed<   eed<   eed<   dedefd„ZdS )	ÚLocalDownloadFilePathsa’  
    Paths to the files related to a download process in a local dir.

    Returned by [`get_local_download_paths`].

    Attributes:
        file_path (`Path`):
            Path where the file will be saved.
        lock_path (`Path`):
            Path to the lock file used to ensure atomicity when reading/writing metadata.
        metadata_path (`Path`):
            Path to the metadata file.
    Ú	file_pathÚ	lock_pathÚmetadata_pathÚetagÚreturnc                 ó4  — | j         j        t          | j         j        ¦  «        › d|› d�z  }t	          |                     ¦   «         ¦  «        }t          j        dk    r:t          |¦  «        dk    r'|                     d¦  «        st          d|z   ¦  «        }|S )z^Return the path where a file will be temporarily downloaded before being moved to `file_path`.ú.z.incompleteÚntéÿ   ú\\?\)
r   ÚparentÚ_short_hashÚnameÚstrÚresolveÚosÚlenÚ
startswithr   )Úselfr   ÚpathÚresolved_paths       ú[/var/www/html/CA-Chatbot/venv/lib/python3.11/site-packages/huggingface_hub/_local_folder.pyÚincomplete_pathz&LocalDownloadFilePaths.incomplete_path\   s‘   € àÔ!Ô(­k¸$Ô:LÔ:QÑ.RÔ.RÐ+fÐ+fÐUYÐ+fÐ+fÐ+fÑfˆÝ˜DŸLšL™NœNÑ+Ô+ˆõ Œ7�dŠ?ˆ?�s =Ñ1Ô1°CÒ7Ð7À×@XÒ@XÐYbÑ@cÔ@cÐ7Ý˜	 MÑ1Ñ2Ô2ˆDØˆó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   Ú__annotations__r   r!   © r"   r    r
   r
   H   sb   € € € € € € ðð ð €O€O�OØ€O€O�OØÐÐÑð Cð ¨Dð ð ð ð ð ð r"   r
   T)Úfrozenc                   ó<   — e Zd ZU dZeed<   eed<   eed<   eed<   dS )ÚLocalUploadFilePathsa×  
    Paths to the files related to an upload process in a local dir.

    Returned by [`get_local_upload_paths`].

    Attributes:
        path_in_repo (`str`):
            Path of the file in the repo.
        file_path (`Path`):
            Path where the file will be saved.
        lock_path (`Path`):
            Path to the lock file used to ensure atomicity when reading/writing metadata.
        metadata_path (`Path`):
            Path to the metadata file.
    Úpath_in_repor   r   r   N)r#   r$   r%   r&   r   r'   r   r(   r"   r    r+   r+   g   sH   € € € € € € ðð ð  ÐÐÑØ€O€O�OØ€O€O�OØÐÐÑÐÐr"   r+   c                   ó<   — e Zd ZU dZeed<   eed<   eed<   eed<   dS )ÚLocalDownloadFileMetadataaG  
    Metadata about a file in the local directory related to a download process.

    Attributes:
        filename (`str`):
            Path of the file in the repo.
        commit_hash (`str`):
            Commit hash of the file in the repo.
        etag (`str`):
            ETag of the file in the repo. Used to check if the file has changed.
            For LFS files, this is the sha256 of the file. For regular files, it corresponds to the git hash.
        timestamp (`int`):
            Unix timestamp of when the metadata was saved i.e. when the metadata was accurate.
    ÚfilenameÚcommit_hashr   Ú	timestampN)r#   r$   r%   r&   r   r'   Úfloatr(   r"   r    r.   r.      sH   € € € € € € ðð ð €M€M�MØÐÐÑØ
€I€I�IØÐÐÑÐÐr"   r.   c                   ó®   — e Zd ZU dZeed<   dZedz  ed<   dZe	dz  ed<   dZ
edz  ed<   dZedz  ed<   dZedz  ed<   d	Ze	ed
<   d	Ze	ed<   deddfd„ZdS )ÚLocalUploadFileMetadatazT
    Metadata about a file in the local directory related to an upload process.
    ÚsizeNr1   Úshould_ignoreÚsha256Úupload_modeÚ
remote_oidFÚis_uploadedÚis_committedÚpathsr   c           	      óz  — t          |j        ¦  «        5  |j                             d¦  «        5 }t	          j        ¦   «         }|                     t          |¦  «        dz   ¦  «         |                     t          | j        ¦  «        ¦  «         |                     d¦  «         | j        �4|                     t          t          | j        ¦  «        ¦  «        ¦  «         |                     d¦  «         | j
        �|                     | j
        ¦  «         |                     d¦  «         | j        �|                     | j        ¦  «         |                     d¦  «         | j        �|                     | j        ¦  «         |                     d¦  «         |                     t          t          | j        ¦  «        ¦  «        dz   ¦  «         |                     t          t          | j        ¦  «        ¦  «        dz   ¦  «         ddd¦  «         n# 1 swxY w Y   || _        ddd¦  «         dS # 1 swxY w Y   dS )zSave the metadata to disk.Úwú
N)r   r   r   ÚopenÚtimeÚwriter   r5   r6   Úintr7   r8   r9   r:   r;   r1   )r   r<   ÚfÚnew_timestamps       r    ÚsavezLocalUploadFileMetadata.save§   sO  € å˜%œ/Ñ*Ô*ð 	+ð 	+ØÔ$×)Ò)¨#Ñ.Ô.ð <°!Ý $¤	¡¤�Ø—’�˜MÑ*Ô*¨TÑ1Ñ2Ô2Ð2à—’�˜DœI™œÑ'Ô'Ð'Ø—’˜‘”�àÔ%Ð1Ø—G’G�C¥ DÔ$6Ñ 7Ô 7Ñ8Ô8Ñ9Ô9Ð9Ø—’˜‘”�à”;Ð*Ø—G’G˜DœKÑ(Ô(Ð(Ø—’˜‘”�àÔ#Ð/Ø—G’G˜DÔ,Ñ-Ô-Ð-Ø—’˜‘”�à”?Ð.Ø—G’G˜DœOÑ,Ô,Ð,Ø—’˜‘”�à—’��C Ô 0Ñ1Ô1Ñ2Ô2°TÑ9Ñ:Ô:Ð:Ø—’��C Ô 1Ñ2Ô2Ñ3Ô3°dÑ:Ñ;Ô;Ð;ð1<ð <ð <ñ <ô <ð <ð <ð <ð <ð <ð <øøøð <ð <ð <ð <ð4 +ˆDŒNð7	+ð 	+ð 	+ñ 	+ô 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+ð 	+øøøð 	+ð 	+ð 	+ð 	+ð 	+ð 	+s5   •H0°GHÈH0ÈH	ÈH0ÈH	È
H0È0H4È7H4)r#   r$   r%   r&   rC   r'   r1   r2   r6   Úboolr7   r   r8   r9   r:   r;   r+   rF   r(   r"   r    r4   r4   –   sÔ   € € € € € € ðð ð €I€I�Ið #€Iˆu�t‰|Ð"Ð"Ñ"Ø!%€M�4˜$‘;Ð%Ð%Ñ%Ø€FˆC�$‰JÐÐÑØ"€K��t‘Ð"Ð"Ñ"Ø!€J��d‘
Ð!Ð!Ñ!Ø€K�ÐÐÑØ€L�$ÐÐÑð+Ð.ð +°4ð +ð +ð +ð +ð +ð +r"   r4   r/   r   c                 ó,  — d|                       dd¦  «                             d¦  «        v rt          d| › d�¦  «        ‚t          | ¦  «        gd„ |                      d¦  «        D ¦   «         ¢}|D ]#}|j        s|j        rt          d| › d�¦  «        ‚Œ$dS )	u}  Validate that a repo filename is safe to use as a path relative to a local directory.

    A repo filename is a POSIX-style ('/'-separated) path relative to the repo root. When materialized
    on disk (in `local_dir` or in the cache), it is joined onto a base directory. A malicious repository
    could craft a filename that escapes that base directory, resulting in an arbitrary file write:

    - an absolute path (`/etc/...`),
    - a Windows drive path (`C:\Windows\...`) or drive-relative path (`D:foo`),
    - a UNC path (`\\attacker-host\share\...`) â€” which on Windows additionally makes the client
      authenticate to the attacker's SMB server during path resolution, leaking a NetNTLMv2 hash,
    - a path using `..` to traverse upward.

    Such filenames would otherwise cause `local_dir / filename` to discard `local_dir` (when the right
    side is anchored) or point outside of it (with `..`). We reject them here, before touching the
    filesystem. The check runs on all platforms and interprets the name under both POSIX and Windows
    rules, so a file materialized on Linux cannot escape when later consumed on Windows.
    z..ú\ú/zInvalid filename 'z[': cannot contain a '..' path segment. Please ask the repository owner to rename this file.c              3   ó4   K  — | ]}t          |¦  «        V — Œd S ©N)r   )Ú.0Úparts     r    ú	<genexpr>z._validate_relative_filename.<locals>.<genexpr>á   s*   è è € Ð,cÐ,cÀt­_¸TÑ-BÔ-BÐ,cÐ,cÐ,cÐ,cÐ,cÐ,cr"   zj': cannot be an absolute, drive-relative or UNC path. Please ask the repository owner to rename this file.N)ÚreplaceÚsplitÚ
ValueErrorr   ÚdriveÚroot)r/   Ú
pure_pathsÚ	pure_paths      r    Ú_validate_relative_filenamerW   Ç   sé   € ð& ˆx×Ò  cÑ*Ô*×0Ò0°Ñ5Ô5Ð5Ð5ÝðC ð Cð Cð Cñ
ô 
ð 	
õ   Ñ)Ô)ÐdÐ,cÐ,cÈxÏ~Ê~Ð^aÑObÔObÐ,cÑ,cÔ,cÐd€JØð ð ˆ	ØŒ?ð 	˜iœnð 	ÝðG Xð Gð Gð Gñô ð ð	ðð r"   Ú	local_dirc                 óB  — t          |¦  «         t          j        j        |                     d¦  «        Ž }| |z  }t          | ¦  «        dz  |› d�z  }|                     d¦  «        }t          j        dk    rßt          | ¦  «         	                    d¦  «        s½t          t          j                             |¦  «        ¦  «        dk    r�t          dt          j                             |¦  «        z   ¦  «        }t          dt          j                             |¦  «        z   ¦  «        }t          dt          j                             |¦  «        z   ¦  «        }|j                             dd¬	¦  «         |j                             dd¬	¦  «         t          |||¬
¦  «        S )a¯  Compute paths to the files related to a download process.

    Folders containing the paths are all guaranteed to exist.

    Args:
        local_dir (`Path`):
            Path to the local directory in which files are downloaded.
        filename (`str`):
            Path of the file in the repo.

    Return:
        [`LocalDownloadFilePaths`]: the paths to the files (file_path, lock_path, metadata_path, incomplete_path).
    rJ   Údownloadú	.metadataú.lockr   r   r   T©ÚparentsÚexist_ok)r   r   r   )rW   r   r   ÚjoinrQ   Ú_huggingface_dirÚwith_suffixr   r   r   r   Úabspathr   r   Úmkdirr
   ©rX   r/   Úsanitized_filenamer   r   r   s         r    Úget_local_download_pathsrg   ê   sg  € õ   Ñ)Ô)Ð)õ œœ x§~¢~°cÑ':Ô':Ð;ÐØÐ.Ñ.€IÝ$ YÑ/Ô/°*Ñ<ÐBTÐ?_Ð?_Ð?_Ñ_€MØ×)Ò)¨'Ñ2Ô2€Iõ 
„w�$‚€Ý�9‰~Œ~×(Ò(¨Ñ3Ô3ð 	M½½B¼G¿OºOÈIÑ<VÔ<VÑ8WÔ8WÐZ]Ò8]Ð8]Ý˜Y­¬¯ª¸Ñ)CÔ)CÑCÑDÔDˆIÝ˜Y­¬¯ª¸Ñ)CÔ)CÑCÑDÔDˆIÝ  ­R¬W¯_ª_¸]Ñ-KÔ-KÑ!KÑLÔLˆMàÔ×Ò 4°$ÐÑ7Ô7Ð7ØÔ×Ò t°dÐÑ;Ô;Ð;Ý!¨IÀÐZgÐhÑhÔhÐhr"   c                 óD  — t          |¦  «         t          j        j        |                     d¦  «        Ž }| |z  }t          | ¦  «        dz  |› d�z  }|                     d¦  «        }t          j        dk    rßt          | ¦  «         	                    d¦  «        s½t          t          j                             |¦  «        ¦  «        dk    r�t          dt          j                             |¦  «        z   ¦  «        }t          dt          j                             |¦  «        z   ¦  «        }t          dt          j                             |¦  «        z   ¦  «        }|j                             dd¬	¦  «         |j                             dd¬	¦  «         t          ||||¬
¦  «        S )aŽ  Compute paths to the files related to an upload process.

    Folders containing the paths are all guaranteed to exist.

    Args:
        local_dir (`Path`):
            Path to the local directory that is uploaded.
        filename (`str`):
            Path of the file in the repo.

    Return:
        [`LocalUploadFilePaths`]: the paths to the files (file_path, lock_path, metadata_path).
    rJ   Úuploadr[   r\   r   r   r   Tr]   )r,   r   r   r   )rW   r   r   r`   rQ   ra   rb   r   r   r   r   rc   r   r   rd   r+   re   s         r    Úget_local_upload_pathsrj     sr  € õ   Ñ)Ô)Ð)õ œœ x§~¢~°cÑ':Ô':Ð;ÐØÐ.Ñ.€IÝ$ YÑ/Ô/°(Ñ:Ð@RÐ=]Ð=]Ð=]Ñ]€MØ×)Ò)¨'Ñ2Ô2€Iõ 
„w�$‚€Ý�9‰~Œ~×(Ò(¨Ñ3Ô3ð 	M½½B¼G¿OºOÈIÑ<VÔ<VÑ8WÔ8WÐZ]Ò8]Ð8]Ý˜Y­¬¯ª¸Ñ)CÔ)CÑCÑDÔDˆIÝ˜Y­¬¯ª¸Ñ)CÔ)CÑCÑDÔDˆIÝ  ­R¬W¯_ª_¸]Ñ-KÔ-KÑ!KÑLÔLˆMàÔ×Ò 4°$ÐÑ7Ô7Ð7ØÔ×Ò t°dÐÑ;Ô;Ð;ÝØ¨¸iÐWdðñ ô ð r"   c           	      óh  — t          | |¦  «        }t          |j        ¦  «        5  |j                             ¦   «         �rÛ	 |j                             ¦   «         5 }|                     ¦   «                              ¦   «         }|                     ¦   «                              ¦   «         }t          |                     ¦   «                              ¦   «         ¦  «        }t          ||||¬¦  «        }ddd¦  «         n# 1 swxY w Y   n # t          $ r“}t                               d|j        › d|› d�¦  «         	 |j                             ¦   «          n<# t          $ r/}t                               d|j        › d|› �¦  «         Y d}~nd}~ww xY wY d}~ddd¦  «         dS d}~ww xY w	 |j                             ¦   «         }	|	j        dz
  |j        k    r|cddd¦  «         S t                               d|› d	�¦  «         n# t&          $ r Y ddd¦  «         dS w xY wddd¦  «         n# 1 swxY w Y   dS )
ar  Read metadata about a file in the local directory related to a download process.

    Args:
        local_dir (`Path`):
            Path to the local directory in which files are downloaded.
        filename (`str`):
            Path of the file in the repo.

    Return:
        `[LocalDownloadFileMetadata]` or `None`: the metadata if it exists, `None` otherwise.
    )r/   r0   r   r1   NúInvalid metadata file ú: ú%. Removing it from disk and continue.ú)Could not remove corrupted metadata file r   úIgnored metadata for 'ú#' (outdated). Will re-compute hash.)rg   r   r   r   Úexistsr@   ÚreadlineÚstripr2   r.   Ú	ExceptionÚloggerÚwarningÚunlinkr   ÚstatÚst_mtimer1   ÚinfoÚFileNotFoundError)
rX   r/   r<   rD   r0   r   r1   ÚmetadataÚery   s
             r    Úread_download_metadatar   2  s3  € õ % Y°Ñ9Ô9€EÝ	�e”oÑ	&Ô	&ð "ð "ØÔ×%Ò%Ñ'Ô'ñ !	ðØÔ(×-Ò-Ñ/Ô/ð 	°1Ø"#§*¢*¡,¤,×"4Ò"4Ñ"6Ô"6�KØŸ:š:™<œ<×-Ò-Ñ/Ô/�DÝ % a§j¢j¡l¤l×&8Ò&8Ñ&:Ô&:Ñ ;Ô ;�IÝ8Ø!)Ø$/Ø!Ø"+ð	 ñ  ô  �Hð		ð 	ð 	ñ 	ô 	ð 	ð 	ð 	ð 	ð 	ð 	øøøð 	ð 	ð 	ð 	øøõ ð 	ð 	ð 	å—’Øl¨UÔ-@ÐlÐlÀAÐlÐlÐlñô ð ðkØÔ'×.Ò.Ñ0Ô0Ð0Ð0øÝ ð kð kð kÝ—N’NÐ#iÈuÔObÐ#iÐ#iÐfgÐ#iÐ#iÑjÔjÐjÐjÐjÐjÐjÐjøøøøðkøøøà�t�t�tð-"ð "ð "ñ "ô "ð "ð "ð "øøøøð	øøøð
à”×+Ò+Ñ-Ô-�à”M AÑ%¨Ô);Ò;Ð;à#ð="ð "ð "ð "ñ "ô "ð "ð "õ> —’Ðb°XÐbÐbÐbÑcÔcÐcÐcøÝ$ð ð ð àðE"ð "ð "ñ "ô "ð "ð "ð "ð@øøøðA"ð "ð "ñ "ô "ð "ð "ð "ð "ð "ð "øøøð "ð "ð "ð "ðF ˆ4s´   ¥H'ÁDÁBC9Ã-DÃ9C=	Ã=DÄ C=	ÄDÄH'Ä
F"Ä&FÄ6EÅFÅ
F	Å%FÅ?FÆF	Æ	FÆH'ÆF"Æ"H'Æ&-G?Ç G?Ç>H'Ç?
HÈ	H'ÈHÈH'È'H+È.H+c                 ó<  — t          | |¦  «        }t          |j        ¦  «        5  |j                             ¦   «         �r›	 |j                             ¦   «         5 }t          |                     ¦   «                              ¦   «         ¦  «        }t          |                     ¦   «                              ¦   «         ¦  «        }|                     ¦   «                              ¦   «         }|dk    rdnt          t          |¦  «        ¦  «        }|                     ¦   «                              ¦   «         }|dk    rdn|}	|                     ¦   «                              ¦   «         }
|
dk    rdn|
}|dvrt          d|j        › d|› �¦  «        ‚|                     ¦   «                              ¦   «         }|dk    rdn|}t          t          |                     ¦   «                              ¦   «         ¦  «        ¦  «        }t          t          |                     ¦   «                              ¦   «         ¦  «        ¦  «        }t          ||||	||||¬¦  «        }ddd¦  «         n# 1 swxY w Y   nÌ# t          $ r¿}t                               d|j        › d|› d�¦  «         	 |j                             ¦   «          n<# t          $ r/}t                               d	|j        › d|› �¦  «         Y d}~nd}~ww xY wt          |j                             ¦   «         j        ¬
¦  «        cY d}~cddd¦  «         S d}~ww xY w|j        �4|j        r-|j        s&t1          j        ¦   «         |j        z
  dk    rd|_        	 |j        �5|j                             ¦   «         j        |j        k    r|cddd¦  «         S t                               d|› d�¦  «         n# t6          $ r Y nw xY wddd¦  «         n# 1 swxY w Y   t          |j                             ¦   «         j        ¬
¦  «        S )a©  Read metadata about a file in the local directory related to an upload process.

    TODO: factorize logic with `read_download_metadata`.

    Args:
        local_dir (`Path`):
            Path to the local directory in which files are downloaded.
        filename (`str`):
            Path of the file in the repo.

    Return:
        `[LocalUploadFileMetadata]` or `None`: the metadata if it exists, `None` otherwise.
    Ú N)NÚregularÚlfsz Invalid upload mode in metadata rm   )r1   r5   r6   r7   r8   r9   r:   r;   rl   rn   ro   )r5   i@ Frp   rq   )rj   r   r   r   rr   r@   r2   rs   rt   rC   rG   rR   r,   r4   ru   rv   rw   rx   r   ry   Úst_sizer1   r:   r;   rA   rz   r{   r|   )rX   r/   r<   rD   r1   r5   Ú_should_ignorer6   Ú_sha256r7   Ú_upload_moder8   Ú_remote_oidr9   r:   r;   r}   r~   s                     r    Úread_upload_metadatar‰   e  sø  € õ # 9¨hÑ7Ô7€EÝ	�e”oÑ	&Ô	&ð @ð @ØÔ×%Ò%Ñ'Ô'ñ ?	ð,TØÔ(×-Ò-Ñ/Ô/ð °1Ý % a§j¢j¡l¤l×&8Ò&8Ñ&:Ô&:Ñ ;Ô ;�Iå˜qŸzšz™|œ|×1Ò1Ñ3Ô3Ñ4Ô4�Dà%&§Z¢Z¡\¤\×%7Ò%7Ñ%9Ô%9�NØ,:¸bÒ,@Ð,@ D DÅdÍ3È~ÑK^ÔK^ÑF_ÔF_�MàŸjšj™lœl×0Ò0Ñ2Ô2�GØ%,°¢] ]˜T˜T¸�Fà#$§:¢:¡<¤<×#5Ò#5Ñ#7Ô#7�LØ*6¸"Ò*<Ð*< $ $À,�KØ"Ð*BÐBÐBÝ(Ð)oÈEÔL^Ð)oÐ)oÐbmÐ)oÐ)oÑpÔpÐpà"#§*¢*¡,¤,×"4Ò"4Ñ"6Ô"6�KØ)4¸Ò):Ð):  À�Jå"&¥s¨1¯:ª:©<¬<×+=Ò+=Ñ+?Ô+?Ñ'@Ô'@Ñ"AÔ"A�KÝ#'­¨A¯JªJ©L¬L×,>Ò,>Ñ,@Ô,@Ñ(AÔ(AÑ#BÔ#B�Lå6Ø"+Ø!Ø&3Ø%Ø$/Ø#-Ø$/Ø%1ð	 ñ 	 ô 	 �Hð-ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð øøõ@ ð Tð Tð Tå—’Øl¨UÔ-@ÐlÐlÀAÐlÐlÐlñô ð ðkØÔ'×.Ò.Ñ0Ô0Ð0Ð0øÝ ð kð kð kÝ—N’NÐ#iÈuÔObÐ#iÐ#iÐfgÐ#iÐ#iÑjÔjÐjÐjÐjÐjÐjÐjøøøøðkøøøõ /°E´O×4HÒ4HÑ4JÔ4JÔ4RÐSÑSÔSÐSÐSÐSÐSÐSð]@ð @ð @ð @ñ @ô @ð @ð @øøøøðFTøøøð Ô"Ð.ØÔ(ð /à Ô-ð /õ ”I‘K”K (Ô"4Ñ4°yÒ@Ð@à',�Ô$ðØÔ%Ð1°e´o×6JÒ6JÑ6LÔ6LÔ6UÐYaÔYkÒ6kÐ6kØ#ðy@ð @ð @ð @ñ @ô @ð @ð @õz —’Ðb°XÐbÐbÐbÑcÔcÐcÐcøÝ$ð ð ð à�ðøøøð}@ð @ð @ñ @ô @ð @ð @ð @ð @ð @ð @øøøð @ð @ð @ð @õF #¨¬×(<Ò(<Ñ(>Ô(>Ô(FÐGÑGÔGÐGsº   ¥O'ÁI(ÁG6IÉI(ÉI 	É I(É#I 	É$I(É'O'É(
L1É2&L,ÊJ3Ê2L,Ê3
K,Ê=%K'Ë"L,Ë'K,Ë,.L,ÌL1ÌO'Ì,L1Ì1>O'Í0/OÎ,OÏ
O'Ï
OÏO'ÏOÏO'Ï'O+Ï.O+r0   r   c           
      óB  — t          | |¦  «        }t          |j        ¦  «        5  |j                             d¦  «        5 }|                     |› d|› dt          j        ¦   «         › d�¦  «         ddd¦  «         n# 1 swxY w Y   ddd¦  «         dS # 1 swxY w Y   dS )zÄWrite metadata about a file in the local directory related to a download process.

    Args:
        local_dir (`Path`):
            Path to the local directory in which files are downloaded.
    r>   r?   N)rg   r   r   r   r@   rB   rA   )rX   r/   r0   r   r<   rD   s         r    Úwrite_download_metadatar‹   º  s!  € õ % Y°Ñ9Ô9€EÝ	�e”oÑ	&Ô	&ð ?ð ?ØÔ ×%Ò% cÑ*Ô*ð 	?¨aØ�GŠG�{Ð=Ð= dÐ=Ð=­d¬i©k¬kÐ=Ð=Ð=Ñ>Ô>Ð>ð	?ð 	?ð 	?ñ 	?ô 	?ð 	?ð 	?ð 	?ð 	?ð 	?ð 	?øøøð 	?ð 	?ð 	?ð 	?ð?ð ?ð ?ñ ?ô ?ð ?ð ?ð ?ð ?ð ?ð ?ð ?øøøð ?ð ?ð ?ð ?ð ?ð ?s5   ¥BÁ 0A<Á0BÁ<B 	Â BÂB 	ÂBÂBÂBc                 óv  — | dz  dz  }|}t           j        dk    rYt           j                             |¦  «        }t	          |¦  «        dk    r'|                     d¦  «        st          d|z   ¦  «        }|                     dd¬¦  «         t          |¦  «         |dz  }|d	z  }| 	                    ¦   «         s�	 t          |d
¬¦  «        5  |                     d¦  «         ddd¦  «         n# 1 swxY w Y   n# t          $ r Y nt          $ r Y nw xY w	 |                     ¦   «          n# t          $ r Y nw xY w|S )zKReturn the path to the `.cache/huggingface` directory in a local directory.z.cacheÚhuggingfacer   é÷   r   T)r_   r^   z
.gitignorez.gitignore.lockgš™™™™™¹?)ÚtimeoutÚ*N)r   r   r   rc   r   r   r   rd   Ú_create_cachedir_tagrr   r   Ú
write_textÚ
IndexErrorÚOSErrorrx   )rX   r   ÚtargetÚabs_pathÚ	gitignoreÚgitignore_locks         r    ra   ra   Ç  s·  € ð �xÑ -Ñ/€Dð €FÝ	„w�$‚€Ý”7—?’? 4Ñ(Ô(ˆÝˆx‰=Œ=˜3ÒÐ x×':Ò':¸9Ñ'EÔ'EÐÝ˜) hÑ.Ñ/Ô/ˆFØ
‡L‚L˜$¨€LÑ-Ô-Ð-õ ˜Ñ Ô Ð ð ˜Ñ%€IØÐ/Ñ/€NØ×ÒÑÔð ð	Ý˜n°cÐ:Ñ:Ô:ð *ð *Ø×$Ò$ SÑ)Ô)Ð)ð*ð *ð *ñ *ô *ð *ð *ð *ð *ð *ð *øøøð *ð *ð *ð *øøåð 	ð 	ð 	ØˆDÝð 	ð 	ð 	ØˆDð	øøøð	Ø×!Ò!Ñ#Ô#Ð#Ð#øÝð 	ð 	ð 	ØˆDð	øøøà€KsN   Â9C8 Ã
C,Ã C8 Ã,C0Ã0C8 Ã3C0Ã4C8 Ã8
DÄ	DÄDÄD) Ä)
D6Ä5D6Ú	cache_dirc                 ó”   — | dz  }|                      ¦   «         s.	 |                     t          ¦  «         dS # t          $ r Y dS w xY wdS )zöCreate a CACHEDIR.TAG file in ``cache_dir`` if one does not already exist.

    The tag follows the `Cache Directory Tagging Standard <http://www.brynosaurus.com/cachedir/>`_
    so that backup tools can recognize and skip cache directories.
    zCACHEDIR.TAGN)rr   r’   ÚCACHEDIR_TAG_CONTENTr”   )r™   Útag_paths     r    r‘   r‘   î  sl   € ð ˜>Ñ)€HØ�?Š?ÑÔð ð	Ø×ÒÕ 4Ñ5Ô5Ð5Ð5Ð5øÝð 	ð 	ð 	ØˆDˆDð	øøøðð s   ›7 ·
AÁAc                 óº   — t          j        t          j        |                      ¦   «         ¦  «                             ¦   «         ¦  «                             ¦   «         S rL   )Úbase64Úurlsafe_b64encodeÚhashlibÚsha1ÚencodeÚdigestÚdecode)r/   s    r    r   r   ü  s?   € ÝÔ#¥G¤L°·²Ñ1BÔ1BÑ$CÔ$C×$JÒ$JÑ$LÔ$LÑMÔM×TÒTÑVÔVÐVr"   ) r&   rž   r    Úloggingr   rA   Údataclassesr   Úpathlibr   r   r   Úutilsr   Ú	getLoggerr#   rv   r›   r
   r+   r.   r4   r   rW   rg   rj   r   r‰   r‹   ra   r‘   r   r(   r"   r    ú<module>rª      s  ðð#ð #ðJ €€€Ø €€€Ø €€€Ø 	€	€	€	Ø €€€Ø !Ð !Ð !Ð !Ð !Ð !Ø 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8Ð 8à Ð Ð Ð Ð Ð ð 
ˆÔ	˜8Ñ	$Ô	$€ð(ð ð ðð ð ð ð ñ ô ñ „ðð< €�$ÐÑÔðð ð ð ð ñ ô ñ Ôðð. ðð ð ð ð ñ ô ñ „ðð, ð-+ð -+ð -+ð -+ð -+ñ -+ô -+ñ „ð-+ð` ¨#ð  °$ð  ð  ð  ð  ðF i¨ð  i¸ð  iÐ@Vð  ið  ið  ið  iðF" dð "°cð "Ð>Rð "ð "ð "ð "ðJ0 dð 0°cð 0Ð>WÐZ^Ñ>^ð 0ð 0ð 0ð 0ðfRH Dð RH°Cð RHÐ<Sð RHð RHð RHð RHðj
? tð 
?°sð 
?Èð 
?ÐTWð 
?Ð\`ð 
?ð 
?ð 
?ð 
?ð$ ð $¨ð $ð $ð $ð $ðN Dð ¨Tð ð ð ð ðW˜#ð W #ð Wð Wð Wð Wð Wð Wr"   