L iddlmZddlZddlZddlZddlZddlZddlmZm Z m Z m Z ddl m Z erddlmZmZej"dZej"dZe dej( d d d Zdd Zdd Zy)) annotationsN) TYPE_CHECKINGAnyLiteralcast)gather_metrics) GeneratorIterablez\s*z\s* echoc#Kddlm}m}m}m}|dk(r|}|}n|}|j}|j} t j d}|j|jxsd} } |j| 5} | j} dddtjdj } id fd | | jdjdz }| j}| ||}t!j"dj|}d||d y#1swYxYw#t$$r}|d |Yd}~yd}~wwxYww) aUse in a `with` block to draw some code on the app, then execute it. Parameters ---------- code_location : "above" or "below" Whether to show the echoed code before or after the results of the executed code block. Example ------- >>> import streamlit as st >>> >>> with st.echo(): >>> st.write('This code will be printed') r)codeempty source_utilwarningbelowNct|dsytj|D]0}t|ds|td|j<|2y)Nbodylinenoint)hasattrastiter_child_nodesrr)nodechildcollect_body_statementsline_to_node_maps ]/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/streamlit/commands/echo.pyrz%echo..collect_body_statementsNsR4(--d3 35(+BG$T%%>?+E2  3pythonzUnable to display code. )rzast.ASTreturnNone) streamlitr rrr traceback extract_stackfilenameropen_python_file readlinesrparsejoinr end_linenotextwrapdedentFileNotFoundError) code_locationr rrr show_code show_warning placeholderframer( start_line source_file source_lines root_nodeecho_block_start_lineecho_block_end_linelines_to_display code_stringerrrrs @@rr r !sa*<;  g $$ "** (7'')"-$~~u||/@q* ) )( 3 3{&002L 3IIbggl34 +- 3 *!1 < A A! D K Ka O.z:EE'(=>QRoobgg.>&?@   +x(= 3 3@ 7/u5667sH6EAD>?D2B!D>1E2D;7D>> E EEEEc4|D]}t|}||cSy)zeReturn the indent of the first non-empty line in the list. If all lines are empty, return 0. r) _get_indent)lineslineindents r_get_initial_indentrDks-T"  M r ctj|ytj|}||jSdS)zGet the number of whitespaces at the beginning of the given line. If the line is empty, or if it contains just whitespace and a newline, return None. Nr)_EMPTY_LINE_REmatch _SPACES_REend)rBrGs rr@r@ws> D!-   T "E+599;22r )above)r1zLiteral['above', 'below']r#zGenerator[None, None, None])rAz Iterable[str]r#r)rBstrr#z int | None) __future__rr contextlibrer.r&typingrrrrstreamlit.runtime.metrics_utilrcollections.abcr r compilerHrFcontextmanagerr rDr@r rrUs#  4493 RZZ  H% /6E7,E7 E7E7P   3r