Ë
    Z²jÄ  ã            	       ó  — d Z ddlZddlZddlmZ ddlmZmZ  ej                  dej                  ej                  z  ej                  z  ¬«      Zdd	edz  d
ee   fd„Zddeded	edz  d
dfd„Zdded	edz  d
dfd„Zded
ee   fd„Zy)z-Contains utilities to manage Git credentials.é    Né   )ÚENDPOINTé   )Úrun_interactive_subprocessÚrun_subprocesszß
        ^\s* # start of line
        credential\.helper # credential.helper value
        \s*=\s* # separator
        ([\w\-\/]+) # the helper name or absolute path (group 1)
        (\s|$) # whitespace or end of line
    )ÚflagsÚfolderÚreturnc                 ó¬   — 	 t        d| ¬«      j                  }t        |«      }|S # t        j                  $ r}t        |j                  «      ‚d}~ww xY w)a“  Return the list of git credential helpers configured.

    See https://git-scm.com/docs/gitcredentials.

    Credentials are saved in all configured helpers (store, cache, macOS keychain,...).
    Calls "`git credential approve`" internally. See https://git-scm.com/docs/git-credential.

    Args:
        folder (`str`, *optional*):
            The folder in which to check the configured helpers.
    zgit config --list©r	   N)r   ÚstdoutÚ_parse_credential_outputÚ
subprocessÚCalledProcessErrorÚOSErrorÚstderr)r	   ÚoutputÚparsedÚexcs       úd/var/www/html/ia-enhanced/venv/lib/python3.12/site-packages/huggingface_hub/utils/_git_credential.pyÚlist_credential_helpersr   #   sN   € ð"ÜÐ 3¸FÔC×JÑJˆÜ)¨&Ó1ˆØˆøÜ×(Ñ(ò "Ü�c—j‘jÓ!Ð!ûð"ús   ‚#& ¦A¹AÁAÚtokenÚusernamec           
      óÈ   — t        d|¬«      5 \  }}|j                  dt        › d|j                  «       › d| › d�«       |j	                  «        ddd«       y# 1 sw Y   yxY w)a«  Save a username/token pair in git credential for HF Hub registry.

    Credentials are saved in all configured helpers (store, cache, macOS keychain,...).
    Calls "`git credential approve`" internally. See https://git-scm.com/docs/git-credential.

    Args:
        username (`str`, defaults to `"hf_user"`):
            A git username. Defaults to `"hf_user"`, the default user used in the Hub.
        token (`str`, defaults to `"hf_user"`):
            A git password. In practice, the User Access Token for the Hub.
            See https://huggingface.co/settings/tokens.
        folder (`str`, *optional*):
            The folder in which to check the configured helpers.
    zgit credential approver   úurl=z

username=z

password=z

N)r   Úwriter   ÚlowerÚflush)r   r   r	   ÚstdinÚ_s        r   Úset_git_credentialr!   7   sc   € ô 
$Ð$<ÀVÔ	Lð ñ QØØ	à�‰�dœ8˜* K°·±Ó0@Ð/AÀÈUÈGÐSWÐXÔYØ�‰Œ÷÷ ñ ús   ŽAAÁA!c                 óà   — t        d|¬«      5 \  }}dt        › d�}| �|d| j                  «       › d�z  }|dz  }|j                  |«       |j	                  «        ddd«       y# 1 sw Y   yxY w)aY  Erase credentials from git credential for HF Hub registry.

    Credentials are erased from the configured helpers (store, cache, macOS
    keychain,...), if any. If `username` is not provided, any credential configured for
    HF Hub endpoint is erased.
    Calls "`git credential erase`" internally. See https://git-scm.com/docs/git-credential.

    Args:
        username (`str`, defaults to `"hf_user"`):
            A git username. Defaults to `"hf_user"`, the default user used in the Hub.
        folder (`str`, *optional*):
            The folder in which to check the configured helpers.
    zgit credential rejectr   r   ú
Nz	username=)r   r   r   r   r   )r   r	   r   r    Ústandard_inputs        r   Úunset_git_credentialr%   N   s~   € ô 
$Ð$;ÀFÔ	Kð 
ñ PØØ	à¤˜z¨Ð,ˆØÐØ 	¨(¯.©.Ó*:Ð);¸2Ð>Ñ>ˆNØ˜$Ñˆà�‰�NÔ#Ø�‰Œ÷
÷ 
ñ 
ús   ŽAA$Á$A-r   c                 ój   — t        t        j                  | «      D �ch c]  }|d   ’Œ	 c}«      S c c}w )z›Parse the output of `git credential fill` to extract the password.

    Args:
        output (`str`):
            The output of `git credential fill`.
    r   )ÚsortedÚGIT_CREDENTIAL_REGEXÚfindall)r   Úmatchs     r   r   r   i   s8   € ô ä"6×">Ñ">¸vÓ"Fö	
ØˆE�!‹Hò	
óð ùò	
s   �0)N)Úhf_userN)Ú__doc__Úrer   Ú	constantsr   Ú_subprocessr   r   ÚcompileÚ	MULTILINEÚ
IGNORECASEÚVERBOSEr(   ÚstrÚlistr   r!   r%   r   © ó    r   ú<module>r8      sÀ   ðñ 4ã 	Û å  ß Cð "�r—z‘zðð �,‰,˜Ÿ™Ñ
&¨¯©Ñ
3ô	Ð ñ" C¨$¡Jð "¸$¸s¹)ó "ñ(˜cð ¨Sð ÀcÈDÁjð Ð\`ó ñ. 3ð ¸CÀ$¹Jð ÐRVó ð6 Sð ¨T°#©Yô r7   