o
    š©Zh$  ã                   @   s2   d Z ddlZddlmZ ddlmZ ddd„ZdS )	z0Simple function for embedding an IPython kernel
é    N)Úextract_module_localsé   )ÚIPKernelAppc                 K   s˜   t  ¡ r	t  ¡ }nt jdi |¤Ž}| g ¡ |jjj}|dur'|tj|jjj	< t
dƒ\}}| du r3|} |du r9|}| |j_||j_|j ¡  | ¡  dS )a  Embed and start an IPython kernel in a given scope.

    Parameters
    ----------
    module : ModuleType, optional
        The module to load into IPython globals (default: caller)
    local_ns : dict, optional
        The namespace to load into IPython user namespace (default: caller)
    kwargs : dict, optional
        Further keyword args are relayed to the IPKernelApp constructor,
        allowing configuration of the Kernel.  Will only have an effect
        on the first embed_kernel call for a given process.

    Nr   © )r   ZinitializedÚinstanceZ
initializeZkernelÚshellZ_orig_sys_modules_main_modÚsysÚmodulesZ_orig_sys_modules_main_namer   Zuser_moduleZuser_nsZset_completer_frameÚstart)ÚmoduleZlocal_nsÚkwargsZappÚmainZcaller_moduleZcaller_localsr   r   úF/var/www/html/lang_env/lib/python3.10/site-packages/ipykernel/embed.pyÚembed_kernel   s    



r   )NN)Ú__doc__r   ZIPython.utils.framer   Z	kernelappr   r   r   r   r   r   Ú<module>   s
    