)L iK/"dZddlmZddlmZddlmZddlmZddl m Z ddl m Z m Z mZmZmZmZmZddlmZdd lmZdd lmZmZdd lmZdd lmZmZmZdd l m!Z!m"Z"m#Z#ddl$m%Z%m&Z&m'Z'ddl(m)Z)ddl*m+Z+m,Z,m-Z-ddl.m/Z/ddl0m1Z1m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7m8Z8ddl9m:Z:m;Z;mZ>ddl?m@Z@mAZAddlBmCZCddlDmEZEddlFmGZGddlHmIZIddlJmKZKmLZLmMZMmNZNmOZOddlPmQZQddlRmSZSddlTmUZUmVZVmWZWmXZXddlYmZZZm[Z[ddl\m]Z]m^Z^m_Z_ddl`maZadd lbmcZcdd!ldmeZemfZfdd"lgmhZhmiZimjZjmkZkmlZlmmZmmnZnmoZompZpmqZqmrZrdd#lsmtZtdd$lumvZvmwZwdd%lxmyZymzZzm{Z{dd&l|m}Z}m~Z~mZmZmZmZmZdd'lmZmZmZmZdd(lmZmZdd)lmZdd*lmZmZmZe rdd+lmZgd,Ze ge;fZeQZ d>d-ZGd.d/eXZGd0d1eeZeed2e;e eeege:ffZed3ZGd4d5eeZ d?d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d6d7d8d6d9d9d8d6d:- d@d;Zej>je_ dA dBd<ZdCdDd=Zy6)Eao Line editing functionality. --------------------------- This provides a UI for a line input, similar to GNU Readline, libedit and linenoise. Either call the `prompt` function for every line input. Or create an instance of the :class:`.PromptSession` class and call the `prompt` method from that class. In the second case, we'll have a 'session' that keeps all the state like the history in between several calls. There is a lot of overlap between the arguments taken by the `prompt` function and the `PromptSession` (like `completer`, `style`, etcetera). There we have the freedom to decide which settings we want for the whole 'session', and which we want for an individual `prompt`. Example:: # Simple `prompt` call. result = prompt('Say something: ') # Using a 'session'. s = PromptSession() result = s.prompt('Say something: ') ) annotations)get_running_loop)contextmanager)Enum)partial) TYPE_CHECKINGCallableGenericIteratorTypeVarUnioncast) Application)get_app) AutoSuggestDynamicAutoSuggest)Buffer) ClipboardDynamicClipboardInMemoryClipboard) CompleterDynamicCompleterThreadedCompleter)AnyCursorShapeConfigCursorShapeConfigDynamicCursorShapeConfig)Document)DEFAULT_BUFFER SEARCH_BUFFER EditingMode) InputHook) Condition FilterOrBoolhas_arg has_focusis_doneis_truerenderer_height_is_known to_filter)AnyFormattedTextStyleAndTextTuplesfragment_list_to_textmerge_formatted_textto_formatted_text)HistoryInMemoryHistory)Input)load_auto_suggest_bindings!display_completions_like_readline)load_open_in_editor_bindings)ConditionalKeyBindingsDynamicKeyBindings KeyBindingsKeyBindingsBasemerge_key_bindings) KeyPressEvent)Keys)FloatFloatContainerHSplitWindow)ConditionalContainer WindowAlign) BufferControlFormattedTextControlSearchBufferControl) Dimension)Layout)CompletionsMenuMultiColumnCompletionsMenu) AfterInputAppendAutoSuggestionConditionalProcessorDisplayMultipleCursorsDynamicProcessor#HighlightIncrementalSearchProcessorHighlightSelectionProcessorPasswordProcessor ProcessorReverseSearchProcessormerge_processors)explode_text_fragments) DynamicLexerLexer) ColorDepth DummyOutputOutput) BaseStyleConditionalStyleTransformation DynamicStyleDynamicStyleTransformationStyleTransformation#SwapLightAndDarkStyleTransformationmerge_style_transformations) get_cwidthis_dumb_terminalsuspend_to_background_supportedto_str)DynamicValidator Validator)Frame) SearchToolbar SystemToolbarValidationToolbar)MagicFormattedText) PromptSessionpromptconfirmcreate_confirm_session CompleteStylec2dfd }dfd }dfd }|||fS)a6 Take a `get_prompt_text` function and return three new functions instead. One that tells whether this prompt consists of multiple lines; one that returns the fragments to be shown on the lines above the input; and another one with the fragments to be shown at the first line of the input. c0D] ^}}}d|vs yy)N TF)fragmentchar_get_prompt_texts e/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/prompt_toolkit/shortcuts/prompt.pyhas_before_fragmentsz5_split_multiline_prompt..has_before_fragmentss+"1"3  HdQt| cg}d}ttD]$^}}}|r|jd||f|dk(s#d}&|S)NFrrtTreversedrUinsert)resultfound_nlrvrwrxrys rzbeforez'_split_multiline_prompt..beforesZ%'"*+A/BS+T"U HdQ a(D!12   r|cg}ttD]!^}}}|dk(r|S|jd||f#|S)Nrtrr~)rrvrwrxrys rzfirst_input_linez1_split_multiline_prompt..first_input_linesY%'"*+A/BS+T"U 3 HdQt|  a(D!12  3  r|returnboolrr+ru)ryr{rrs` rz_split_multiline_promptrs"  )9 99r|c$eZdZdZdfd ZxZS)_RPromptzG The prompt that is displayed on the right side of the Window. cZt|t|tjdy)N)textz class:rprompt)alignstyle)super__init__rDrBRIGHT)selfr __class__s rzrz_RPrompt.__init__s)  d +##!  r|)rr*rNone)__name__ __module__ __qualname____doc__r __classcell__)rs@rzrrs  r|rc(eZdZUdZded<dZdZdZy)rqz8 How to display autocompletions for the prompt. strvalueCOLUMN MULTI_COLUMN READLINE_LIKEN)rrrr__annotations__rrrrur|rzrqrqs J F!L#Mr|rqrl_Tc.eZdZdZdZ d"ddddej ddddddddddddejdddddddddddddddddddd ddde e d + d#d Z d$d Z d%d Z d%dZd&dZ d'dZd(dZ d)ddddddddddddddddddddddddddddddddddddddddddddd, d*dZed"d+dZ d)ddddddddddddddddddddddddddddddddddddddddddd* d,dZ d-dZed.dZej2d/dZd0dZd1dZ d2dZ d3dZd1dZd1dZed4d Z ed5d!Z!y)6rma PromptSession for a prompt application, which can be used as a GNU Readline replacement. This is a wrapper around a lot of ``prompt_toolkit`` functionality and can be a replacement for `raw_input`. All parameters that expect "formatted text" can take either just plain text (a unicode object), a list of ``(style_str, text)`` tuples or an HTML object. Example usage:: s = PromptSession(message='>') text = s.prompt() :param message: Plain text or formatted text to be shown before the prompt. This can also be a callable that returns formatted text. :param multiline: `bool` or :class:`~prompt_toolkit.filters.Filter`. When True, prefer a layout that is more adapted for multiline input. Text after newlines is automatically indented, and search/arg input is shown below the input, instead of replacing the prompt. :param wrap_lines: `bool` or :class:`~prompt_toolkit.filters.Filter`. When True (the default), automatically wrap long lines instead of scrolling horizontally. :param is_password: Show asterisks instead of the actual typed characters. :param editing_mode: ``EditingMode.VI`` or ``EditingMode.EMACS``. :param vi_mode: `bool`, if True, Identical to ``editing_mode=EditingMode.VI``. :param complete_while_typing: `bool` or :class:`~prompt_toolkit.filters.Filter`. Enable autocompletion while typing. :param validate_while_typing: `bool` or :class:`~prompt_toolkit.filters.Filter`. Enable input validation while typing. :param enable_history_search: `bool` or :class:`~prompt_toolkit.filters.Filter`. Enable up-arrow parting string matching. :param search_ignore_case: :class:`~prompt_toolkit.filters.Filter`. Search case insensitive. :param lexer: :class:`~prompt_toolkit.lexers.Lexer` to be used for the syntax highlighting. :param validator: :class:`~prompt_toolkit.validation.Validator` instance for input validation. :param completer: :class:`~prompt_toolkit.completion.Completer` instance for input completion. :param complete_in_thread: `bool` or :class:`~prompt_toolkit.filters.Filter`. Run the completer code in a background thread in order to avoid blocking the user interface. For ``CompleteStyle.READLINE_LIKE``, this setting has no effect. There we always run the completions in the main thread. :param reserve_space_for_menu: Space to be reserved for displaying the menu. (0 means that no space needs to be reserved.) :param auto_suggest: :class:`~prompt_toolkit.auto_suggest.AutoSuggest` instance for input suggestions. :param style: :class:`.Style` instance for the color scheme. :param include_default_pygments_style: `bool` or :class:`~prompt_toolkit.filters.Filter`. Tell whether the default styling for Pygments lexers has to be included. By default, this is true, but it is recommended to be disabled if another Pygments style is passed as the `style` argument, otherwise, two Pygments styles will be merged. :param style_transformation: :class:`~prompt_toolkit.style.StyleTransformation` instance. :param swap_light_and_dark_colors: `bool` or :class:`~prompt_toolkit.filters.Filter`. When enabled, apply :class:`~prompt_toolkit.style.SwapLightAndDarkStyleTransformation`. This is useful for switching between dark and light terminal backgrounds. :param enable_system_prompt: `bool` or :class:`~prompt_toolkit.filters.Filter`. Pressing Meta+'!' will show a system prompt. :param enable_suspend: `bool` or :class:`~prompt_toolkit.filters.Filter`. Enable Control-Z style suspension. :param enable_open_in_editor: `bool` or :class:`~prompt_toolkit.filters.Filter`. Pressing 'v' in Vi mode or C-X C-E in emacs mode will open an external editor. :param history: :class:`~prompt_toolkit.history.History` instance. :param clipboard: :class:`~prompt_toolkit.clipboard.Clipboard` instance. (e.g. :class:`~prompt_toolkit.clipboard.InMemoryClipboard`) :param rprompt: Text or formatted text to be displayed on the right side. This can also be a callable that returns (formatted) text. :param bottom_toolbar: Formatted text or callable that returns formatted text to be displayed at the bottom of the screen. :param prompt_continuation: Text that needs to be displayed for a multiline prompt continuation. This can either be formatted text or a callable that takes a `prompt_width`, `line_number` and `wrap_count` as input and returns formatted text. When this is `None` (the default), then `prompt_width` spaces will be used. :param complete_style: ``CompleteStyle.COLUMN``, ``CompleteStyle.MULTI_COLUMN`` or ``CompleteStyle.READLINE_LIKE``. :param mouse_support: `bool` or :class:`~prompt_toolkit.filters.Filter` to enable mouse support. :param placeholder: Text to be displayed when no input has been given yet. Unlike the `default` parameter, this won't be returned as part of the output ever. This can be formatted text or a callable that returns formatted text. :param show_frame: `bool` or :class:`~prompt_toolkit.filters.Filter`. When True, surround the input with a frame. :param refresh_interval: (number; in seconds) When given, refresh the UI every so many seconds. :param input: `Input` object. (Note that the preferred way to change the input/output is by creating an `AppSession`.) :param output: `Output` object. :param interrupt_exception: The exception type that will be raised when there is a keyboard interrupt (control-c keypress). :param eof_exception: The exception type that will be raised when there is an end-of-file/exit event (control-d keypress). )&messagelexer completercomplete_in_thread is_password editing_mode key_bindingsrbottom_toolbarrstyle_transformationswap_light_and_dark_colors color_depthcursorinclude_default_pygments_stylerprompt multilineprompt_continuation wrap_linesenable_history_searchsearch_ignore_casecomplete_while_typingvalidate_while_typingcomplete_style mouse_support auto_suggest clipboard validatorrefresh_intervalinput_processors placeholderenable_system_promptenable_suspendenable_open_in_editorreserve_space_for_menutempfile_suffixtempfile show_frameFTNz.txtr)+rrrvi_moderrrrrrrrrrrrrrrrrrrrrhistoryrrrrrrrrerase_when_donerrrrinputoutputinterrupt_exception eof_exceptionc+J|xs t}|xs t}|rtj}|)|_|*|_||_| |_||_||_ ||_ |#|_ ||_ ||_ ||_||_||_||_||_||_||_||_||_| |_| |_||_||_||_| |_||_||_||_|'|_ |!|_!|"|_"| |_#| |_$||_%||_&|%|_'|&|_(|(|_)|+|_*|,|_+||_,|j[|_.|j_|_0|jc|_2|jg||$|_4yN)5r0rr VI_input_outputrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr_create_default_bufferdefault_buffer_create_search_buffer search_buffer_create_layoutlayout_create_applicationapp)-rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrs- rzrzPromptSession.__init__zs`._.4!2!4  &>>L    ""4&(, $8!*D'& .L+ "#6 $%:""4%:"%:",*("" 0 0&$8!,%:"&<#.  $#6 * "99;!779))+ ++L/Jr|c*tdfd }|S)a$ Dynamically take this setting from this 'PromptSession' class. `attr_name` represents an attribute name of this class. Its value can either be a boolean or a `Filter`. This returns something that can be used as either a `Filter` or `Filter`. cXttt}t|Sr)rr#getattrr))r attr_namers rzdynamicz'PromptSession._dyncond..dynamics&wtY'?@E#9U#% %r|r)r")rrrs`` rz_dyncondzPromptSession._dynconds  &  &r|cj}d d}tttfd|d|dt fdt fdj tfd|fdfd  S) z= Create and return the default input buffer. cttttj |j j dy)zbAccept the content of the default buffer. This is called when the validation succeeds.zclass:accepted)rrT)rrrrexitdocumentr)buffs rzacceptz4PromptSession._create_default_buffer..accepts: S!79 - 2 2}}))1A 3 r|ctjxr6tj xrjtj k( Sr)r'rrrrqrrsrzz6PromptSession._create_default_buffer.. sI : :;K : :;;K++}/J/JJJr|rrcjSr)rrsrzrz6PromptSession._create_default_buffer.. t~~r|cvjr!jrtjSjSr)rrrrsrzrz6PromptSession._create_default_buffer..s.**t~~*$..9^^r|cjSr)rrsrzrz6PromptSession._create_default_buffer..s D4E4Er|c6tjxsdSNr)rerrsrzrz6PromptSession._create_default_buffer..sF4+?+?+E2$Fr|c6tjxsdSr)rerrsrzrz6PromptSession._create_default_buffer..sVDMM$7R8r|) namerrrrrrraccept_handlerrr)rrrr)rrrr"rfrrr)rdyncondrs` rzrz$PromptSession._create_default_buffersz-- #,K# #**A"B")*A"B&'=>&$ LL+,EF!F8-  r|c"ttS)N)r)rrrs rzrz#PromptSession._create_search_buffers =))r|cj}tj\}}}j}j}t d*fd }t tttt|tztt|dttfdttfd|g}t!t#t%fddd d t'd  t fdtzt(z} t+||dt-|t/g|dt1|d} d+fd } t3|| |dt5fdd } t#| j6t9j:||d} t d*fd }t=t?t!t#t%|d t |t!| t fdt!t#t fdgtAd d d tCdd t||z !tAd d d tEd t||z"!tAd#d#d tGfd$%g}t?t!tI||d&|'t!tKtt!| |dtzt!t#t%jLd (|d)tNzt!|d)tz| g}tQ|| S),z2 Create `Layout` for this prompt. cVjduxrjjdk(Sr)rrrrsrzdisplay_placeholderz9PromptSession._create_layout..display_placeholder3s+##4/RD4G4G4L4LPR4R Rr|rc6tjxsgSr)rTrrsrzrz.PromptSession._create_layout..@s%5d6K6K6Qr%Rr|cjSr)rrsrzrz.PromptSession._create_layout..Bs 4#3#3r|filtercjSrrrsrzrz.PromptSession._create_layout..Ks D//r|zclass:bottom-toolbar.textrzclass:bottom-toolbarTmin)rdont_extend_heightheightc jduSrrrsrzrz.PromptSession._create_layout..QsT%8%8%Dr|r) ignore_case)bufferrr r)enable_global_bindingscJtjr jSS)z8Return the UIControl to be focused when searching start.)r'rcontrol)search_buffer_controlsearch_toolbarrsrzget_search_buffer_controlz?PromptSession._create_layout..get_search_buffer_controlds!t~~&%---,,r|FcjSr)rrsrzrz.PromptSession._create_layout..p tzzr|)r rr include_default_input_processorsrpreview_search)get_prompt_text_2r)rget_line_prefixrc>jtjk(Sr)rrqrrsrzmulti_column_complete_stylezAPromptSession._create_layout..multi_column_complete_style}s&&-*D*DD Dr|)rcFtjjk7Srrrcurrent_controlrsrzrz.PromptSession._create_layout..GI$4$4$D$D4%5r|cFtjjk(Srrrsrzrz.PromptSession._create_layout..rr|) max_height scroll_offset extra_filter)xcursorycursor transparentcontent) show_metar"rcjSr)rrsrzrz.PromptSession._create_layout..s T\\r|)righttophide_when_covering_contentr&r)ralternative_content)rrr)rrE))rr _get_promptrrr"rOrPrLrKr%r&rQrMrNrJrAr@rDrFr(rirErSrjrCrV"_get_default_buffer_control_heightr_get_line_prefixr>r?r=rHrIrrhrk _get_arg_textr$rG)rrr{get_prompt_text_1rrrrall_input_processorsrsystem_toolbarrdefault_buffer_controldefault_buffer_windowrmain_input_containerrrrs` @@rzrzPromptSession._create_layout!s-- $D$4$4 5   ,,**   S  S 0 1 ' ) $& .(AWH(L  !!2!4gm6L M " $ R S 34*  ". $/7R-#' Q'  DEh&'  ' w/C'D !4 467 45!  '#*+A#B  -"/!";1-212 " !' "::#%%9J|, !   E  E . (01BC/3""67 )-!5)45!5 <  $+#%&'%.~%>66&7   $6"&%.~%>5&6 /3$%9: 7! 5< |%./"<0(< %%6%8'J$"G,B$Cwh$N%/0B0BCANK(72%^W[5IWH5TU#  ,f344r|c8j}t}t}j}t j t fdttfdtt|dg|dtfdtt|t||dttz|gt!fdg|d||d fd t#fd j$j&j( } |S) z2 Create the `Application` object. cjSrrrsrzrz3PromptSession._create_application..rr|cjSr)rrsrzrz3PromptSession._create_application..s t7P7Pr|rrcjSr)rrsrzrz3PromptSession._create_application..rr|rcjSrrrsrzrz3PromptSession._create_application..s t/@/@r|rTcjSr)rrsrzrz3PromptSession._create_application.. s  0 0r|cjSr)rrsrzrz3PromptSession._create_application.. s DKKr|)rrrrrrrrrreverse_vi_search_directionrrrrr)rr2r5_create_prompt_bindingsrrr]rar^r\r`rr:r6r%rr7rrrr)rrrrauto_suggest_bindingsopen_in_editor_bindingsprompt_bindings applications` rzrz!PromptSession._create_applications  --!; <">"@668(3;;12!<./PQ2;= <=",33S+T&'=>+&12 7 '(? @"+N";!< , ''@A  "/2%+(,0+,?@!22++<.do_accept/s4t~~..488??3L3L4 r|enterrc:jjy)z)Accept input when enter has been pressed.N)rvalidate_and_handleeventrs rz _accept_inputz._accept_input5s    3 3 5r|c>jtjk(Sr)rrqrrsrzreadline_complete_stylezFPromptSession._create_prompt_bindings..readline_complete_style:s&&-*E*EE Er|tabct|y)z$Display completions (like Readline).Nr3rLs rz_complete_like_readlinezFPromptSession._create_prompt_bindings.._complete_like_readline>s  .e 4r|zc-czc\|jjjdy)z&Abort when Control-C has been pressed.zclass:aborting exceptionrN)rrrrKs rz_keyboard_interruptzBPromptSession._create_prompt_bindings.._keyboard_interruptCs# IINNT%=%=%?GWN Xr|ct}|jjtk(xr|jj S)zXCtrl-D binding is only active when the default buffer is selected and empty.)rcurrent_bufferrrr)rs rzctrl_d_conditionz?PromptSession._create_prompt_bindings..ctrl_d_conditionIs;)C""''>90**/// r|zc-dc\|jjjdy)z%Exit when Control-D has been pressed.z class:exitingrUN)rrrrKs rz_eofz3PromptSession._create_prompt_bindings.._eofSs" IINNT%7%7%9N Qr|c8tjSr)r)rrsrzrz=PromptSession._create_prompt_bindings..enable_suspendZs19T0013 3r|zc-zc8|jjy)z8 Suspend process to background. N)rsuspend_to_backgroundrRs rz_suspendz7PromptSession._create_prompt_bindings.._suspend^s II + + -r|rrLErr)r8addr%rr"rd)rkbhandledefault_focusedrGrMrOrSrWrZr\suspend_supportedrr`s` rzr@z%PromptSession._create_prompt_bindings's4]#N3      O ; < 6 = 6  F  F 5G H 5 I 5 o .   Y  / Y     .@ A R B R&&EF  4  4 /.@ A . B .  r|),rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrdefaultaccept_defaultpre_runset_exception_handler handle_sigint in_thread inputhookc,|||_|||_|||_|rtj|_|||_|||_|||_|||_| | |_ | | |_ | | |_ | | |_ | | |_ |||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_| | |_ |!|!|_!|"|"|_"|#|#|_#|$|$|_$|%|%|_%|&|&|_&|jO|)|(|jPjStU|'tVr|'n tW|'|j|jX_|jZBt]r8|j_|j5}.|.ja|,|+cdddS|jXja|*|,|+|-S#1swY(xYw)a Display the prompt. The first set of arguments is a subset of the :class:`~.PromptSession` class itself. For these, passing in ``None`` will keep the current values that are active in the session. Passing in a value will set the attribute for the session, which means that it applies to the current, but also to the next prompts. Note that in order to erase a ``Completer``, ``Validator`` or ``AutoSuggest``, you can't use ``None``. Instead pass in a ``DummyCompleter``, ``DummyValidator`` or ``DummyAutoSuggest`` instance respectively. For a ``Lexer`` you can pass in an empty ``SimpleLexer``. Additional arguments, specific for this prompt: :param default: The default input text to be shown. (This can be edited by the user). :param accept_default: When `True`, automatically accept the default value without allowing the user to edit the input. :param pre_run: Callable, called at the start of `Application.run`. :param in_thread: Run the prompt in a background thread; block the current thread. This avoids interference with an event loop in the current thread. Like `Application.run(in_thread=True)`. This method will raise ``KeyboardInterrupt`` when control-c has been pressed (for abort) and ``EOFError`` when control-d has been pressed (for exit). N)rmrl)rkrmrlrn)1rrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr_add_pre_run_callablesrreset isinstancerrrrc _dumb_promptrun)/rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrirjrkrlrmrndump_apps/ rzrnzPromptSession.promptgs~  "DL  # ,D   '$4D !  +D   DJ  &DN  )&8D #  "*D   # ,D   %"0D   DJ  "*D    DK ) 52PD /  +(D &  )&8D # ,)>D & ,)>D &  %"0D   # ,D   &DN  &DN  $!.D   '$4D !  "*D  ! -*@D '  +(D &  D  $DM  !(DO ##G^< !!!'84G(7:K %)$9$9! << $4$6""4<<0 VH||i}|U V Vxx||"7'    V Vs 9H55H>c #DKjjttjjj j }jrtj|g}ttttjtj|}dfd }jxj |z c_ |jjdjj jxj |zc_y#jjdjj jxj |zc_wxYww)a@ Create prompt `Application` for prompt function for dumb terminals. Dumb terminals have minimum rendering capabilities. We can only print text to the screen. We can't use colors, and we can't do cursor movements. The Emacs inferior shell is an example of a dumb terminal. We will show the prompt, and wait for the input. We still handle arrow keys, and all custom key bindings, but we don't really render the cursor movements. Instead we only print the typed character that's right before the cursor. )rrrrcjjjjjddjj y)N)rwriterrtext_before_cursorflush)rxrs rzon_text_changedz3PromptSession._dumb_prompt..on_text_changedHs> KK  d11::MMbcR S KK   r|z N)rxobjectrr)rryr,r.rr{r@rr:rrrrrYrrr|)rrrrDr|s` rzrszPromptSession._dumb_prompt&s; /0A$,,0OPQ )-(D(D(F   -t/@/@,.OPL O jj"}{{)     ++>+ C  KK  f % KK       / /? B / KK  f % KK       / /? B /s C*F .E2AF AFF )*rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrirjrkrlc*K|||_|||_|||_|rtj|_|||_|||_|||_|||_| | |_ | | |_ | | |_ | | |_ | | |_ |||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_|||_| | |_ |!|!|_!|"|"|_"|#|#|_#|$|$|_$|%|%|_%|&|&|_&|jO|)|(|jPjStU|'tVr|'n tW|'|j|jX_|jZIt]r?|j_|j5},|,ja|+d{cdddS|jXja|*|+d{S72#1swY0xYw7w)N)rl)rkrl)1rrrr rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrprrqrrrrrrcrs run_async)-rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrirjrkrlrus- rz prompt_asynczPromptSession.prompt_asyncWsh  "DL  # ,D   '$4D !  +D   DJ  &DN  )&8D #  "*D   # ,D   %"0D   DJ  "*D    DK ) 52PD /  +(D &  )&8D # ,)>D & ,)>D &  %"0D   # ,D   &DN  &DN  $!.D   '$4D !  "*D  ! -*@D '  +(D &  D  $DM  !(DO ##G^< !!!'84G(7:K %)$9$9! << $4$6""4<<0 MH%//m/LL M MXX''"7}(   M M M s<G9I;III*I?IIII Icddfd }jjj|y)Ncxrr.tjjjyyr)r call_soonrrJ)rirjrsrzpre_run2z6PromptSession._add_pre_run_callables..pre_run2s2  !",,T-@-@-T-TU r|)rr)rpre_run_callablesappend)rrjrirs``` rzrpz$PromptSession._add_pre_run_callabless# V ""))(3r|c.|jjSrrrrs rzrzPromptSession.editing_modesxx$$$r|c&||j_yrr)rrs rzrzPromptSession.editing_modes %r|c|j*|jtjk7r |j}nd}|rHt j s4|j}|js |j t|StS)Nrr) rrrqrrrr&rrcomplete_staterF)rspacers rzr.z0PromptSession._get_default_buffer_control_heightsv NN &##}'B'BB//EE **&&D ))+t/B/B/N U++{r|c0t|jdS)Nz class:promptr)r.rrs rzr-zPromptSession._get_prompts ^DDr|c|j}t|r ||||}n|}|t|jrd|z}t |dS)z Insert the prompt continuation. :param width: The width that was used for the prompt. (more or less can be used.) :param line_number: :param wrap_count: Amount of times that the line has been wrapped.  zclass:prompt-continuationr)rcallabler'rr.)rwidth line_number wrap_countr continuations rz_get_continuationzPromptSession._get_continuations[#66 ' (-@{J.L/L  GDNN$;;L 5PQQr|c|dk(rO|dk(rJt|js.tjj|j S|St t|}|j|||S)zw Return whatever needs to be inserted before every line. (the prompt, or a line continuation.) r) r'rr key_processorarg _inline_argrbr,r)rrrr prompt_widths rzr/zPromptSession._get_line_prefix4st !  a4>>*wy/F/F/J/J/V''))(**""78I8K"LM %%lKLLr|cd|jjj}|gS|dk(rd}dd|fgS)z%'arg' toolbar, for in multiline mode.-z-1)zclass:arg-toolbarzRepeat: zclass:arg-toolbar.text)rrr)rrs rzr0zPromptSession._get_arg_textIs>hh$$(( ;I #:C14Lc3RSSr|ct}|jjgS|jj}ddt|fdgS)z&'arg' prefix, for in single line mode.)class:prompt.argz(arg: zclass:prompt.arg.text)rz) )rrrr)rrrs rzrzPromptSession._inline_argUsOi    (I##''C/(#c(3* r|c.|jjSr)rrrs rzrzPromptSession.inputfsxx~~r|c.|jjSr)rrrs rzrzPromptSession.outputjsxxr|)r)Zrr*rr#rr#rr#rrrr rr#rr#rr#rr#r Lexer | Nonerr#rr#rr#rValidator | NonerCompleter | NonerrrintrrqrAutoSuggest | NonerBaseStyle | NonerStyleTransformation | Nonerr#rColorDepth | Nonerrrr#rHistory | NonerClipboard | NonerPromptContinuationText | Nonerr*rr*rr#rlist[Processor] | NonerAnyFormattedText | NonerKeyBindingsBase | Nonerrrstr | Callable[[], str] | Nonerrrfloatrr#rz Input | Nonerz Output | Nonertype[BaseException]rrrr)rrrr")rr)rrG)rr rrrzApplication[_T])rr8r)\rrrEditingMode | Noner float | Noner bool | NonerrrrrrrrrrrrrrrrrzAnyCursorShapeConfig | NonerFilterOrBool | NonerrrrrrrrrrrrrrrrrrrrrCompleteStyle | Nonerrrrrrrrrrrrr int | Nonerrrrrrrrrrrrrhstr | DocumentrirrjCallable[[], None] | NonerkrrlrrmrrnInputHook | Nonerr)rr*rzIterator[Application[_T]])XrrrrrrrrrrrrrrrrrrrrrrrrrzCursorShapeConfig | Nonerrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr#rhrrirrjrrkrrlrrr)rjrrirrr)rr )rr rr)rrFr)rrrrrrrr+)rrrrr_StyleAndTextTuplesCallablerr+)rr1)rrZ)"rrrr_fieldsr EMACSrqrKeyboardInterruptEOFErrorrrrrrrr@rnrrsrrppropertyrsetterr.r-rr/r0rrrrur|rzrmrms kZ'GV%'iK#(#'$)$/$5$5.2.2.3+0"-2',.3&*&*#(&'(5(<(<+/"&;?38)-'+7;"&&*=A$(+/&+37/3/3 %:@37"##(" $3D-5]iK!iK iK ! iK " iKiK"iK ,iK ,iK ,iK)iKiK+iK%iK ,!iK"$#iK$$%iK&!'iK(!$)iK*&+iK,)-iK. /iK091iK2%13iK4'5iK6%7iK8)59iK: ;iK<$=iK>;?iK@"AiKB)CiKD$EiKF1GiKH-IiKJ-KiKLMiKN8OiKP1QiKR SiKT!UiKVWiKXYiKZ1[iK\+]iK^ _iKV"& P*w5rK'K:>K KZ>H,0 } ,0)-#"&**.#'/326"&)-.2>B;?:>+/)-=A*.59265959/3+/&*&*-137/3-148.259:>37*."$$-1&*"&*i} ) } )} '} } } $} (} !} -} 0!} " #} $'%} &,'} ()<)} *9+} ,%8-} .)/} 0'1} 2;3} 4(5} 6 37} 809} : 3;} < 3=} >-?} @)A} B$C} D$E} F+G} H1I} J-K} L!+M} N2O} P,Q} R 3S} T8U} V1W} X(Y} \ ]} ^_} `+a} b $c} de} fg} h$i} j k} ~.C.Ch,0 O ,0)-#"&**.#'/326"&)-+/>B;?:>+/)-=A*.59265959/3+/&*&*-137/3-148.259:>37#("$$-1&*"eO ) O )O 'O O O $O (O !O -O 0!O " #O $'%O &)'O ()<)O *9+O ,%8-O .)/O 0'1O 2;3O 4(5O 6 37O 809O : 3;O < 3=O >-?O @)AO B$CO D$EO F+GO H1IO J-KO L!+MO N2OO P,QO R 3SO T8UO V1WO X!YO \ ]O ^_O `+aO b $cO deO f gO b404BF4 4 %%&&,ERR'*R8;R R6MMM7 M  M* T "r|rmNrFT)-rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrirjrkrlrmrnc-Dt|}.|.j|fid|d|d|d|d|d|d|d | d | d | d | d | d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d|d | d!|!d"|"d#|#d$|$d%|%d&|&d'|'d(|(d)|)d*|*d+|+d,|,d-|-S).zk The global `prompt` function. This will create a new `PromptSession` instance for every call. )rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrirjrkrlrmrn)rmrn)/rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrirjrkrlrmrnsessions/ rzrnrnosp#0"@G 7>>. !. *.  .   .   . ..  . ". &. .  . . (F. 2.  $>!. "#. $%. &0'. (). *4+. ,.-. .4/. 041. 2&3. 4"5. 67. 89. :$;. <*=. > ?. @ 6A. B2C. D&E. F4G. H(I. JK. LM. NO. P&Q. RS. T4U. V$W. XY. Z[. .r|cTt}|jd|jdd fd }|jd|jdd fd }|jtjd d}t ||g}t ||S) zE Create a `PromptSession` object for the 'confirm' function. yYc`dj_|jjdy)NrTrrrrrrLrs rzyesz#create_confirm_session..yess%'*# d#r|nNc`dj_|jjdy)NrFrrrs rznoz"create_confirm_session..nos%'*# e$r|cy)zDisallow inserting other text.NrurRs rzrxz!create_confirm_session.._s r|r<ra)r8rcr<Anyr-rm)rsuffixbindingsrrrxcomplete_messagers @rzrprps }H \\# \\#$$\\# \\#%%\\$((  ,Wf,=>#0x$G Nr|c:t||}|jS)z@ Display a confirmation prompt that returns True/False. )rprn)rrrs rzroros%Wf5G >> r|)ryrrzStuple[Callable[[], bool], _StyleAndTextTuplesCallable, _StyleAndTextTuplesCallable]r)^rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrhrrirrjrrkrrlrrmrrnrrr) (y/n) )rr*rrrzPromptSession[bool])zConfirm?r)rr*rrrr)r __future__rasyncior contextlibrenumr functoolsrtypingrr r r r r rprompt_toolkit.applicationr"prompt_toolkit.application.currentrprompt_toolkit.auto_suggestrrprompt_toolkit.bufferrprompt_toolkit.clipboardrrrprompt_toolkit.completionrrrprompt_toolkit.cursor_shapesrrrprompt_toolkit.documentrprompt_toolkit.enumsrrr prompt_toolkit.eventloopr!prompt_toolkit.filtersr"r#r$r%r&r'r(r)prompt_toolkit.formatted_textr*r+r,r-r.prompt_toolkit.historyr/r0prompt_toolkit.input.baser10prompt_toolkit.key_binding.bindings.auto_suggestr2.prompt_toolkit.key_binding.bindings.completionr42prompt_toolkit.key_binding.bindings.open_in_editorr5'prompt_toolkit.key_binding.key_bindingsr6r7r8r9r:(prompt_toolkit.key_binding.key_processorr;prompt_toolkit.keysr<prompt_toolkit.layoutr=r>r?r@ prompt_toolkit.layout.containersrArBprompt_toolkit.layout.controlsrCrDrEprompt_toolkit.layout.dimensionrFprompt_toolkit.layout.layoutrGprompt_toolkit.layout.menusrHrI prompt_toolkit.layout.processorsrJrKrLrMrNrOrPrQrRrSrTprompt_toolkit.layout.utilsrUprompt_toolkit.lexersrVrWprompt_toolkit.outputrXrYrZprompt_toolkit.stylesr[r\r]r^r_r`raprompt_toolkit.utilsrbrcrdreprompt_toolkit.validationrfrgprompt_toolkit.widgetsrhprompt_toolkit.widgets.toolbarsrirjrk"prompt_toolkit.formatted_text.baserl__all__rrbrrrrqrPromptContinuationTextrrmrnrprorur|rzrs6#$%SSS26G(SSTT -KK.   <+WC$GGN 6/S    ?5AA B( E 'r+='=>%:0%:%:P  v   $C $ c3_. ./ 1 T]IGBKIZ$(,h#'+%)"&&*#+/.2"%)#':>7;6:'+%)9=&*15.21515+/'+"&"&)-/3+/)-04*.156:/3&* )-"&"&ah $hh% h # h  h h h$hh)h,h h#h !h %8!h"5#h$!4%h&%'h(#)h*7+h,$-h.//h0,1h2/3h4/5h6)7h8%9h: ;h< =h>'?h@-AhB)ChD'EhF.GhH(IhJ/KhL4MhN-OhP$QhTUhVWhX'YhZ [h\]h^_h` ahb chV%%--.7 '*@r|