)L i& vddlmZddlmZddlmZmZmZddlm Z ddl m Z m Z ddl mZddlmZmZmZddlmZdd lmZdd lmZmZdd lmZdd lmZdd lm Z m!Z!m"Z"m#Z#m$Z$erddl%m&Z&gdZ'dddddddddd ddZ d ddZ( ddZ)d dZ*d!dZ+d dZ,y)") annotations)AbstractEventLoop) TYPE_CHECKINGAnyTextIO) Application)get_app_or_noneget_app_sessionrun_in_terminal) FormattedTextStyleAndTextTuplesto_formatted_text) DummyInput)Layout) ColorDepthOutput) create_output)print_formatted_text) BaseStyleStyleTransformationdefault_pygments_styledefault_ui_style merge_styles) AnyContainer)rprint_containerclear set_title clear_title  NFT) sependfileflushstyleoutput color_depthstyle_transformationinclude_default_pygments_stylec $r|rJ#|r t|ntjttsJxsj dd} gt | D]H\} } j| | |s | t| dz k7s2j| |Jj| |dfd d} t}| |j} | | jfdyy) a :: print_formatted_text(*values, sep=' ', end='\n', file=None, flush=False, style=None, output=None) Print text to stdout. This is supposed to be compatible with Python's print function, but supports printing of formatted text. You can pass a :class:`~prompt_toolkit.formatted_text.FormattedText`, :class:`~prompt_toolkit.formatted_text.HTML` or :class:`~prompt_toolkit.formatted_text.ANSI` object to print formatted text. * Print HTML as follows:: print_formatted_text(HTML('Some italic text This is red!')) style = Style.from_dict({ 'hello': '#ff0066', 'world': '#884444 italic', }) print_formatted_text(HTML('Hello world!'), style=style) * Print a list of (style_str, text) tuples in the given style to the output. E.g.:: style = Style.from_dict({ 'hello': '#ff0066', 'world': '#884444 italic', }) fragments = FormattedText([ ('class:hello', 'Hello'), ('class:world', 'World'), ]) print_formatted_text(fragments, style=style) If you want to print a list of Pygments tokens, wrap it in :class:`~prompt_toolkit.formatted_text.PygmentsTokens` to do the conversion. If a prompt_toolkit `Application` is currently running, this will always print above the application or prompt (similar to `patch_stdout`). So, `print_formatted_text` will erase the current application, print the text, and render the application again. :param values: Any kind of printable object, or formatted string. :param sep: String inserted between values, default a space. :param end: String appended after the last value, default a newline. :param style: :class:`.Style` instance for the color scheme. :param include_default_pygments_style: `bool`. Include the default Pygments style when set to `True` (the default). Nstdoutctt|trt|ts t|St|dS)NT) auto_convert) isinstancelistr r)vals d/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/prompt_toolkit/shortcuts/utils.pyto_textz%print_formatted_text..to_textws1 c4 C)G$u. . 488cttsJttrj yy)Nr*)r(r))r0rrenderer_print_formatted_text_create_merged_styler%)r(r% fragmentsr*r'r&r)sr3renderz$print_formatted_text..rendersJ&&)))%   6T $!5   LLN r5ctS)Nr )r<sr3z&print_formatted_text..s /&*Ar5)r2rreturnrr?None) rr r'r0rget_default_color_depth enumerateextendlenr loopcall_soon_threadsafe)r"r#r$r%r&r'r(r)r*valuesr4ivaluerFappr;r<s `````` @@r3rr)s~4 ~ "$/F$&--F ff %% %A!?!?!AK9If%+5( 1F a'   WS\ * + WS\"&&*D  C xx  !!"ABr5c |r t|}ntj}tt ||t t ||} |jdy#t$rYywxYw)z Print any layout to the output in a non-interactive way. Example usage:: from prompt_toolkit.widgets import Frame, TextArea print_container( Frame(TextArea(text='Hello world!'))) r,) containerr8)layoutr'inputr&T) in_threadN) rr r'rrrr:runEOFError)rMr$r&r*r'rKs r3rrsl d+ "))( *l" 2P C  $    sA$$ A0/A0ctg}|r|jt|r|j|t|S)z7 Merge user defined style with built-in style. )rappendrr)r&r*styless r3r:r:s<  !F% ,./  e  r5ctj}|j|jdd|j y)z Clear the screen. rN)r r' erase_screen cursor_gotor%)r's r3rrs7  % %F  q! LLNr5cNtj}|j|y)z! Set the terminal title. N)r r'r)textr's r3rrs   % %F Tr5ctdy)z" Erase the current title. N)rr5r3rrs bMr5)rHrr"strr#r^r$ TextIO | Noner%boolr&BaseStyle | Noner'z Output | Noner(zColorDepth | Noner)zStyleTransformation | Noner*r`r?rA)NNT) rMrr$r_r&rar*r`r?rA)r&rar*r`r?rr@)rZr^r?rA)- __future__rasyncio.eventsrtypingrrrprompt_toolkit.applicationr"prompt_toolkit.application.currentr r *prompt_toolkit.application.run_in_terminalr prompt_toolkit.formatted_textr rrprompt_toolkit.inputrprompt_toolkit.layoutrprompt_toolkit.outputrrprompt_toolkit.output.defaultsrprompt_toolkit.rendererrr9prompt_toolkit.stylesrrrrr prompt_toolkit.layout.containersr__all__rr:rrrr]r5r3rqsT",--2OF ,(48= " %)7;+/{ { { {  {  {  { {#{5{%){ {@"+/         %)    F    =A    r5