HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/pip/_vendor/rich/__pycache__/jupyter.cpython-310.pyc
o

@%Ne��@s�ddlmZmZmZmZddlmZddlmZddl	m
Z
dZGdd�d�ZGd	d
�d
�Z
deedefd
d�Zdeededdfdd�Zdededdfdd�ZdS)�)�Any�Dict�Iterable�List�)�get_console)�Segment)�DEFAULT_TERMINAL_THEMEz�<pre style="white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace">{code}</pre>
c
@sPeZdZdZdededdfdd�Zdeed	eed
edeeeffdd�Z	dS)
�JupyterRenderablez)A shim to write html to Jupyter notebook.�html�text�returnNcCs||_||_dS)N)rr)�selfrr�r�:/usr/lib/python3/dist-packages/pip/_vendor/rich/jupyter.py�__init__s
zJupyterRenderable.__init__�include�exclude�kwargscsF|j|jd�}�r�fdd�|��D�}�r!�fdd�|��D�}|S)N�z
text/plainz	text/htmlc�i|]\}}|�vr||�qSrr��.0�k�v�rrr�
<dictcomp>�z7JupyterRenderable._repr_mimebundle_.<locals>.<dictcomp>c�i|]\}}|�vr||�qSrrr�rrrrr)rr�items)rrrr�datar�rrr�_repr_mimebundle_sz#JupyterRenderable._repr_mimebundle_)
�__name__�
__module__�__qualname__�__doc__�strrrrrr#rrrrr
s���
�r
c
@s>eZdZdZdZdeedeededeeeffdd�Z	d	S)
�JupyterMixinz@Add to an Rich renderable to make it render in Jupyter notebook.rrrrr
c	slt�}t|�||j��}t|�}|�|�}||d�}�r'�fdd�|��D�}�r4�fdd�|��D�}|S)Nrcrrrrrrrr,rz2JupyterMixin._repr_mimebundle_.<locals>.<dictcomp>crrrrrrrr.r)r�list�render�options�_render_segments�_render_bufferr )	rrrr�console�segmentsrrr!rr"rr##s

zJupyterMixin._repr_mimebundle_N)
r$r%r&r'�	__slots__rr(rrr#rrrrr)s���
�r)r0r
cCs�dtdtfdd�}g}|j}t}t�|�D]1\}}}|rq||�}|rB|�|�}|r3d|�d|�d�n|}|jrBd|j�d|�d	�}||�qd
�|�}	tj	|	d�}
|
S)Nrr
cSs|�dd��dd��dd�S)zEscape html.�&z&amp;�<z&lt;�>z&gt;)�replace)rrrr�escape3sz _render_segments.<locals>.escapez
<span style="z">z</span>z	<a href="z</a>�)�code)
r(�appendr	r�simplify�get_html_style�link�join�JUPYTER_HTML_FORMAT�format)r0r6�	fragments�append_fragment�themer�style�control�ruler8rrrrr-2s"


r-rNcCsBt|�}t||�}z
ddlm}||�WdSty YdSw)zRender segments to Jupyter.r)�displayN)r-r
�IPython.displayrF�ModuleNotFoundError)r0rr�jupyter_renderable�ipython_displayrrrrFKs
�rF�argsrcOst�}|j|i|��S)zProxy for Console print.)r�print)rKrr/rrrrLYsrL)�typingrrrrr7r�segmentr�terminal_themer	r>r
r)r(r-rFrLrrrr�<module>s