
    ^h                         S SK r S SKJr  S SKJr  S SKJr  S SKJr  S SK	J
r
   " S S\R                  \\
S	9rS
SS.S jrg)    N)InteractiveShell)InteractiveShellEmbed)load_default_config)
singletons)UsesIPyflowShellc                       \ rS rSrSrg)IPyflowInteractiveShellEmbed    N)__name__
__module____qualname____firstlineno____static_attributes__r       ]/home/james-whalen/.local/lib/python3.13/site-packages/ipyflow/shell/interactiveshellembed.pyr	   r	      s     	r   r	   )	metaclass )headercompile_flagsc                 r   UR                  S5      nUc  [        5       nUR                  Ul        X2S'   UR                  SS5      nU(       a  US   R	                  SUS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 IPyflow 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 ipyflow.shell 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`).
configNusingsyncTerminalInteractiveShellNoColor)loop_runnercolors	autoawait   _init_location_id:   )r   stack_depthr   _call_location_idr   )getr   r   r   updatesysps1ps2AttributeErrorr   	_instancetypeclear_instance	_getframer	   instancef_codeco_filenamef_lineno	_walk_mro)r   r   kwargsr   r   r)   r*   saved_shell_instanceclsframeshellsubclasss               r   embedr;      s   F ZZ!F~$&'-'F'F$!xJJw'Ex*#('!&&-	
 C
Cgggg ,55''(MM!E(11 %*\\%=%=u~~NRXE 
#%*\\%=%=u~~N	 !//1''(H!5 (
 1  s   / F( (
F65F6)r(   IPython.core.interactiveshellr   IPython.terminal.embedr   IPython.terminal.ipappr   ipyflowr   ipyflow.shell.interactiveshellr   IPyflowShellr	   r;   r   r   r   <module>rB      s=    
 : 8 6  ;	2>N	 d Sr   