+
    ^|i                         R t ^ RIt^ RIt^ RIt^ RIt^ RIt^ RIHt ^ RIH	t	H
t
Ht R tR t0 R
mt0 Rmt0 RmtRR0t]
 ! R R	]	4      4       tR# )z5Implementation of packaging-related magic functions.
N)Path)Magicsmagics_class
line_magicc                 F   a  \         P                  ! S 4      V 3R  l4       pV# )c                    < \        \        P                  RR4      P                  4       '       g   \	        R4      hS! V / VB # )z>Return True if the current Python executable is in a conda env
conda-metahistoryzbThe python kernel does not appear to be a conda environment.  Please use ``%pip install`` instead.)r   sysprefixexists
ValueError)argskwargsfuncs   *,?/usr/lib/python3/dist-packages/IPython/core/magics/packaging.pywrapper%is_conda_environment.<locals>.wrapper   sE     CJJi8??AA7  T$V$$    )	functoolswraps)r   r   s   f r   is_conda_environmentr      s%    __T% % Nr   c                   RpRV P                  4       9   d   RpV\        P                  9   dP   \        \        P                  V,          4      pVP	                  4       '       d   \        VP                  4       4      # \        \        P                  4      P                  V ,          pVP	                  4       '       d   \        V4      # \        \        P                  RR4      P                  RR7      p\        P                  ! RV  R	2V\        P                  R
7      pV'       d   VP                  4       R,          # V # )zFind the path to the given executable

Parameters
----------

executable: string
    Value should be: conda, mamba or micromamba
	CONDA_EXEmamba	MAMBA_EXEr   r	   zutf-8)encodingz^#\s*cmd:\s*(?P<command>.*z)\s[create|install])flagscommand)lowerosenvironr   is_filestrresolver
   
executableparentr   	read_textresearch	MULTILINE	groupdict)r   base_executabler%   r	   matchs   &    r   _get_conda_like_executabler.   $   s     "O'--/!%"**$"**_56
z))+,, cnn%,,w6J: 3::|Y7AA7ASGII%gY.ABllE
  ++ Nr   z-yz--yc                      a  ] tR t^Xt o Rt]R 4       tR t]]R 4       4       t	]]R 4       4       t
]]R 4       4       t]R 4       tRtV tR	# )
PackagingMagicsz*Magics related to packaging & installationc                   \         P                  p\         P                  R8X  d   RV,           R,           pM\        P                  ! V4      pV P
                  P                  RP                  VRRV.4      4       \        R4       R# )zURun the pip package manager within the current kernel.

Usage:
  %pip install [pkgs]
win32" -mpipANote: you may need to restart the kernel to use updated packages.N	r
   r%   platformshlexquoteshellsystemjoinprintselflinepythons   && r   r6   PackagingMagics.pip\   sb     <<7"6\C'F[[(F

#((FD%#>?@QRr   c                   \         P                  ! V4      p\        V4      ^ 8  d
   V^ ,          MRp\        V4      ^8  d
   VR,          MR.p. p\        V P                  RR4      RJpV\
        9   p\        V4      P                  \        4      pV'       d"   V'       d   V'       g   VP                  R4       V\        9   p	\        V4      P                  \        4      p
V	'       d*   V
'       g"   VP                  R\        P                  .4       V P                  P                  RP!                  W.V,           V,           4      4       \#        R4       R# )	     :   NNkernelNz--yes--prefixr4   zB
Note: you may need to restart the kernel to use updated packages.)r:   splitlengetattrr<   CONDA_COMMANDS_REQUIRING_YESsetintersectionCONDA_YES_FLAGSappendCONDA_COMMANDS_REQUIRING_PREFIXCONDA_ENV_FLAGSextendr
   r   r=   r>   r?   )rA   cmdrB   r   r   
extra_argsstdin_disabled	needs_yeshas_yesneeds_prefix
has_prefixs   &&&        r   _run_commandPackagingMagics._run_commandm   s    {{4  Y]$q't9q=tBxrd
 !Xt<DH;;	d)((9ig& "AAY++O<

z3::67

#((C>J#>#EFGSTr   c                >    \        R4      pV P                  W!4       R# )zYRun the conda package manager within the current kernel.

Usage:
  %conda install [pkgs]
condaNr.   r]   )rA   rB   r`   s   && r   r`   PackagingMagics.conda        +73%&r   c                >    \        R4      pV P                  W!4       R# )zYRun the mamba package manager within the current kernel.

Usage:
  %mamba install [pkgs]
r   Nra   )rA   rB   r   s   && r   r   PackagingMagics.mamba   rc   r   c                >    \        R4      pV P                  W!4       R# )z^Run the conda package manager within the current kernel.

Usage:
  %micromamba install [pkgs]

micromambaNra   )rA   rB   rg   s   && r   rg   PackagingMagics.micromamba   s     0=
*+r   c                   \         P                  p\         P                  R8X  d   RV,           R,           pM\        P                  ! V4      pV P
                  P                  RP                  VRRV.4      4       \        R4       R# )zWRun the uv package manager within the current kernel.

Usage:
  %uv pip install [pkgs]
r2   r3   r4   r5   uvr7   Nr8   r@   s   && r   rj   PackagingMagics.uv   sb     <<7"6\C'F[[(F

#((FD$#=>?QRr    N)__name__
__module____qualname____firstlineno____doc__r   r6   r]   r   r`   r   rg   rj   __static_attributes____classdictcell__)__classdict__s   @r   r0   r0   X   s     4S S U0 '  ' '  ' ,  , S Sr   r0   >   listremoveupdateinstallupgrade	uninstall>   rv   rw   rx   ry   rz   >   -n-p--namerJ   )rq   r   r    r(   r:   r
   pathlibr   IPython.core.magicr   r   r   r   r.   rS   rN   rT   rQ   r0   rl   r   r   <module>r      sp     	 	  
  ? ?'T#    5- \Sf \S \Sr   