| Server IP : 35.80.110.71 / Your IP : 216.73.216.117 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/IPython/utils/__pycache__/ |
Upload File : |
�
}�e � � � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m
Z
ddlmZm
Z
G d� d e� Zdd
�Zdd�Ze
d� � Ze
d
� � Zy)z
IO related utilities.
� N)�Path)�warn)�undoc� )�
CapturedIO�capture_outputc �0 � e Zd ZdZdd�Zd� Zd� Zd� Zd� Zy) �Teez�A 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 � � |dvrt d|z � �t |d� rt |d� r|| _ nd|v rdnd}t |||�� | _ || _ t t |� | _ t t || � d | _ y)
aN 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�stderrzInvalid 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 �2/usr/lib/python3/dist-packages/IPython/utils/io.py�__init__zTee.__init__ s} � � �.�.��6��@�A�A��<��)�g�l�F�.K�$�D�I�"�d�{�t��H��\�4�(�C�D�I�����s�G�,�����W�d�#���� c � � | j � t t | j | j � | j
j
� d| _ y)z'Close the file and restore the channel.TN)�flushr r r r r �closer �r s r! r&