"Te ddlmZddlmZmZmZmZddlmZddl m Z ddl m Z ddl mZddlmZmZerdd lmZd d d d d d dddeedededeedeeddfdZedk(r(ddlmZedededd fdZeddey y ))Mapping) TYPE_CHECKINGAnyOptionalTuple)ReprHighlighter)Panel)Pretty)Table)TextTextType)ConsoleRenderableNTF)title sort_keys indent_guides max_length max_stringscopezMapping[str, Any]rrrrrreturnrc t}tjdd}|jddtt t fdttt ffd}|rt|j| n|j} | D]P\} } tj| | jd rd nd fd } |j| t| ||||Rtj ||ddS)aRender 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. )rrF)paddingexpandright)justifyitemrcP|\}}|jd |jfS)z2Sort special variables first, then alphabetically.__) startswithlower)rkey_s ,/usr/lib/python3/dist-packages/rich/scope.py sort_itemsz render_scope..sort_items)s(QNN4((#))+66)r!rzscope.key.specialz scope.key)z =z scope.equals) highlighterrrrz scope.border)r border_styler)r r grid add_columnrstrrboolsorteditemsr assembleradd_rowr r fit) rrrrrrr& items_tabler$r-r!valuekey_texts r# render_scoper4s."#K**VE:K7+7sCx7U49-=7 6?F5;;=j 1EKKME U== )=%; O "    '+%%     99#  r%__main__)printfoobarc`gd}ddgddgdd}tttdd y) N)rNTFz Hello Worldz1.1confirmFruitPurchase)appleorangemangoespomelog+? 194521489)versionmethodparamsidz [i]localsF)rr)r6r4locals)r7r8list_of_thingsdict_of_thingss r#testrJKs4G,?G   l68;%HIr%gk W4@g?$ @)collections.abcrtypingrrrrr&r panelr prettyr tabler textr rconsolerr+intr4__name__richr6floatrJr%r#rWs#66( * !% $ $5 5 H 5 5  5  5 55p z GJ%JeJJ & G!r%