
    <hX                         S r SSKrSSKrSSKrSSKrSSKJr  SSKJr  SSK	J
r
  SSKJrJr   " S S	5      rSS
 jrSS jrg)z
IO related utilities.
    N)Path)warn)undoc   )
CapturedIOcapture_outputc                   @    \ rS rSrSrSS jrS rS rS rS r	S r
S	rg
)Tee   zA class to duplicate an output stream to stdout/err.

This works in a manner very similar to the Unix 'tee' command.

When the object is closed or deleted, it closes the original file given to
it for duplication.
c                    US;  a  [        SU-  5      e[        US5      (       a  [        US5      (       a  Xl        OSU;   a  SOSn[        XUS9U l        X0l        [        [        U5      U l        [        [        X05        S	U l	        g)
a  Construct a new Tee object.

Parameters
----------
file_or_name : filename or open filehandle (writable)
    File that will be duplicated
mode : optional, valid mode for open().
    If a filename was give, open with this mode.
channel : str, one of ['stdout', 'stderr']
)stdoutstderrzInvalid channel spec %swriteseekbNutf-8encodingF)

ValueErrorhasattrfileopenchannelgetattrsysostreamsetattr_closed)selffile_or_namemoder   r   s        cC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\IPython/utils/io.py__init__Tee.__init__!   s{     ..6@AA<))glF.K.K$I"d{tH\(CDIsG,W#    c                     U R                  5         [        [        U R                  U R                  5        U R
                  R                  5         SU l        g)z'Close the file and restore the channel.TN)flushr   r   r   r   r   closer   r   s    r"   r(   	Tee.close9   s4    

T\\4<<0		r%   c                     U R                   R                  U5        U R                  R                  U5        U R                  R                  5         g)zWrite data to both channels.N)r   r   r   r'   )r   datas     r"   r   	Tee.write@   s4    		4 r%   c                 l    U R                   R                  5         U R                  R                  5         g)zFlush both channels.N)r   r'   r   r)   s    r"   r'   	Tee.flushF   s     		r%   c                 H    U R                   (       d  U R                  5         g g )N)r   r(   r)   s    r"   __del__Tee.__del__K   s    ||JJL r%   c                     g)NF r)   s    r"   isatty
Tee.isattyO   s    r%   )r   r   r   r   N)wr   )__name__
__module____qualname____firstlineno____doc__r#   r(   r   r'   r1   r5   __static_attributes__r4   r%   r"   r
   r
      s%    0
r%   r
   c                 V   SSSSS.nSnXCR                  5       ;  a;   [        U S-   5      R                  5       nU(       d  UnXCR                  5       ;  a  M;  X4   $ ! [         a    U(       a  Un[	        S5         N9[
         a#    XR                  5       ;   a  Un[	        5          Nce f = f)a  Asks a question and returns a boolean (y/n) answer.

If default is given (one of 'y','n'), it is used if the user input is
empty. If interrupt is given (one of 'y','n'), it is used if the user
presses Ctrl-C. Otherwise the question is repeated until an answer is
given.

An EOF is treated as the default answer.  If there is no default, an
exception is raised to prevent infinite loops.

Valid answers are: y/yes/n/no (match is not case sensitive).TF)ynyesnoN )keysinputlowerKeyboardInterruptprintEOFError)promptdefault	interruptanswersanss        r"   
ask_yes_norP   R   s     E%8G
C
\\^
#	s
#))+C	 \\^
#  < ! 	$K 	,,.(	s   %A B(<(B(&B(c                     [         R                  " U5      S   n[        [        U5      SSS9 nUR	                  U 5        UR                  5         SSS5        U$ ! , (       d  f       U$ = f)a|  Make a temporary python file, return filename and filehandle.

Parameters
----------
src : string or list of strings (no need for ending newlines if list)
    Source code to be written to the file.
ext : optional, string
    Extension for the generated file.

Returns
-------
(filename, open filehandle)
    It is the caller's responsibility to close the open file and unlink it.
r   r7   r   r   N)tempfilemkstempr   r   r   r'   )srcextfnamefs       r"   temp_pyfilerX   t   s[     S!!$E	d5k3	1Q			 
2 L 
2	1 Ls   "A
A))NN)z.py)r<   atexitosr   rR   pathlibr   warningsr   IPython.utils.decoratorsr   capturer   r   r
   rP   rX   r4   r%   r"   <module>r_      s:     	 
    * /: :xDr%   