Format: application/x-python-code
1 o
2
3 ��h� � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ddlm Z m
4 Z
5 mZ dd� Zdd� Z
6 h d �Zh d
7 �Zh d�Zdd
8 hZe
9 G dd� de ��ZdS )z5Implementation of packaging-related magic functions.
10 � N)�Path)�Magics�magics_class�
11 line_magicc s t �� �� fdd��}|S )Nc s( t tjdd��� s
12 td��� | i |��S )z>Return True if the current Python executable is in a conda env�
13 conda-meta�historyzbThe python kernel does not appear to be a conda environment. Please use ``%pip install`` instead.)r �sys�prefix�exists�
14 ValueError)�args�kwargs��func� �Sc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/core/magics/packaging.py�wrapper s
15 �z%is_conda_environment.<locals>.wrapper)� functools�wraps)r r r r r �is_conda_environment s
16 r c C s� d}d| � � v r
17 d}|tjv r ttj| �}|�� r t|�� �S ttj�j | }|�� r0t|�S ttj
18 dd�jdd�}tj
19 d| � d �|tjd
20 �}|rP|�� d S | S )z�Find the path to the given executable
21
22 Parameters
23 ----------
24
25 executable: string
26 Value should be: conda, mamba or micromamba
27 Z CONDA_EXE�mambaZ MAMBA_EXEr r zutf-8)�encodingz^#\s*cmd:\s*(?P<command>.*z)\s[create|install])�flags�command)�lower�os�environr �is_file�str�resolver �
28 executable�parentr � read_text�re�search� MULTILINE� groupdict)r Zbase_executabler r �matchr r r �_get_conda_like_executable$ s&