
    c                     ~    d Z ddlmZ ddlZddlmZ ddlmZ ddlm	c m
Z
 dZed         Zd Z G d d	e          ZdS )
z&Project file loading and manipulation.    )absolute_importN)YamlFileEnvSpec)zanaconda-project.ymlzanaconda-project.yamlz
kapsel.ymlzkapsel.yamlc                  (    t          dg d          fS )Ndefault )namechannelsconda_packagesr   r	       =lib/python3.11/site-packages/anaconda_project/project_file.py_empty_default_env_specr      s    RCCCFFr   c                   L     e Zd ZdZdZeedfd            Zef fd	Zd Z	 xZ
S )ProjectFilea  Represents the ``anaconda-project.yml`` file which describes the project across machines/users.

    State that's specific to a machine/user/checkout/deployment
    should instead be in ``LocalStateFile``.  ``ProjectFile``
    would normally be checked in to source control or otherwise
    act as a shared resource.

    Be careful with creating your own instance of this class,
    because you have to think about when other code might load or
    save in a way that conflicts with your loads and saves.

    a  
# This is an Anaconda project file.
#
# Here you can describe your project and how to run it.
# Use `anaconda-project run` to run the project.
# The file is in YAML format, please see http://www.yaml.org/start.html for more.
#

#
# Set the 'name' key to name your project
#
name:

#
# Set the 'icon' key to give your project an icon
#
icon:

#
# Set a one-sentence-or-so 'description' key with project details
#
description:

#
# In the commands section, list your runnable scripts, notebooks, and other code.
# Use `anaconda-project add-command` to add commands.
#
commands: {}

#
# In the variables section, list any environment variables your code depends on.
# Use `anaconda-project add-variable` to add variables.
#
variables: {}

#
# In the services section, list any services that should be
# available before your code runs.
# Use `anaconda-project add-service` to add services.
#
services: {}

#
# In the downloads section, list any URLs to download to local files
# before your code runs.
# Use `anaconda-project add-download` to add downloads.
#
downloads: {}

#
# In the packages section, list any packages that must be installed
# before your code runs.
# Use `anaconda-project add-packages` to add packages.
#
packages: []

#
# In the channels section, list any Conda channel URLs to be searched
# for packages.
#
# For example,
#
# channels:
#    - mychannel
#
channels: []

#
# In the platforms section, list platforms the project should work on
# Examples: "linux-64", "osx-64", "win-64"
# Use `anaconda-project add-platforms` to add platforms.
#
platforms: []

#
# You can define multiple, named environment specs.
# Each inherits any global packages or channels,
# but can have its own unique ones also.
# Use `anaconda-project add-env-spec` to add environment specs.
#
env_specs: {}
Tc                     |}|t           j                            t           j                            |                    k    rt          D ]R}t           j                            ||          }t           j                            |          rt          |          c S S|r=t           j                            t           j                            |                    }	 t          t           j                            |t                    |          S )a1  Load the project file from the given directory, even if it doesn't exist.

        If the directory has no project file, and the project file
        cannot be found in any parent directory, the loaded
        ``ProjectFile`` will be empty. It won't actually be
        created on disk unless you call ``save()``.

        If the file has syntax problems, this sets the
        ``corrupted`` and ``corrupted_error_message`` properties,
        and attempts to modify the file will raise an
        exception. If the project file has semantic problems, they
        are not detected by this class but are reported by the
        ``Project`` class.

        Args:
            directory (str): path to the project directory
            default_env_specs_func (function makes list of EnvSpec): if file is created, use these
            scan_parents (bool): if True search for anaconda-project.yml file in parent directories
                                 If one is found change the directory_path to its location.

        Returns:
            a new ``ProjectFile``

        )
ospathrealpathdirnamepossible_project_file_namesjoinisfiler   abspathDEFAULT_PROJECT_FILENAME)cls	directorydefault_env_specs_funcscan_parentscurrent_dirr
   r   s          r   load_for_directoryzProjectFile.load_for_directory|   s    4  RW--bgook.J.JKKK 
	3 - -w||K667>>$'' -&t,,,,,-   goobgook.J.JKK 27<<	3KLLNdeeer   c                     || _         t          j                            |          | _        t          t          |                               |           dS )a7  Construct a ``ProjectFile`` with the given filename and requirement registry.

        It's easier to use ``ProjectFile.load_for_directory()`` in most cases.

        If the file has syntax problems, this sets the
        ``corrupted`` and ``corrupted_error_message`` properties,
        and attempts to modify the file will raise an
        exception. If the project file has semantic problems, they
        are not detected by this class but are reported by the
        ``Project`` class.

        Args:
            filename (str): path to the project file
        N)_default_env_specs_funcr   r   r   project_dirsuperr   __init__)selffilenamer   	__class__s      r   r&   zProjectFile.__init__   sG     (>$7??844k4  ))(33333r   c                    t           j                            t           j                            | j                            |d<   |d                             t          j                               | j        J |                                 }|J |D ]$}|	                                |d         |j
        <   %t          |          dk    rt          t          |d                             }|d         |         }d }d|v r ||d         |d                    d|v r ||d         |d                    d|v r ||d         |d                    d S d S d S )Nr
   	platforms	env_specs   c                 D    |d d = |                     |            | d d = d S )N)extend)srcdests     r   move_list_elementsz=ProjectFile._fill_default_content.<locals>.move_list_elements   s.    GC   FFFr   packagesr   )r   r   basenamer   r(   r/   	conda_apidefault_platforms_with_currentr#   to_jsonr
   lennextiter)r'   as_jsondefault_env_specsenv_spec	spec_name	spec_jsonr2   s          r   _fill_default_contentz!ProjectFile._fill_default_content   s   '**27??4=+I+IJJ##I$L$N$NOOO+777 88:: ,,,) 	E 	EH2:2B2B2D2DGK // !!Q& 	Q T'+"67788I,Y7I   Y& O""9Z#8'*:MNNNY& O""9Z#8'*:MNNNi' Q""9[#97;;OPPPPP#	Q 	Q Q Qr   )__name__
__module____qualname____doc__templateclassmethodr   r!   r&   r@   __classcell__)r)   s   @r   r   r      s         QHf BYhl 'f 'f 'f ['fR 9P 4 4 4 4 4 4&Q Q Q Q Q Q Qr   r   )rD   
__future__r   r   anaconda_project.yaml_filer   anaconda_project.env_specr   #anaconda_project.internal.conda_apiinternalr5   r   r   r   r   r	   r   r   <module>rM      s    - , & & & & & & 				 / / / / / / - - - - - - 7 7 7 7 7 7 7 7 7 m 6q9 G G GyQ yQ yQ yQ yQ( yQ yQ yQ yQ yQr   