wL idZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z mZddlmZddlmZdd lmZmZmZdd lmZdd lmZmZmZmZmZmZm Z m!Z!m"Z"m#Z#mZm$Z$m%Z%m&Z&m'Z'dd l(m)Z)dd l*m+Z+ddl,m-Z-m.Z.ddl/m0Z0m1Z1m2Z2ddl3m4Z4ddl5m6Z6ddl7m8Z8m9Z9ddl:m;Z;ddlm?Z?m@Z@mAZAddlBmCZCmDZDddlEmFZFmGZGddlHmIZIddlJmKZKddlLmMZMmNZNddlOmPZPddlQmRZRddlSmTZTmUZUmVZVddlWmXZXmYZYdd lZm[Z[m\Z\m]Z]m^Z^m_Z_m`Z`dd!lambZbmcZcdd"ldmeZemfZfGd#d$eKZgd%ehd&ehd'ehfd(Zid)Zjd*D]+ZkeleekZm emrenemd+remjsd,Zpn-d-Zpd.ejvxsep Zsd/Ztd0ZuGd1d2e6ZvGd3d4e Zwejeweyd5k(rewjjyy#eq$rd,ZpYpwxYw)6z/IPython terminal interface using prompt_toolkitN)warn)UnionOptional)get_asyncio_loop)InteractiveShellInteractiveShellABC)input) theme_table)toggle_set_term_titleset_term_titlerestore_term_title) abbrev_cwd)AnyBoolDictEnumFloatInstanceIntegerListTypeUnicoderdefaultobservevalidateDottedObjectName) import_item)AutoSuggestFromHistory)DEFAULT_BUFFER EditingMode)HasFocus ConditionIsDone)PygmentsTokens)History)ConditionalProcessor!HighlightMatchingBracketProcessor) ColorDepth) patch_stdout) PromptSession CompleteStyleprint_formatted_text) DynamicStyle merge_styles)style_from_pygments_clsstyle_from_pygments_dict)get_style_by_name)Style) TerminalPdbPdb)TerminalMagics)get_inputhook_name_and_func)PromptsClassicPromptsRichPromptDisplayHook)IPythonPTCompleterIPythonPTLexer) KEY_BINDINGSUNASSIGNED_ALLOWED_COMMANDScreate_ipython_shortcutscreate_identifierRuntimeBinding add_binding)KEYBINDING_FILTERSfilter_from_string)NavigableAutoSuggestFromHistoryAppendAutoSuggestionInAnyLinec eZdZy)_NoStyleN)__name__ __module__ __qualname__g/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/IPython/terminal/interactiveshell.pyrHrHEsrMrHwidthlineno wrap_countc2tj|}i}tj|j}dtj|jvsHt|jj Dcgc]}|j |j k(c}r||d<dtj|jvsHt|jj Dcgc]}|j |j k(c}r||d<dtj|jvsHt|jj Dcgc]}|j |j k(c}r||d<||fi|Scc}wcc}wcc}w)z~ Sagemath use custom prompt and we broke them in 8.19. make sure to pass only width if method only support width rP line_numberrQ)inspect signature parametersanyvalueskind VAR_KEYWORD)methodrOrPrQsigextraparamsps rN+_backward_compat_continuation_prompt_tokensr`JsN   F #C E   v & 1 1F7$$V,7773*-..*?*?*ABQ1== B<!h))&1<<<*-..*?*?*ABQ1== BA &mw((0;;;s*-..*?*?*ABQ1== B@)l % !5 !! C C Cs9 F ' F Fc tjdS#t$rYnt$rt dYnwxYwtj dk(ryy)NEDITORzN$EDITOR environment variable is not pure ASCII. Using platform default editor.posixvinotepad)osenvironKeyError UnicodeErrorrnamerLrMrNget_default_editorrkesQ zz(##        ww's 666)stdinstdoutstderrisattyFTIPY_TEST_SIMPLE_PROMPTcddl}|j||j}|jds|jdr|dd}|S)z We do not need to protect against error, this is taken care at a higher level where any reformat error is ignored. Indeed we may call reformatting on incomplete code. rN)mode )black format_strFileModeendswith)text_before_cursorruformatted_texts rNblack_reformat_handlerr{sQ %%&8u~~?O%PN  & &t ,1H1H1N', rMcddlm}ddlm}|jt j }|j ||\}}|r)|jds|jdr|dd}|S|S)Nr)file_resources)yapf_api) style_configrsrt) yapf.yapflibr}r~GetDefaultStyleForDirrfgetcwd FormatCoderx)ryr}r~rrz was_formatteds rNyapf_reformat_handlerrsu+%!77 DL$,$7$7%8%!NM!**40^5L5LT5R+CR0N!!rMcDeZdZdZfdZdZdZdZdeddfd Z xZ S) PtkHistoryAdapterzs Prompt toolkit has it's own way of handling history, Where it assumes it can Push/pull from history. cPt|||_|jyN)super__init__shell_refresh)selfr __class__s rNrzPtkHistoryAdapter.__init__s   rMc2d|_|jyNF)_loadedrrstrings rN append_stringzPtkHistoryAdapter.append_strings  rMcZ|jst|j|_yyr)rlistload_history_strings_loaded_stringsrs rNrzPtkHistoryAdapter._refreshs$||#'(A(A(C#DD rMc#Kd}g}|jjj|jjdD]2\}}}|j }|s||k7s |j ||}4|dddEd{y7w)NT)include_latestrt)rhistory_managerget_tailhistory_load_lengthrstripappend)r last_cellres_____cells rNrz&PtkHistoryAdapter.load_history_stringss !ZZ77@@ JJ * *4A  !MBT;;=D* 4   !tt9sAB B " B BB rreturnNcyrrLrs rN store_stringzPtkHistoryAdapter.store_strings rM) rIrJrK__doc__rrrrstrr __classcell__)rs@rNrrs0   E  3 4 rMrc eZdZUej dZeddj dZeddj dZdZ e e dfe d <dZ e eedfe d <dZed d j dZeed j dZedZeddj dZeddj dZeddj dZeddj dZeddj dZeddj dZedddj dZeddj dZ eddj dZ!e"ede#e$gdj dZ%e&d d!Z'e(d d"Z)d#Z*e(d$d%Z+e(d&e(d'd(Z,d)Z-ed*j dZ.edd+j dZ/ee0d,j dZ1e#e2d-j dZ3e4e2Z5e6d.d/Z7e6d0d1Z8edd2j dZ9ed3d4j dZ:e;d5d6d78j dZ<edd9j dZ=edd:j dZ>e?dd;j dZ@edd<j dZAed=d>dj dZBe?e d?<eid@j dZCeDdAdBj dZEe?e dC<e(dDdEZFeDdddFGj dZGdZHe?e dH<e(dIdJZIdxdKZJe(dLdMZKeLee;gdNeeLeeeLeeeddNOdPjdQjeODcgc]}dR|dS c}}TUj dZPe(dVdWZQdXZReddYj dZSedZd[j dZTe(d\dxd]ZUd^ZVfd_ZWd`ZXdaZYedbZZedcZ[dde\dee\dfe\fdgZ]dhZ^diZ_djZ`fdkZafdlZbdyfdn ZcdoZddZedpZfdqZgdZhdrZidZjekele ds<dxdtekeldmdfduZmenjZpdvZqdZrdwZsxZtScc}}w)zTerminalInteractiveShellT)configz@minimum characters for filling with ellipsis in file completions)helpzNumber of line at the bottom of the screen to reserve for the tab completion menu, search history, ...etc, the height of these menus will at most this value. Increase it is you prefer long and skinny menus, decrease for short and wide.Npt_app auto_suggestz ~/.pdbhistoryz'File in which to store and read historyaUse `raw_input` for the REPL, without completion and prompt colors. Useful when controlling IPython as a subprocess, and piping STDIN/OUT/ERR. Known usage are: IPython's own testing machinery, and emacs' inferior-python subprocess (assuming you have set `python-shell-interpreter` to "ipython") available through the built-in `M-x run-python` and third party packages such as elpy. This mode default to `True` if the `IPY_TEST_SIMPLE_PROMPT` environment variable is set, or the current terminal is not a tty. Thus the Default value reported in --help-all, or config will often be incorrectly reported. c2|jrtStSr) simple_promptr5r4rs rN debugger_clsz%TerminalInteractiveShell.debugger_clss((s9k9rMz Set to confirm when you try to exit IPython with an EOF (Control-D in Unix, Control-Z/Enter in Windows). By typing 'exit' or 'quit', you can force a direct exit without any confirmation.emacsz5Shortcut style to use at the prompt. 'vi' or 'emacs'.z;Add shortcuts from 'emacs' insert mode to 'vi' insert mode.z Cursor shape changes depending on vi mode: beam in vi insert mode, block in nav mode, underscore in replace mode.g{Gz?zJThe time in milliseconds that is waited for a key code to complete.g?zUThe time in milliseconds that is waited for a mapped key sequence to complete.zMAutoformatter to reformat Terminal code. Can be `'black'`, `'yapf'` or `None`)r allow_noneFz Automatically add/delete closing bracket or quote when opening bracket or quote is entered/deleted. Brackets: (), [], {} Quotes: '', "" zQEnable mouse support in the prompt (Note: prevents selecting text with the mouse)legacy)klasszDeprecated, and has not effect, use IPython themes The name or class of a Pygments style to use for syntax highlighting. To see available styles, run `pygmentize -L styles`. editing_modec|djdk(rd|d<n|djdk(rd|d<tt|djr|djS|jS)Nvaluevimrdrr)lowerhasattrr upperr)rproposals rN_validate_editing_modez/TerminalInteractiveShell._validate_editing_mode;sz G  " " $ -#HW  g  $ $ &) 3&HW  ; 1 7 7 9 :G$**, ,   rMc|jr8tt|jj |j_yyr)rgetattrr newrrrchanges rN _editing_modez&TerminalInteractiveShell._editing_modeGs. ;;'.{FJJz9TerminalInteractiveShell._set_formatter..NsQrMruyapf)reformat_handlerr{r ValueError)r formatters rN_set_formatterz'TerminalInteractiveShell._set_formatterLs6  $.D ! ' !$:D ! & $9D ! rM autoformatterc>|j}|j|yr)rr)rrrs rN_autoformatter_changedz/TerminalInteractiveShell._autoformatter_changedVsJJ  I&rMhighlighting_stylecolorsc|j|jjk(sJ|jdk7r tdyy)NrzLhighlighting_style is deprecated since 9.0 and have no effect, use themeing.)rrrrs rN_highlighting_style_changedz4TerminalInteractiveShell._highlighting_style_changed[sDzzVZZ--//// :: ! ^   "rMc0|jd|_y)Nr)_make_style_from_name_or_cls_stylers rN refresh_stylez&TerminalInteractiveShell.refresh_stylees77A rMz0Override highlighting format for specific tokenszUse 24bit colors instead of 256 colors in prompt highlighting. If your terminal supports true color, the following command should print ``TRUECOLOR`` in orange:: printf "\x1b[38;2;255;100;0mTRUECOLOR\x1b[0m\n" z?Set the editor used by IPython (default to $EDITOR/vi/notepad).z6Class used to generate Prompt token for prompt_toolkitpromptsc$|j|Sr) prompts_classrs rN_prompts_defaultz)TerminalInteractiveShell._prompts_default~s!!$''rMdisplayhook_classctSr)r:rs rN_displayhook_class_defaultz3TerminalInteractiveShell._displayhook_class_defaults$$rMz$Automatically set the terminal titlezIPython: {cwd}ziCustomize the terminal title format. This is a python format string. Available substitutions are: {cwd}.)column multicolumn readlinelikezOptions for displaying tab completions, 'column', 'multicolumn', and 'readlinelike'. These options are for `prompt_toolkit`, see `prompt_toolkit` documentation for more information.r)r default_valuezHighlight matching brackets.zEnable vi (v) or Emacs (C-X C-E) shortcuts to open an external editor. This is in addition to the F2 binding, which is always enabled.zProvide an alternative handler to be called when the user presses Return. This is an advanced option intended for debugging, which may be changed or removed in later releases.z:Allows to enable/disable the prompt toolkit history searchrEaSpecifies from which source automatic suggestions are provided. Can be set to ``'NavigableAutoSuggestFromHistory'`` (:kbd:`up` and :kbd:`down` swap suggestions), ``'AutoSuggestFromHistory'``, or ``None`` to disable automatic suggestions. Default is `'NavigableAutoSuggestFromHistory`'._autosuggestions_provideru Extra arguments to pass to `llm_provider_class` constructor. This is used to – for example – set the `model_id` input_historyaX Fully Qualifed name of a function that takes an IPython history manager and return a prefix to pass the llm provider in addition to the current buffer text. You can use: - no_prefix - input_history As default value. `input_history` (default), will use all the input history of current IPython session _llm_prefix_from_historyllm_prefix_from_historycJ|j}||_|jyr)rr_set_autosuggestions)rrrjs rN _llm_prefix_from_history_changedz9TerminalInteractiveShell._llm_prefix_from_history_changedszz(,% !!#rMax Provisional: This is a provisional API in IPython 8.32, before stabilisation in 9.0, it may change without warnings. class to use for the `NavigableAutoSuggestFromHistory` to request completions from a LLM, this should inherit from `jupyter_ai_magics:BaseProvider` and implement `stream_inline_completions` )rr_llm_provider_classllm_provider_classcJ|j}||_|jyr)rrr)rrprovider_classs rN_llm_provider_class_changedz4TerminalInteractiveShell._llm_provider_class_changeds#1  !!#rMc6| j}jr4tjtrjj |d_n|dk(rt _n|dk(rsj rfd}nd}t_|j_j}|dk(rd}|}n|dk(rd}|}n t|}|j_ n tdjrjj_yy) NrrEcRtj}|dijS)NrL)rrllm_constructor_kwargs)llm_provider_constructorrs rNinit_llm_providerzHTerminalInteractiveShell._set_autosuggestions..init_llm_providers(/:4;S;S/T,3Rd6Q6QRRrM no_prefixcy)NrrL)rs rNrz@TerminalInteractiveShell._set_autosuggestions..no_prefix srMrcrdj|jDcgc]}|d c}dzScc}w)Nrs)join get_range)rss rNrzDTerminalInteractiveShell._set_autosuggestions..input_historys299O4M4M4O%Pqad%PQTXXX%Ps 4zNo valid provider.) autosuggestions_providerr isinstancerE disconnectrr_init_llm_providerrr _llm_prefixerrr)rproviderrrjrfunrs` rNrz-TerminalInteractiveShell._set_autosuggestionss  44H      >"     ( ( *   $D  1 1 6 8D  : :''S %)! ? AD 3DD   0//D{" (Y$"$'.1D   +12 2 ;;'+'8'8DKK $ rMrc>|j}|j|yr)rr)rrrs rN!_autosuggestions_provider_changedz:TerminalInteractiveShell._autosuggestions_provider_changed!s:: !!(+rM)command match_keys match_filternew_keys new_filtercreate) key_traitper_key_traitsa Add, disable or modifying shortcuts. Each entry on the list should be a dictionary with ``command`` key identifying the target function executed by the shortcut and at least one of the following: - ``match_keys``: list of keys used to match an existing shortcut, - ``match_filter``: shortcut filter used to match an existing shortcut, - ``new_keys``: list of keys to set, - ``new_filter``: a new shortcut filter to set The filters have to be composed of pre-defined verbs and joined by one of the following conjunctions: ``&`` (and), ``|`` (or), ``~`` (not). The pre-defined verbs are: {filters} To disable a shortcut set ``new_keys`` to an empty list. To add a shortcut add key ``create`` with value ``True``. When modifying/disabling shortcuts, ``match_keys``/``match_filter`` can be omitted if the provided specification uniquely identifies a shortcut to be modified/disabled. When modifying a shortcut ``new_filter`` or ``new_keys`` can be omitted which will result in reuse of the existing filter/keys. Only shortcuts defined in IPython (and not default prompt-toolkit shortcuts) can be modified or disabled. The full list of shortcuts, command identifiers and filters is available under :ref:`terminal-shortcuts-list`. Here is an example: .. code:: c.TerminalInteractiveShell.shortcuts = [ {{ "new_keys": ["c-q"], "command": "prompt_toolkit:named_commands.capitalize_word", "create": True, }}, {{ "new_keys": ["c-j"], "command": "prompt_toolkit:named_commands.beginning_of_line", "create": True, }}, ] z z - ``z``)filters)traitr shortcutsct|jr,|j|j|j_yy)Nuser_shortcuts)r_merge_shortcutsr key_bindingsrs rN_shortcuts_changedz+TerminalInteractiveShell._shortcuts_changedrs, ;;'+'<'rrgetrDrrlenrrrArB)rrrbindingallowed_commandsr shortcuts_to_skipshortcuts_to_addshortcut command_idold_keys old_filterkmatchingrr creating_newmodifying_existingkey specificationmatcheds rNrz)TerminalInteractiveShell._merge_shortcutswsE/5 (  goo . ?    ; "'*G3  &O H!),J!11#*<<0@#A  !l#33C2DF ||L$7H"X-#8N#;<  ,'7>>Z+G!)-FAa-F(-R)'//:jH H ||J5H!lD9J&z2G#<<%8L%1!1"$2  B !EFF! 5!h#&! ! x=A%$0z,X]Q&$6}oFEEMJP #1+$^^  -!(("%)2~ ''"%1 *5/z:$.#9!+%7%A CO d0;LM ' /G  g . /G  6.G 0!s)'JJ &J3 J <"JJ Jz9Display the current vi mode (when using vi editing mode).raThe format for line numbering, will be passed `line` (int, 1 based) the current line number and `rel_line` the relative line number. for example to display both you can use the following template string : c.TerminalInteractiveShell.prompt_line_number_format='{line: 4d}/{rel_line:+03d} | ' This will display the current line number, with leading space and a width of at least 4 character, as well as the relative line number 0 padded and always with a + or - sign. Note that when using Emacs mode the prompt of the first line may not update. term_titlec|jr?tr9tdt|jj t ytdy)NT)cwdF)r4_is_ttyr r term_title_formatformatrrs rNinit_term_titlez(TerminalInteractiveShell.init_term_titles; ??w !$ ' 41188Z\8J K !% (rMc@|jrtr tyyyr)r4r7r rs rNr z+TerminalInteractiveShell.restore_term_titles ??w   '?rMctt| |jjd}d|vrd|dvsdg|j_yy)NrDisplayFormatter active_typesz text/plain)rrinit_display_formatterdisplay_formatter _trait_valuesr>)rrrs rNr?z/TerminalInteractiveShell.init_display_formattersR &DF''55h? & (&);"<<3?.D " " /=rMcnjr fd}|_yjj}t }j t fd}ttjj}d_ tdj|||tj|dj j"j$dd j'_t+jt,r&jj/j(yy) NcdjdjjD}t|g}djdjj D}j dj|ddk(rA|j t|j dj|ddk(rAdj|S)Nrc3&K|] }|d ywr3NrL.0rs rN zSTerminalInteractiveShell.init_prompt_toolkit_cli..prompt.. s%Tqad%Tc3&K|] }|d ywrErLrFs rNrHzSTerminalInteractiveShell.init_prompt_toolkit_cli..prompt..s.AaD.rIrsr incomplete)rrin_prompt_tokensr continuation_prompt_tokenscheck_completer) prompt_textlinesprompt_continuationrs rNpromptz@TerminalInteractiveShell.init_prompt_toolkit_cli..prompt s gg%TDLL4Q4Q4S%TT {+,&(gg."&,,"I"I"K.'#))$))E*:;A>,NLL':!;<))$))E*:;A>,Nyy''rMrcjSr)rrsrNrzBTerminalInteractiveShell.init_prompt_toolkit_cli.. s T[[rMF)rz.py) rrrhistory completerenable_history_searchstyleinclude_default_pygments_style mouse_supportenable_open_in_editor color_depthtempfile_suffixrL)rprompt_for_coderrrrr-rr rr_use_asyncio_inputhookr*rr;rVrYextra_open_editor_shortcutsr[_extra_prompt_optionsrrrEconnect)rrRrrTptk_srs` rNinit_prompt_toolkit_cliz0TerminalInteractiveShell.init_prompt_toolkit_clis    ($*D ,,DNN,K $D) 01{D,=,=,C,C,EF &+## **%%(t4"&"<"<+0,,"&"B"B((! ((*   d'')H I    % %dkk 2 JrMcd|dk(sJ|jj}tj|d}|J||dk(r i}t}nBi|j |j }|jt|j}nt}tt|t|g}|S)z Small wrapper that make an IPython compatible style from a style name We need that to add style for prompt ... etc. rNnocolor) rrr r#rH extra_stylehighlighting_style_overridesbaser1r.r/r0)r name_or_clsrthemestyle_overrides style_clsrWs rNrz5TerminalInteractiveShell._make_style_from_name_or_cls7s h&&&""$- (&( Y  O IX!2!2Xd6W6WXOzz%-ejj9 $ ' 2(9   rMc|tjtjtjd|jS)N)rrr)r+ MULTI_COLUMNCOLUMN READLINE_LIKEdisplay_completionsrs rNpt_complete_stylez*TerminalInteractiveShell.pt_complete_styleVs9)55#**)77   " " $ $rMc>|jrtjSdSr) true_colorr( TRUE_COLORrs rNr[z$TerminalInteractiveShell.color_depth^s)- %%CdCrMrOrSrQcZtt|jj|||S)N)rPrQ)r$r`rrM)rrOrSrQs rN_ptk_prompt_contz)TerminalInteractiveShell._ptk_prompt_contbs- 7 77"%    rMcfd}jdk(rjdk(r|}dtj|jdj t tdtttztfdz t ttttztfd z gd }|S) z\ Return the current layout option for the current Terminal InteractiveShell cJtjjSr)r$rrLrsrN get_messagezCTerminalInteractiveShell._extra_prompt_options..get_messageps!$,,"?"?"AB BrMrrFTz[](){})charscjSr)highlight_matching_bracketsrsrNrz@TerminalInteractiveShell._extra_prompt_options..s (H(HrM) processorrc8tjtSr)rrrErsrNrz@TerminalInteractiveShell._extra_prompt_options..s  --;!rM)complete_in_threadlexerreserve_space_for_menumessagerQ multilinecomplete_styleinput_processors) rprompt_line_number_formatr<space_for_menurwrrr&r'r!rr#r"rF)rrzoptionss` rNr`z.TerminalInteractiveShell._extra_prompt_optionsls C    'D,J,Jb,P&-K#(#%&*&9&9"#'#8#8"44%?hO#N3xi  HIJ%;=#N3xi  ! @rMc |jr|j}d|_nd}td5|jrFt}|j |j j dd|i|j}n7|j jd||jd|j}ddd|S#1swYSxYw)NrT)rawr)r inputhookrL) rl_next_inputr)r^rrun_until_completer prompt_asyncr`rR _inputhook)rr asyncio_looptexts rNr]z(TerminalInteractiveShell.prompt_for_codes   ((G!%D Gd # ** 01 #66,DKK,, '+/+E+E+G *t{{))#"oo002 $ % $ s B CC cRtjdvryddl}|jy)N>cliwin32r)sysplatformcoloramainit)rrs rNinit_ioz TerminalInteractiveShell.init_ios <</ /  rMcTtt| |jtyr)rr init_magicsregister_magicsr6)rrs rNrz$TerminalInteractiveShell.init_magicss &9; ^,rMctt| tjdk(r$dD]}|j j || yy)Nrc)clearmorelessman)rr init_aliasrfrj alias_managersoft_define_alias)rcmdrs rNrz#TerminalInteractiveShell.init_aliassK &8: 77g 7 ?""44S#> ? rMrct||i||j|j|j |j d|_|j|jy)NT) rrrrrcr: keep_runningrr)rargskwargsrs rNrz!TerminalInteractiveShell.__init__s] $)&) !!$"?"?@ $$&   D../rMcd|_yr)rrs rNask_exitz!TerminalInteractiveShell.ask_exits !rMc>d|_|jrLt|jd |j}|r|j |d |jrKyy#t $r2|j r|jdddr|jYIwxYw)NTr)end) store_historyz#Do you really want to exit ([y]/n)?yn) rprint separate_inr]run_cellEOFError confirm_exit ask_yes_nor)rcodes rNinteractz!TerminalInteractiveShell.interacts  $"" + <++-MM$dM;  $))??+PQTUXYMMO $sA!!8BBc |j t|dr|jj|j |jy#t $r+}t dt|jzYd}~nd}~wwxYw t|dr|jj|j n;#t|dr|jj|j wxYw)N _eventloopz %s escaped interact() ) rrrstopr KeyboardInterruptrtyperI _atexit_once)res rNmainloopz!TerminalInteractiveShell.mainloops * 4.OO((*'') #% F1DG4D4DDEE FE 4.OO((*'')4.OO((*'')s)A B$!B C BC 8Dcdtdtd|j|j|yy)Nzvinputkook seem unused, and marked for deprecation/Removal as of IPython 9.0. Please open an issue if you are using it.r)category stacklevel)rDeprecationWarningr)rcontexts rNrz"TerminalInteractiveShell.inputhooks2  8'  ?? & OOG $ 'rMactive_eventloopguicR|rddlm}||}|jdur|td|dtdy|j| tdy|js|qt |\}}|j|k(r*|j jd|jd y|j jd |jd y|j|dx|_|_|r|d vrt |\|_|_ndx|_|_|d k(|_ y)Nr)_convert_gui_from_matplotlibTz$Cannot install event loop hook for "z&" when running with `--simple-prompt`.zSNOTE: Tk is supported natively; use Tk apps and Tk backends with `--simple-prompt`.zNo event loop hook running.zShell is already running the z eventloop. Doing nothingz8Shell is already running a different gui event loop for z5. Call with no arguments to disable the current loop.>Nwebaggasyncio) core.pylabtoolsrrrrr7loginforwarningr^)rrrnewev newinhooks rN enable_guiz#TerminalInteractiveShell.enable_guisB  F.s3C    %#/ 6se;ab  e   ?? "s{ / 0  ?? &3?:3? E9)+ 3D4I4I3JJcd HH  J4K`K`JabFF   ?? &3;6: :D !DO C//5PQT5U 2D !4?6: :D !DO&)Y&6#rMc8|jsy|jj}|jrAt t |d|jj jt|ydjd|D}t||dy)z>Overridden from the parent class to use fancy rewriting promptNr)rrWc3&K|] \}}| ywrrL)rGtrs rNrHz>TerminalInteractiveShell.auto_rewrite_input..Us241aQ2rI)sep) show_rewritten_inputrrewrite_prompt_tokensrr,r$apprWrr)rrtokensrRs rNauto_rewrite_inputz+TerminalInteractiveShell.auto_rewrite_inputJsp(( 335 ;; !7R'+{{'<'< > #JWW2622F  &rMc|r"|j|_t||_y|jr|j|_d|_yy)z+Switch prompts to classic for %doctest_modeN)r_prompts_beforer9)rrrs rNswitch_doctest_modez,TerminalInteractiveShell.switch_doctest_modeYs@ #'<$$DD c   1fB- ?0"M< 4J%'+hsm*)7hsm)7t)7Z ( (F 'O(W'Ss Ur__main__)|rrfrrTwarningsrtypingrrrIPython.core.async_helpersrIPython.core.interactiveshellrrIPython.utils.py3compatr IPython.utils.PyColorizer IPython.utils.terminalr r r IPython.utils.processr traitletsrrrrrrrrrrrrrrtraitlets.utils.importstringrprompt_toolkit.auto_suggestrprompt_toolkit.enumsrr prompt_toolkit.filtersr!r"r#prompt_toolkit.formatted_textr$prompt_toolkit.historyr% prompt_toolkit.layout.processorsr&r'prompt_toolkit.outputr(prompt_toolkit.patch_stdoutr)prompt_toolkit.shortcutsr*r+r,prompt_toolkit.stylesr-r.prompt_toolkit.styles.pygmentsr/r0pygments.stylesr1pygments.styler2debuggerr4r5magicsr6 pt_inputhooksr7rr8r9r:ptutilsr;r<rr=r>r?r@rArBshortcuts.filtersrCrDshortcuts.auto_suggestrErFrHrr`rk_namer_streamrror7rrgrr{rrrregisterrIinstancerrLrMrNrs5 /7O)0\\,"5?<>>8*d,4WW<\- &"6CC7F  u ""#&"47"6 &+ Ec5!Gggx8@PG AQ G/"**<Ng+  " # # JU(/U(r56 z%%'002Q  s:GG G