ó
    >:j@  ã                  óò   • S SK Jr  S SKrS SKJr  S SKJrJr  S SKJ	r	   " S S\	5      r
    S           SS jjr     S               SS	 jjr    S             SS
 jjrSS jrg)é    )ÚannotationsN)ÚPath)Úhf_hub_downloadÚsnapshot_download)Útqdmc                  ó<   ^ • \ rS rSrSrU 4S jrSU 4S jjrSrU =r$ )Údisabled_tqdmé
   zŸ
Class to override `disable` argument in case progress bars are globally disabled.

Taken from https://github.com/tqdm/tqdm/issues/619#issuecomment-619639324.
c                ó0   >• SUS'   [         TU ]  " U0 UD6  g )NTÚdisable)ÚsuperÚ__init__)ÚselfÚargsÚkwargsÚ	__class__s      €Ú_/home/mande/repo/quber/.venv/lib/python3.13/site-packages/sentence_transformers/util/file_io.pyr   Údisabled_tqdm.__init__   s   ø€ Ø ˆˆyÑÜ‰Ò˜$Ð) &Ó)ó    c                óT   >•  [         TU ]  U5        g! [         a
    US:w  a  e  gf = f)zBFix for https://github.com/huggingface/huggingface_hub/issues/1603Ú_lockN)r   Ú__delattr__ÚAttributeError)r   Úattrr   s     €r   r   Údisabled_tqdm.__delattr__   s3   ø€ ð	Ü‰GÑ Õ%øÜó 	Ø�w‹Øñ ð	ús   ƒ “'¦'© )r   ÚstrÚreturnÚNone)	Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__Ú__classcell__)r   s   @r   r	   r	   
   s   ø† ñõ*÷õ r   r	   c                ó0   • [        [        U SUUUUS95      $ )aU  
Checks if the given model name or path corresponds to a SentenceTransformer model.

Args:
    model_name_or_path (str): The name or path of the model.
    token (Optional[Union[bool, str]]): The token to be used for authentication. Defaults to None.
    cache_folder (Optional[str]): The folder to cache the model files. Defaults to None.
    revision (Optional[str]): The revision of the model. Defaults to None.
    local_files_only (bool): Whether to only use local files for the model. Defaults to False.

Returns:
    bool: True if the model is a SentenceTransformer model, False otherwise.
zmodules.json)ÚtokenÚcache_folderÚrevisionÚlocal_files_only)ÚboolÚload_file_path)Úmodel_name_or_pathr(   r)   r*   r+   s        r   Úis_sentence_transformer_modelr/      s+   € ô( ÜØØØØ%ØØ-ñ	
ó	ð 	r   c                óö   • [        XU5      nUR                  5       (       a  [        U5      $ [        X!5      n [        U UR                  UR
                  R                  5       USUUUS9$ ! [         a     gf = f)aÕ  
Loads a file from a local or remote location.

Args:
    model_name_or_path (str): The model name or path.
    filename (str): The name of the file to load.
    subfolder (str): The subfolder within the model subfolder (if applicable).
    token (Optional[Union[bool, str]]): The token to access the remote file (if applicable).
    cache_folder (Optional[str]): The folder to cache the downloaded file (if applicable).
    revision (Optional[str], optional): The revision of the file (if applicable). Defaults to None.
    local_files_only (bool, optional): Whether to only consider local files. Defaults to False.

Returns:
    Optional[str]: The path to the loaded file, or None if the file could not be found or loaded.
úsentence-transformers)ÚfilenameÚ	subfolderr*   Úlibrary_namer(   Ú	cache_dirr+   N)r   Úexistsr   r   ÚnameÚparentÚas_posixÚ	Exception)r.   r2   r3   r(   r)   r*   r+   Ú	file_paths           r   r-   r-   >   s‡   € ô2 Ð'°HÓ=€IØ×Ñ×ÑÜ�9‹~Ðô �YÓ)€IðÜØØ—^‘^Ø×&Ñ&×/Ñ/Ó1ØØ0ØØ"Ø-ñ	
ð 		
øô ó Ùðús   ¹1A+ Á+
A8Á7A8c           	     óV  • [        U[        5      (       a  UR                  5       n[        X5      nUR                  5       (       a  [	        U5      $ U UUS;  a  U S3OSSUUU[
        S.n [        S0 UD6n[	        [        X�5      5      $ ! [         a    SUS'   [        S0 UD6n N0f = f)	a:  
Loads the subfolder path for a given model name or path.

Args:
    model_name_or_path (str): The name or path of the model.
    subfolder (str): The subfolder to load.
    token (Optional[Union[bool, str]]): The token for authentication.
    cache_folder (Optional[str]): The folder to cache the downloaded files.
    revision (Optional[str], optional): The revision of the model. Defaults to None.
    local_files_only (bool, optional): Whether to only use local files. Defaults to False.

Returns:
    Optional[str]: The subfolder path if it exists, otherwise None.
)Ú Ú.z/**Nr1   )Úrepo_idr*   Úallow_patternsr4   r(   r5   r+   Ú
tqdm_classTr+   r   )Ú
isinstancer   r9   r6   r   r	   r   r:   )	r.   r3   r(   r)   r*   r+   Údir_pathÚdownload_kwargsÚ	repo_paths	            r   Úload_dir_pathrF   l   sÁ   € ô, �)œT×"Ñ"Ø×&Ñ&Ó(ˆ	ô Ð&Ó2€HØ‡�×ÑÜ�8‹}Ðð &ØØ/8À	Ó/I˜Y˜K sÑ+ÈtØ/ØØ!Ø,Ü#ñ	€Oð9Ü%Ñ8¨Ñ8ˆ	ô
 Œt�IÓ)Ó*Ð*øô	 ó 9à.2ˆÐ*Ñ+Ü%Ñ8¨Ñ8Š	ð9ús   Á,B ÂB(Â'B(c                ó  •  SSK n[        R                  R	                  U5      S:w  a2  [        R
                  " [        R                  R	                  U5      SS9  US-   nUR                  SU SS	9 nUR                  5         UR                  R                  S
5      nUb  [        U5      OSn[        SUSSS[        R                  R                  U5       3S9n [        US5       nUR                  SS9 H7  n	U	(       d  M  UR                  [!        U	5      5        UR#                  U	5        M9     SSS5        [        R$                  " X15         UR-                  5          SSS5        g! [         a    [        S5      ef = f! , (       d  f       NX= f! [&         a<    [        R                  R)                  U5      (       a  [        R*                  " U5        e f = f! UR-                  5         f = f! , (       d  f       g= f)a“  Download a URL to a local file with a progress bar.

The content is streamed in chunks and first written to a temporary
``"<path>_part"`` file, which is atomically moved to ``path`` once the
download has completed successfully. Parent directories of ``path`` are
created automatically if they do not exist.

Args:
    url (str): The HTTP(S) URL to download.
    path (str): Destination file path on the local filesystem.

Raises:
    ImportError: If the optional ``httpx`` dependency is not installed.
    httpx.HTTPStatusError: If the HTTP request returns a non-success status code.
    OSError: If the file cannot be written to ``path``.

Returns:
    None
r   NzRhttpx is required to use this function. Please install it via `pip install httpx`.r=   T)Úexist_okÚ_partÚGET)Úfollow_redirectszContent-LengthÚBFzDownloading )ÚunitÚtotalÚ
unit_scaleÚleaveÚdescÚwbi   )Ú
chunk_size)ÚhttpxÚImportErrorÚosÚpathÚdirnameÚmakedirsÚstreamÚraise_for_statusÚheadersÚgetÚintr   ÚbasenameÚopenÚ
iter_bytesÚupdateÚlenÚwriteÚreplacer:   r6   ÚremoveÚclose)
ÚurlrW   rT   Údownload_filepathÚresponseÚcontent_lengthrN   ÚprogressÚfile_binaryÚchunks
             r   Úhttp_getro   ž   s§  € ð(pÛô 
‡w�w‡��tÓ Ó"Ü
�Š”B—G‘G—O‘O DÓ)°DÒ9à˜w™ÐØ	�‰�e˜S°4ˆÑ	8¸HØ×!Ñ!Ô#Ø!×)Ñ)×-Ñ-Ð.>Ó?ˆØ'5Ñ'A”�NÔ#ÀtˆÜØ˜E¨d¸%ÈÔUW×U\ÑU\×UeÑUeÐfjÓUkÐTlÐFmñ
ˆð	ÜÐ'¨Ô.°+Ø%×0Ñ0¸DÐ0ÓA�Eß�uØ Ÿ™¬¨E«
Ô3Ø#×)Ñ)¨%Ö0ñ B÷ /ô
 �JŠJÐ(Õ/ð �N‰NÕ÷) 
9Ð	8øô ó pÜÐnÓoÐoðpú÷  /Õ.ûô ó 	Ü�w‰w�~‰~Ð/×0Ñ0Ü—	’	Ð+Ô,Øð	ûð
 �N‰NÕú÷) 
9Õ	8ús[   ‚E+ Á1A)G3ÃFÃ'FÄ/FÄ2FÅG3Å+FÆ
F	ÆFÆAGÇGÇG0Ç0G3Ç3
H)NNNF)r.   r   r(   úbool | str | Noner)   ú
str | Noner*   rq   r+   r,   r   r,   )r=   NNNF)r.   r   r2   z
str | Pathr3   r   r(   rp   r)   rq   r*   rq   r+   r,   r   rq   )r.   r   r3   r   r(   rp   r)   rq   r*   rq   r+   r,   r   rq   )rh   r   rW   r   r   r   )Ú
__future__r   rV   Úpathlibr   Úhuggingface_hubr   r   Útqdm.autonotebookr   r	   r/   r-   rF   ro   r   r   r   Ú<module>rv      s*  ðÝ "ã 	Ý ç >Ý "ô�Dô ð,  $Ø#ØØ"ðØðàðð ðð ð	ð
 ðð 
õðF Ø#Ø#ØØ"ð+Øð+àð+ð ð+ð ð	+ð
 ð+ð ð+ð ð+ð õ+ðb  $Ø#ØØ"ð/+Øð/+àð/+ð ð/+ð ð	/+ð
 ð/+ð ð/+ð õ/+õd1r   