o
    vi                     @   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r<dd	lmZmZ d
ddd
d
d
d
ddddee dededee dee dee ded ddfddZedkrd dlmZ e  dededd
fd d!Zed"d# e  d
S d
S )$    )Mapping)TYPE_CHECKINGAnyOptionalTuple   )ReprHighlighter)Panel)Pretty)Table)TextTextType)ConsoleRenderableOverflowMethodNTF)title	sort_keysindent_guides
max_length
max_string	max_depthoverflowscopezMapping[str, Any]r   r   r   r   r   r   r   r   returnr   c                C   s   t  }tjddd}	|	jdd dtttf dtttf fdd	}
|r+t| 	 |
d
n| 	 }|D ]"\}}t
||dr?dndfd}|	|t|||||||d q1t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.
        max_depth (int, optional): Maximum depths of locals before truncating, or None to disable. Defaults to None.
        overflow (OverflowMethod, optional): How to handle overflowing locals, or None to disable. Defaults to None.

    Returns:
        ConsoleRenderable: A renderable object.
    )r   r   F)paddingexpandright)justifyitemr   c                 S   s   | \}}| d | fS )z2Sort special variables first, then alphabetically.__)
startswithlower)r   key_ r#   I/home/air/biblejyuku/back/venv/lib/python3.10/site-packages/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   r   r   zscope.border)r   border_styler   )r   r   grid
add_columnr   strr   boolsorteditemsr   assembler   add_rowr
   r	   fit)r   r   r   r   r   r   r   r   r&   items_tabler%   r-   r!   valuekey_textr#   r#   r$   render_scope   s8   "r4   __main__)printfoobarc                 C   s6   g d}ddg ddgdd}t tt dd	d
 d S )N)r         N   TFzHello Worldz1.1confirmFruitPurchase)appleorangemangoespomelog+?	194521489)versionmethodparamsidz	[i]localsF)r   r   )r6   r4   locals)r7   r8   list_of_thingsdict_of_thingsr#   r#   r$   testQ   s   
rI   gk	W4@g?$	@)collections.abcr   typingr   r   r   r   r&   r   panelr	   prettyr
   tabler   textr   r   consoler   r   r+   intr4   __name__richr6   floatrI   r#   r#   r#   r$   <module>   sT    	

>


