HEX
Server: Apache
System: Linux p3plzcpnl506847.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: slfopp7cb1df (5698090)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: //opt/python38/lib/python3.8/site-packages/pip/_vendor/rich/__pycache__/jupyter.cpython-38.pyc
U

�{�e��@s�ddlmZmZmZmZmZmZer0ddlmZddl	m
Z
ddlmZddl
mZerdddlmZdZGdd	�d	�ZGd
d�d�Zeeed�d
d�Zeeedd�dd�Zeedd�dd�ZdS)�)�
TYPE_CHECKING�Any�Dict�Iterable�List�Sequence)�ConsoleRenderable�)�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@sFeZdZdZeedd�dd�Zeeeeeeeefd�dd�Z	dS)	�JupyterRenderablez)A shim to write html to Jupyter notebook.N)�html�text�returncCs||_||_dS)N)rr)�selfrr�r�</tmp/pip-unpacked-wheel-_0scjqea/pip/_vendor/rich/jupyter.py�__init__szJupyterRenderable.__init__)�include�exclude�kwargsrcsF|j|jd�}�r(�fdd�|��D�}�rB�fdd�|��D�}|S)N�z
text/plainz	text/htmlcsi|]\}}|�kr||�qSrr��.0�k�v�rrr�
<dictcomp>sz7JupyterRenderable._repr_mimebundle_.<locals>.<dictcomp>csi|]\}}|�kr||�qSrrr�rrrr s)rr�items)rrrr�datar�rrr�_repr_mimebundle_sz#JupyterRenderable._repr_mimebundle_)
�__name__�
__module__�__qualname__�__doc__�strrrrrr#rrrrr
s
�r
c@s:eZdZdZdZdeeeeeeeefd�dd�Z	dS)�JupyterMixinz@Add to an Rich renderable to make it render in Jupyter notebook.rr)rrrrrc	slt�}t|�||j��}t|�}|�|�}||d�}�rN�fdd�|��D�}�rh�fdd�|��D�}|S)Nrcsi|]\}}|�kr||�qSrrrrrrr5sz2JupyterMixin._repr_mimebundle_.<locals>.<dictcomp>csi|]\}}|�kr||�qSrrrrrrr7s)r
�list�render�options�_render_segmentsZ_render_bufferr )	rrrr�console�segmentsrrr!rr"rr#)s

zJupyterMixin._repr_mimebundle_N)
r$r%r&r'�	__slots__rr(rrr#rrrrr)$s
�r))r/rcCs�ttd�dd�}g}|j}t}t�|�D]b\}}}|r8q(||�}|r�|�|�}|rdd|�d|�d�n|}|jr�d|j�d|�d	�}||�q(d
�|�}	tj	|	d�}
|
S)N)rrcSs|�dd��dd��dd�S)zEscape html.�&z&amp;�<z&lt;�>z&gt;)�replace)rrrr�escape<sz _render_segments.<locals>.escapez
<span style="z">z</span>z	<a href="z" target="_blank">z</a>�)�code)
r(�appendrrZsimplifyZget_html_style�link�join�JUPYTER_HTML_FORMAT�format)r/r5�	fragmentsZappend_fragmentZthemer�style�controlZruler7rrrrr-;s"


r-N)r/rrcCsDt|�}t||�}zddlm}||�Wntk
r>YnXdS)zRender segments to Jupyter.r)�displayN)r-r
ZIPython.displayr@�ModuleNotFoundError)r/rrZjupyter_renderableZipython_displayrrrr@Ts
r@)�argsrrcOst�}|j||�S)zProxy for Console print.)r
�print)rBrr.rrrrCbsrC)�typingrrrrrrZpip._vendor.rich.consolerr6r
�segmentrZterminal_themerr;r
r)r(r-r@rCrrrr�<module>s