U
    ;»{j  ã                	   @   sè   d dl mZ d dlmZmZmZmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZmZ ertdd	lmZ d
ddd
d
dœdee eeee ee ddœdd„Zedkräd dlmZ eƒ  eed
dœdd„Zeddƒ eƒ  d
S )é    )ÚMapping)ÚTYPE_CHECKINGÚAnyÚOptionalÚTupleé   )ÚReprHighlighter)ÚPanel)ÚPretty)ÚTable)ÚTextÚTextType)ÚConsoleRenderableNTF)ÚtitleÚ	sort_keysÚindent_guidesÚ
max_lengthÚ
max_stringzMapping[str, Any]r   )Úscoper   r   r   r   r   Úreturnc                C   s´   t ƒ }tjddd�}|jdd� tttf tttf dœdd„}|rTt|  	¡ |d	�n|  	¡ }	|	D ]@\}
}t
 |
|
 d
¡r|dndfd¡}| |t|||||d�¡ q`tj||ddd�S )a­  Render python variables in a given scope.

    Args:
        scope (Mapping): A mapping containing variable names and values.
        title (str, optional): Optional title. Defaults to None.
        sort_keys (bool, optional): Enable sorting of items. Defaults to True.
        indent_guides (bool, optional): Enable indentation guides. Defaults to False.
        max_length (int, optional): Maximum length of containers before abbreviating, or None for no abbreviation.
            Defaults to None.
        max_string (int, optional): Maximum length of string before truncating, or None to disable. Defaults to None.

    Returns:
        ConsoleRenderable: A renderable object.
    )r   r   F)ÚpaddingÚexpandÚright)Zjustify)Úitemr   c                 S   s   | \}}|  d¡ | ¡ fS )z2Sort special variables first, then alphabetically.Ú__)Ú
startswithÚlower)r   ÚkeyÚ_© r   ú7/tmp/pip-install-zsn1f9xv/pip/pip/_vendor/rich/scope.pyÚ
sort_items)   s    z render_scope.<locals>.sort_items)r   r   zscope.key.specialz	scope.key)z =zscope.equals)Úhighlighterr   r   r   zscope.border)r   Zborder_styler   )r   r   ZgridZ
add_columnr   Ústrr   ÚboolÚsortedÚitemsr   Zassembler   Zadd_rowr
   r	   Zfit)r   r   r   r   r   r   r"   Zitems_tabler!   r&   r   ÚvalueZkey_textr   r   r    Úrender_scope   s4     þûþ
ür(   Ú__main__)Úprint)ÚfooÚbarr   c                 C   sF   dddd ddddg}dd	d
dddgdgddœ}t ttƒ ddd�ƒ d S )Nr   é   é   é   TFzHello Worldz1.1ZconfirmFruitPurchaseZappleZorangeZmangoesZpomelog+‡ÙÎ÷ñ?Z	194521489)ÚversionÚmethodÚparamsÚidz	[i]locals)r   r   )r*   r(   Úlocals)r+   r,   Zlist_of_thingsZdict_of_thingsr   r   r    ÚtestK   s    ür5   gºk	ù W4@gÉå?$	@)Úcollections.abcr   Útypingr   r   r   r   r"   r   Zpanelr	   Úprettyr
   Útabler   Útextr   r   Úconsoler   r$   Úintr(   Ú__name__Zpip._vendor.richr*   Úfloatr5   r   r   r   r    Ú<module>   s8   ùø8

