+
    ~j                         R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RIH	t	 ^ RI
Ht ^ RIHt ^RIHt ]! ]4      t]R R	 l4       tRR
 R llt]RR R ll4       tR# )zFContains utilities to easily handle subprocesses in `huggingface_hub`.N)	Generator)contextmanager)StringIO)Path)IO)
get_loggerc                @    V ^8  d   QhR\         \        RR3,          /# )   returnN)r   r   )formats   "v/Users/mitch_tango/dev/rabbit-r1-livekit/agent/.venv/lib/python3.14/site-packages/huggingface_hub/utils/_subprocess.py__annotate__r       s     % %	(D$"67 %    c               #     "   \        4       p \        P                  pV \        n         V x  V\        n        R#   T\        n        i ; i5i)a  Capture output that is printed to terminal.

    Taken from https://stackoverflow.com/a/34738440

    Example:
    ```py
    >>> with capture_output() as output:
    ...     print("hello world")
    >>> assert output.getvalue() == "hello world
"
    ```
    N)r   sysstdout)outputprevious_outputs     r   capture_outputr      s6      ZFjjOCJ%$
_
s   &A
: A
AA
c                    V ^8  d   QhR\         \        \         ,          ,          R\         \        ,          R,          R\        P                  /# r	   commandfolderNr
   )strlistr   
subprocessCompletedProcess)r   s   "r   r   r   5   s=     ( (49_($J(
   (r   c                   \        V \        4      '       d   V P                  4       p \        V\        4      '       d   \        V4      p\        P
                  ! V 3RRRTRRRRRT;'       g    \        P                  ! 4       /VB # )	a  
Method to run subprocesses. Calling this will capture the `stderr` and `stdout`,
please call `subprocess.run` manually in case you would like for them not to
be captured.

Args:
    command (`str` or `list[str]`):
        The command to execute as a string or list of strings.
    folder (`str`, *optional*):
        The folder in which to run the command. Defaults to current working
        directory (from `os.getcwd()`).
    check (`bool`, *optional*, defaults to `True`):
        Setting `check` to `True` will raise a `subprocess.CalledProcessError`
        when the subprocess has a non-zero exit code.
    kwargs (`dict[str]`):
        Keyword arguments to be passed to the `subprocess.run` underlying command.

Returns:
    `subprocess.CompletedProcess`: The completed process.
r   Tcheckencodingutf-8errorsreplacecwd)
isinstancer   splitr   r   runosgetcwd)r   r   r   kwargss   &&&,r   run_subprocessr*   5   s    4 '3--/&$V>>  	
  !!biik  r   c          
          V ^8  d   QhR\         \        \         ,          ,          R\         \        ,          R,          R\        \        \
        \         ,          \
        \         ,          3,          RR3,          /# r   )r   r   r   r   tupler   )r   s   "r   r   r   a   sU     ., .,49_.,$J., uRWbg%&d23	.,r   c              +     "   \        V \        4      '       d   V P                  4       p \        P                  ! V 3R\        P
                  R\        P
                  R\        P                  RRRRRT;'       g    \        P                  ! 4       /VB ;_uu_ 4       pVP                  f   Q R
4       hVP                  f   Q R
4       hVP                  VP                  3x  R	R	R	4       R	#   + '       g   i     R	# ; i5i)a  Run a subprocess in an interactive mode in a context manager.

    Args:
        command (`str` or `list[str]`):
            The command to execute as a string or list of strings.
        folder (`str`, *optional*):
            The folder in which to run the command. Defaults to current working
            directory (from `os.getcwd()`).
        kwargs (`dict[str]`):
            Keyword arguments to be passed to the `subprocess.run` underlying command.

    Returns:
        `tuple[IO[str], IO[str]]`: A tuple with `stdin` and `stdout` to interact
        with the process (input and output are utf-8 encoded).

    Example:
    ```python
    with _interactive_subprocess("git credential-store get") as (stdin, stdout):
        # Write to stdin
        stdin.write("url=hf.co
username=obama
".encode("utf-8"))
        stdin.flush()

        # Read from stdout
        output = stdout.read().decode("utf-8")
    ```
    stdinr   stderrr   r    r!   r"   r#   Nz'subprocess is opened as subprocess.PIPE)r$   r   r%   r   PopenPIPESTDOUTr'   r(   r.   r   )r   r   r)   processs   &&, r   run_interactive_subprocessr4   `   s     @ '3--/				
oo	
 	
   		

 	
 	
 !!biik	
 	
 	
 
}}(S*SS(~~)T+TT)mmW^^++	
 	
 	
 	
s%   A6C>9"C>AC* 
C>*C;	5	C>)NT)N)__doc__r'   r   r   collections.abcr   
contextlibr   ior   pathlibr   typingr   loggingr   __name__loggerr   r*   r4    r   r   <module>r?      s`    M 	  
 % %     
H	 % %*(V ., .,r   