ó
    Ñ]j$?  ã                   ó  • S r SSKrSSKrSSKJrJr  SSKJr  SSKJrJ	r	J
r
  SSKJrJr  SSKJr  SSKJr  SS	KJrJrJr  SS
KJr  SSKJr   " S S\5      r\r\	 " S S\5      5       r " S S5      r " S S\5      rSSS.S jr g)z
An embedded IPython shell.
é    N)ÚultratbÚ
compilerop)Úmagic_arguments)ÚMagicsÚmagics_classÚ
line_magic)ÚInteractiveShellÚmake_main_module_type)ÚTerminalInteractiveShell)Úload_default_config)ÚBoolÚCBoolÚUnicode)Ú
ask_yes_no)ÚSetc                   ó   • \ rS rSrSrg)ÚKillEmbeddedé   © N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__static_attributes__r   ó    ÚS/home/mande/repo/quber/.venv/lib/python3.13/site-packages/IPython/terminal/embed.pyr   r      s   † šdr   r   c                   óè   • \ rS rSr\\R
                  " 5       \R                  " SSSSS9\R                  " SSSS	S9\R                  " S
SSSS9SS j5       5       5       5       5       r\SS j5       rSr	g)ÚEmbeddedMagicsé   z-iz
--instanceÚ
store_truez&Kill instance instead of call location)ÚactionÚhelpz-xz--exitzAlso exit the current sessionz-yz--yeszDo not ask confirmationc                 óö  • [         R                  " U R                  U5      n[        U5        UR                  (       aM  UR
                  (       d  [        SS5      nOSnU(       a%  U R                  R                  5         [        S5        OCUR
                  (       d  [        SS5      nOSnU(       a  SU R                  l	        [        S5        UR                  (       a  U R                  R                  5         gg)	a£  %kill_embedded : deactivate for good the current embedded IPython

This function (after asking for confirmation) sets an internal flag so
that an embedded IPython will never activate again for the given call
location. This is useful to permanently disable a shell that is being
called inside a loop: once you've figured out what you needed from it,
you may then kill it and the program will then continue to run without
the interactive shell interfering again.

Kill Instance Option:

    If for some reasons you need to kill the location where the instance
    is created and not called, for example if you create a single
    instance in one place and debug in many locations, you can use the
    ``--instance`` option to kill this specific instance. Like for the
    ``call location`` killing an "instance" should work even if it is
    recreated within a loop.

.. note::

    This was the default behavior before IPython 5.2

z<Are you sure you want to kill this embedded instance? [y/N] ÚnTzIThis embedded IPython instance will not reactivate anymore once you exit.zAAre you sure you want to kill this embedded call_location? [y/N] FzOThis embedded IPython  call location will not reactivate anymore once you exit.N)r   Úparse_argstringÚkill_embeddedÚprintÚinstanceÚyesr   ÚshellÚ_disable_init_locationÚembedded_activeÚexitÚask_exit)ÚselfÚparameter_sÚargsÚkills       r   r&   ÚEmbeddedMagics.kill_embedded"   sÈ   € ôB ×.Ò.¨t×/AÑ/AÀ;ÓOˆÜˆdŒØ�=�=à—8—8Ü!ØRÐTWóY‘ð �ÞØ—
‘
×1Ñ1Ô3Üð 'ô (øð —8—8Ü!ØWÐY\ó^‘ð �ÞØ-2�—
‘
Ô*Üð 'ô (ð �9�9ð �J‰J×ÑÕ!ð r   c                 óZ   • SU R                   l        U R                   R                  5         g)a=  %exit_raise Make the current embedded kernel exit and raise and exception.

This function sets an internal flag so that an embedded IPython will
raise a `IPython.terminal.embed.KillEmbedded` Exception on exit, and then exit the current I. This is
useful to permanently exit a loop that create IPython embed instance.
TN)r*   Úshould_raiser.   )r/   r0   s     r   Ú
exit_raiseÚEmbeddedMagics.exit_raisea   s    € ð #'ˆ�
‰
ÔØ�
‰
×ÑÕr   r   N)Ú )
r   r   r   r   r   r   Úargumentr&   r6   r   r   r   r   r   r      s”   † ð Ø×$Ò$Ó&Ø×Ò˜d L¸Ø#KñMà×Ò˜d H°\Ø#BñDà×Ò˜d G°LØ#<ñ>ó4"ó>óDóMó 'ó ð4"ðn ó	ó ó	r   r   c                   ó    • \ rS rSrS rS rSrg)Ú	_Sentinelén   c                 ó>   • [        U[        5      (       d   eXl        g ©N)Ú
isinstanceÚstrÚrepr)r/   rA   s     r   Ú__init__Ú_Sentinel.__init__o   s   € Ü˜$¤×$Ñ$Ð$Ð$Ø�	r   c                 ó   • [         $ r>   ©rA   ©r/   s    r   Ú__repr__Ú_Sentinel.__repr__s   s   € Üˆr   rE   N)r   r   r   r   rB   rG   r   r   r   r   r;   r;   n   s   † òõr   r;   c                   óB  ^ • \ rS rSr% \" S5      r\" S5      r\" S5      r	\" S5      r
\" S5      r\" 5       r\" SSS9R                  SS9r\" 5       r\\   \S'   S	 r\S
 5       r\R,                  S 5       rU 4S jrS rU 4S jr      SS jr    SS jrSrU =r$ )ÚInteractiveShellEmbedéw   Fr8   Tz$Automatically set the terminal title)r"   )ÚconfigÚ_inactive_locationsc                 óV   • [         R                  R                  U R                  5        g)z.Disable the current Instance creation locationN)rJ   rM   ÚaddÚ_init_location_idrF   s    r   r+   Ú,InteractiveShellEmbed._disable_init_location‰   s   € ä×1Ñ1×5Ñ5°d×6LÑ6LÕMr   c                 ó„   • U R                   [        R                  ;  =(       a    U R                  [        R                  ;  $ r>   )Ú_call_location_idrJ   rM   rP   rF   s    r   r,   Ú%InteractiveShellEmbed.embedded_active�   s8   € à×&Ñ&Ô.C×.WÑ.WÑW÷ ZØ×'Ñ'Ô/D×/XÑ/XÑXð	Zr   c                 ó
  • U(       aS  [         R                  R                  U R                  5        [         R                  R                  U R                  5        g [         R                  R                  U R                  5        g r>   )rJ   rM   ÚdiscardrS   rP   rO   )r/   Úvalues     r   r,   rT   ’   s^   € æÜ!×5Ñ5×=Ñ=Ø×&Ñ&ô(ä!×5Ñ5×=Ñ=Ø×&Ñ&õ(ô "×5Ñ5×9Ñ9Ø×&Ñ&õ(r   c                 óð  >• SU;  d   S5       e[        U 5      nUR                  c#  UR                  5        H	  nXl        M     Xl        UR                  SS 5      nU(       d=  [        R
                  " S5      nUR                  R                  < SUR                  < 3nX@l	        [        [        U ]2  " S0 UD6  [        R                  " U R                  U R                   U R"                  S9[        l        g )NÚuser_global_nszXKey word argument `user_global_ns` has been replaced by `user_module` since IPython 4.0.rP   é   Ú:)Ú
theme_nameÚmodeÚcall_pdbr   )ÚtypeÚ	_instanceÚ	_walk_mroÚpopÚsysÚ	_getframeÚf_codeÚco_filenameÚf_linenorP   ÚsuperrJ   rB   r   ÚFormattedTBÚcolorsÚxmodeÚpdbÚ
excepthook)r/   ÚkwÚclsÚsubclassÚclidÚframeÚ	__class__s         €r   rB   ÚInteractiveShellEmbed.__init__�   sÉ   ø€ à BÓ&ð	fàeó	fØ&ô �4‹jˆØ�=‰=Ñ ØŸM™MžO�Ø%)Ö"ñ ,à ŒMà�v‰vÐ)¨4Ó0ˆÞÜ—M’M !Ó$ˆEØ#Ÿl™l×6Ô6¸¿»ÐGˆDØ!%ÔäÔ# DÒ2Ñ8°RÒ8ô !×,Ò,Ø—{‘{Ø—‘Ø—X‘Xñ
Œ�r   c                 ó   • g)zJ
Explicitly overwrite :mod:`IPython.core.interactiveshell` to do nothing.
Nr   rF   s    r   Úinit_sys_modulesÚ&InteractiveShellEmbed.init_sys_modules¸   s   € ð 	r   c                 óT   >• [         [        U ]  5         U R                  [        5        g r>   )rh   rJ   Úinit_magicsÚregister_magicsr   )r/   rs   s    €r   ry   Ú!InteractiveShellEmbed.init_magics¾   s   ø€ ÜÔ# TÑ6Ô8Ø×Ñœ^Õ,r   c                 ó®  • SU l         UR                  SS5      nU(       d=  [        R                  " S5      n	U	R                  R
                  < SU	R                  < 3nX€l        U R                  (       d  gSU l	        U(       d  US:w  a  U R                  (       a  gU(       a,  U R                  U l        U R                  S-   U-   S-   U l        OS	U l        U R                  (       a  U R                  5         U R                  X#XVS
9  U R                  U l        U R                   b  [#        U R                   5        U R$                  (       a  ['        S5      eg)aŽ  Activate the interactive interpreter.

__call__(self,header='',local_ns=None,module=None,dummy=None) -> Start
the interpreter shell with the given local and global namespaces, and
optionally print a header string at startup.

The shell can be globally activated/deactivated using the
dummy_mode attribute. This allows you to turn off a shell used
for debugging globally.

However, *each* time you call the shell you can override the current
state of dummy_mode with the optional keyword parameter 'dummy'. For
example, if you set dummy mode on with IPShell.dummy_mode = True, you
can still have a specific call work by making it as IPShell(dummy=False).
TrS   NrZ   r[   Fr   Ú
r8   )Ústack_depthÚcompile_flagsz2Embedded IPython raising error, as user requested.)Úkeep_runningrb   rc   rd   re   rf   rg   rS   r,   Úexit_nowÚ
dummy_modeÚbanner2Úold_banner2Údisplay_bannerÚshow_bannerÚmainloopÚexit_msgr'   r5   r   )
r/   ÚheaderÚlocal_nsÚmoduleÚdummyr~   r   rn   rq   rr   s
             r   Ú__call__ÚInteractiveShellEmbed.__call__Â   s  € ð6 !ˆÔð �v‰vÐ)¨4Ó0ˆÞÜ—M’M !Ó$ˆEØ#Ÿl™l×6Ô6¸¿»ÐGˆDØ!%Ôà×#×#Øð ˆŒö �U˜a“Z D§O§OØö Ø#Ÿ|™|ˆDÔØŸ<™<¨$Ñ.°Ñ7¸$Ñ>ˆD�Là!ˆDÔà××Ø×ÑÔð 	�‰Ø¨+ð 	ñ 	
ð ×'Ñ'ˆŒà�=‰=Ñ$Ü�$—-‘-Ô à××ÜÐSÓTÐTð r   c           	      óþ  • Ub  Ub  Uc�  U R                   (       a  [        R                  " U5      R                  nUc  UR                  nUc#  UR
                  n [        R                  US      nUc'  UR                  R                  [        R                  -  nU R                   nU R"                  nU R$                  R&                  n	Ub  X l        UbY  UR)                  5        V
Vs0 s H&  u  p«X R*                  R-                  5       ;  d  M$  X«_M(     nn
nXÀl        U R/                  5         Ub  X@R$                  l        U R1                  5         U R2                     U R4                     U R7                  5         SSS5        SSS5        Ub]  UR9                  U R"                  R)                  5        V
Vs0 s H&  u  p«X R*                  R-                  5       ;  d  M$  X«_M(     snn
5        Xpl        X€l        X�R$                  l        g! [         a=    [        R                  " SUR                  SS5      -  5        [        U5      " 5       n GNÝf = fs  snn
f ! , (       d  f       Nã= f! , (       d  f       Nì= fs  snn
f )am  Embeds IPython into a running python program.

Parameters
----------
local_ns, module
    Working local namespace (a dict) and module (a module or similar
    object). If given as None, they are automatically taken from the scope
    where the shell was called, so that program variables become visible.
stack_depth : int
    How many levels in the stack to go to looking for namespaces (when
    local_ns or module is None). This allows an intermediate caller to
    make sure that this function gets the namespace from the intended
    level in the stack. By default (0) it will get its locals and globals
    from the immediate caller.
compile_flags
    A bit field identifying the __future__ features
    that are enabled, as passed to the builtin :func:`compile` function.
    If given as None, they are automatically taken from the scope where
    the shell was called.

Nr   zFailed to get module %szunknown module)Údefault_user_namespacesrc   rd   Úf_backÚf_localsÚ	f_globalsÚmodulesÚKeyErrorÚwarningsÚwarnÚgetr
   re   Úco_flagsr   Ú	PyCF_MASKÚuser_moduleÚuser_nsÚcompileÚflagsÚitemsÚuser_ns_hiddenÚkeysÚinit_user_nsÚset_completer_frameÚbuiltin_trapÚdisplay_trapÚinteractÚupdate)r/   rŠ   r‹   r~   r   Ú
call_frameÚ	global_nsÚorig_user_moduleÚorig_user_nsÚorig_compile_flagsÚkÚvÚreentrant_local_nss                r   r‡   ÚInteractiveShellEmbed.mainloop	  s  € ð< Ñ ¡°=Ñ3HØ×,×,ÜŸš {Ó3×:Ñ:ˆJàÑØ%×.Ñ.�Ø‰~Ø&×0Ñ0�	ð@Ü Ÿ[™[¨°:Ñ)>Ñ?�Fð Ñ$Ø!+×!2Ñ!2×!;Ñ!;Ü!+×!5Ñ!5ñ"6�ð
  ×+Ñ+ÐØ—|‘|ˆØ!Ÿ\™\×/Ñ/Ðð
 ÑØ%Ôð ÑØ5=·^±^Ô5EÔ!mÒ5E©6¨AÈ×ReÑRe×RjÑRjÓRlÑIl£$ !¢$Ñ5EÐÑ!mØ-ŒLØ×ÑÔð Ñ$Ø!.�L‰LÔð 	× Ñ Ô"à×Ó × 1Ó 1Ø�M‰MŒO÷ !2×ð ÑØ�O‰O°·±×0BÑ0BÔ0DÔlÒ0D¡f qÈ×QdÑQd×QiÑQiÓQkÑHk›T˜QšTÑ0DÒlÔmð ,ÔØ#ŒØ/�‰Õøôc  ó @Ü—M’MÐ";Ø!Ÿ™ jÐ2BÓCñ#Dô ô 3°9Ô=Ó?“Fð	@üó4 "n÷ !2Õ 1ú×Õüó
 msO   ÁH Ã'#IÄIÅI(Å)IÅ:I(Æ5#I9
ÇI9
ÈAIÉIÉ
I%	É!I(É(
I6)rS   rP   rƒ   r�   r€   r„   r›   rœ   )r8   NNNrZ   N)NNr   N)r   r   r   r   r   r‚   r   rˆ   r   Úembeddedr5   r…   ÚtagÚ
term_titleÚsetrM   r   r@   Ú__annotations__r+   Úpropertyr,   ÚsetterrB   rv   ry   r�   r‡   r   Ú__classcell__)rs   s   @r   rJ   rJ   w   sç   ø‡ á�e“€JÙ�r‹{€HÙ�T‹{€HÙ˜“<€Lñ ˜4“[€NÙ‹y€Hñ �eØ3ñç	�c�€cÐð ñ %(£EÐ˜˜S™Ó)òNð ñZó ðZð ×Ññ(ó ð(õ
ò6õ-ð ØØØØØôEUðR ØØØ÷Y0ò Y0r   rJ   r8   )r‰   r   c                 ó–  • UR                  S5      nUc  [        5       nUR                  Ul        X2S'   UR                  SS5      nUR	                  SS5      nU(       a  US   R                  SUUUS:g  S.05        SnSn [        R                  n[        R                  n[        R                  nUb  [        U5      n	U	R                  5         [        R                  " S	5      n
[        R                  " SS
U
R                   R"                  < SU
R$                  < 30UD6nU" U SUU
R                   R"                  < SU
R$                  < 3S9  [        R                  5         Ub8  [        U5      n	U	R                  5         U	R'                  5        H	  nXŒl        M     Ub  U[        l        U[        l        gg! [         a     GN&f = f)a®  Call this to embed IPython at the current point in your program.

The first invocation of this will create a :class:`terminal.embed.InteractiveShellEmbed`
instance and then call it.  Consecutive calls just call the already
created instance.

If you don't want the kernel to initialize the namespace
from the scope of the surrounding function,
and/or you want to load full IPython configuration,
you probably want `IPython.start_ipython()` instead.

Here is a simple example::

    from IPython import embed
    a = 10
    b = 20
    embed(header='First time')
    c = 30
    d = 40
    embed()

Parameters
----------

header : str
    Optional header string to print at startup.
compile_flags
    Passed to the `compile_flags` parameter of :py:meth:`terminal.embed.InteractiveShellEmbed.mainloop()`,
    which is called when the :class:`terminal.embed.InteractiveShellEmbed` instance is called.
**kwargs : various, optional
    Any other kwargs will be passed to the :class:`terminal.embed.InteractiveShellEmbed` constructor.
    Full customization can be done by passing a traitlets :class:`Config` in as the
    `config` argument (see :ref:`configure_start_ipython` and :ref:`terminal_options`).
rL   NÚusingÚsyncrj   Únocolorr   )Úloop_runnerrj   Ú	autoawaitrZ   rP   r[   é   )r‰   r~   r   rS   r   )r˜   r   r   rJ   rb   r§   rc   Úps1Úps2ÚAttributeErrorr	   r`   r_   Úclear_instancerd   r(   re   rf   rg   ra   )r‰   r   ÚkwargsrL   rº   rj   rÀ   rÁ   Úsaved_shell_instancero   rr   r*   rp   s                r   ÚembedrÆ   e  s§  € ðF �Z‰Z˜Ó!€FØ�~Ü$Ó&ˆØ'-×'FÑ'FˆÔ$Ø!ˆxÑØ�J‰J�w Ó'€EØ�Z‰Z˜ )Ó,€FÞØˆxÑ×Ñà*Ø#(Ø$Ø!&¨&¡ñ-ðô	
ð €CØ
€CðÜ�g‰gˆÜ�g‰gˆô ,×5Ñ5ÐØÑ'ÜÐ'Ó(ˆØ×ÑÔÜ�MŠM˜!Ó€EÜ!×*Ò*ñ =Ø�‰× Ô  %§.£.ð>2ð =Ø5;ñ=€Eá	� Q°mØ%*§\¡\×%=Ô%=¸u¿~»~ÐNòPä×(Ñ(Ô*àÑ'ÜÐ'Ó(ˆØ×ÑÔØŸ™žˆHØ!5Öñ (à
�ØŒŒØŒ�ð øô' ó Úðús   Â F: Æ:
GÇG)!Ú__doc__rc   r–   ÚIPython.corer   r   r   ÚIPython.core.magicr   r   r   ÚIPython.core.interactiveshellr	   r
   Ú!IPython.terminal.interactiveshellr   ÚIPython.terminal.ipappr   Ú	traitletsr   r   r   ÚIPython.utils.ior   Útypingr   Ú	Exceptionr   ÚKillEmbededr   r;   rJ   rÆ   r   r   r   Ú<module>rÒ      sˆ   ðñó Û ç ,Ý (ß ?Ñ ?ß QÝ FÝ 6ç *Ñ *Ý 'å ä "�9Ô "ð €ð ôK�Vó Kó ðK÷\ñ ôk0Ð4ô k0ð\  dö Or   