
    yhP&                        S r SSKJr  SSKrSSKrSSKrSSKrSSKrSSKrSSK	r	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  \R*                  R,                  rS	\	R0                  S   -  r\" \" \5      R6                  S
5      r    S         SS jjr S     SS jjr    S         SS jjrSS\SSSSS4                 SS jjr  " S S\5      r!\"S:X  a  \!RG                  5         gg)z#The IPython kernel spec for Jupyter    )annotationsN)Path)Any)KernelSpecManager)Unicode)Applicationzpython%i	resourcesc                r    Uc  [         R                  nU=(       d    / nU=(       d    / nU/UQSPU PSPSPUQ$ )a  Build Popen command list for launching an IPython kernel.

Parameters
----------
mod : str, optional (default 'ipykernel')
    A string of an IPython module whose __main__ starts an IPython kernel
executable : str, optional (default sys.executable)
    The Python executable to use for the kernel process.
extra_arguments : list, optional
    A list of extra arguments to pass when executing the launch code.

Returns
-------
A Popen command list
z-mz-fz{connection_file})sys
executable)modr   extra_argumentspython_argumentss       lc:\Users\julio\OneDrive\Documentos\Trabajo\IdeasFrscas\Cabanna\env\Lib\site-packages\ipykernel/kernelspec.pymake_ipkernel_cmdr      sR    * ^^
%+O'-2b)b4bbdb<ObRabb    c                J    [        XS9S[        R                  S   -  SSS0S.$ )zConstruct dict for kernel.jsonr   r   zPython %i (ipykernel)r   pythondebuggerT)argvdisplay_namelanguagemetadata)r   r   version_infor   s     r   get_kernel_dictr   ;   s9    
 "+
 0#2B2B12EE& r   c                8   U c$  [        [        R                  " SS95      [        -  n [        R
                  " [        U 5        [        U 5      R                  5       R                  nU[        R                  -  (       d+  [        U 5      R                  U[        R                  -  5        [        X#5      nU(       a  UR                  U5        [        [        U S5      S5       n[        R                   " XVSS9  SSS5        [#        U 5      $ ! , (       d  f       N= f)zWrite a kernel spec directory to `path`

If `path` is not specified, a temporary directory is created.
If `overrides` is given, the kernelspec JSON is updated before writing.

The path to the kernelspec is always returned.
N_kernels)suffixzkernel.jsonw   )indent)r   tempfilemkdtempKERNEL_NAMEshutilcopytree	RESOURCESstatst_modeS_IWUSRchmodr   updateopenpjoinjsondumpstr)path	overridesr   r   maskkernel_dictfs          r   write_kernel_specr8   I   s     |H$$J78;F OOIt$ :??$$D$,,T
,- "/DK9%	eD-(#	.!		++ 
/ t9 
/	.s   "D
DFc                   U c
  [        5       n Uc  0 nU[        :w  a  Uc  Un0 nU(       a  X8S'   U(       a'  SU/n	U(       d  S[        R                  S   U4-  US'   OSn	Sn
[        R                  S:  a/  [        R
                  " 5       S:X  a  U(       d  S/n
OS	U;  a  S
US	'   U(       a  XhS'   [        XU
S9nU R                  XXS9n[        R                  " U5        U$ )aw  Install the IPython kernelspec for Jupyter

Parameters
----------
kernel_spec_manager : KernelSpecManager [optional]
    A KernelSpecManager to use for installation.
    If none provided, a default instance will be created.
user : bool [default: False]
    Whether to do a user-only install, or system-wide.
kernel_name : str, optional
    Specify a name for the kernelspec.
    This is needed for having multiple IPython kernels for different environments.
display_name : str, optional
    Specify the display name for the kernelspec
profile : str, optional
    Specify a custom profile to be loaded by the kernel.
prefix : str, optional
    Specify an install prefix for the kernelspec.
    This is needed to install into a non-default location, such as a conda/virtual-env.
env : dict, optional
    A dictionary of extra environment variables for the kernel.
    These will be added to the current environment variables before the
    kernel is started
frozen_modules : bool, optional
    Whether to use frozen modules for potentially faster kernel startup.
    Using frozen modules prevents debugging inside of some built-in
    Python modules, such as io, abc, posixpath, ntpath, or stat.
    The frozen modules are used in CPython for faster interpreter startup.
    Ignored for cPython <3.11 and for other Python implementations.

Returns
-------
The path where the kernelspec was installed.
Nr   	--profilezPython %i [profile=%s]r   )      CPythonz-Xfrozen_modules=offPYDEVD_DISABLE_FILE_VALIDATION1env)r4   r   r   )kernel_nameuserprefix)
r   r%   r   r   platformpython_implementationr8   install_kernel_specr&   rmtree)kernel_spec_managerrB   rA   r   rC   profiler@   frozen_modulesr4   r   r   r3   dests                r   installrL   l   s
   X "/1
{{")= # "I$0.!&0(@CDTDTUVDWY`Ca(aIn% 7"x'E'E'G9'T 67-S8 58C01
%O_D 22D 3 D MM$Kr   c                  @    \ rS rSrSr\" S5      rSS	S jjrS
S jrSr	g)InstallIPythonKernelSpecApp   zDummy app wrapping argparsezipython-kernel-installNc                <    Uc  [         R                  SS nXl        g)zInitialize the app.Nr!   )r   r   )selfr   s     r   
initialize&InstallIPythonKernelSpecApp.initialize   s    <88AB<D	r   c           	        SSK nUR                  U R                  SS9nUR                  SSSS9  UR                  S	[        [
        S
S9  UR                  S[        SS9  UR                  S[        SS9  UR                  S[        SS9  UR                  SS[        R                  SS[        R                  -  S9  UR                  SSSSSS9  UR                  SSSS9  UR                  U R                  5      nUR                  (       a  [        UR                  5      Ul
         [        UR                  UR                  UR                  UR                  UR                  UR                  S 9n['        S$UR                   S%U 35        g! [          av  nUR"                  ["        R$                  :X  aR  ['        U[        R(                  S!9  UR                  (       a  ['        S"[        R(                  S!9  U R+                  S#5        e SnAff = f)&zStart the app.r   Nz Install the IPython kernel spec.)progdescriptionz--user
store_truez3Install for the current user instead of system-wide)actionhelpz--namezdSpecify a name for the kernelspec. This is needed to have multiple IPython kernels at the same time.)typedefaultrY   z--display-namezdSpecify the display name for the kernelspec. This is helpful when you have multiple IPython kernels.)rZ   rY   r:   z]Specify an IPython profile to load. This can be used to create custom versions of the kernel.z--prefixzSpecify an install prefix for the kernelspec. This is needed to install into a non-default location, such as a conda/virtual-env.z--sys-prefixstore_constrC   z[Install to Python's sys.prefix. Shorthand for --prefix='%s'. For use in conda/virtual-envs.)rX   constrK   rY   z--envappend   )ENVVALUEz)Set environment variables for the kernel.)rX   nargsmetavarrY   z--frozen_moduleszEnable frozen modules for potentially faster startup. This has a downside of preventing the debugger from navigating to certain built-in modules.)rB   rA   rI   rC   r   r@   )filez$Perhaps you want `sudo` or `--user`?r!   zInstalled kernelspec z in )argparseArgumentParsernameadd_argumentr2   r%   r   rC   
parse_argsr   r@   dictrL   rB   rI   r   OSErrorerrnoEACCESprintstderrexit)rQ   re   parseroptsrK   es         r   start!InstallIPythonKernelSpecApp.start   s   (((J ) 
 	F 	 	

 	Q	 	 	
 	G 	 	
 	H 	 	
 	c 	 	
 	 **KMPZZX 	 	
 	$< 	 	
 	k 	 	
   +88DHH~DH	YY II{{!..HHD 	%dii[TF;<  	ww%,,&acjj)99@szzR		!	s   &A
F 
HA1HH)r   )N)r   list[str] | NonereturnNone)rw   rx   )
__name__
__module____qualname____firstlineno____doc__r   rg   rR   rt   __static_attributes__ r   r   rN   rN      s    %+,DM=r   rN   __main__)ipykernel_launcherNNN)
r   r2   r   
str | Noner   rv   r   rv   rw   z	list[str])NN)r   rv   r   rv   rw   zdict[str, Any])NNNN)
r3   zPath | str | Noner4   zdict[str, Any] | Noner   rv   r   rv   rw   r2   )rH   zKernelSpecManager | NonerB   boolrA   r2   r   r   rC   r   rI   r   r@   zdict[str, str] | NonerJ   r   rw   r2   )$r}   
__future__r   rl   r0   osrD   r&   r)   r   r#   pathlibr   typingr   jupyter_client.kernelspecr   	traitletsr   traitlets.configr   r3   joinr/   r   r%   __file__parentr(   r   r   r8   rL   rN   ry   launch_instancer   r   r   <module>r      s   )
 #   	    
    7  (
3++A.. $x.''5	 $!(,)-	c	cc &c '	c
 c: TX%@P #'+(,)-	 
 $  &  '	 
 	 H 59"#!% W1W
W W 	W
 W W 
W W 	WzX=+ X=v z//1 r   