
    c                     b    d Z ddlmZ ddlZddlmZmZmZ dZed         Z	 G d de          Z
dS )z+Project lock file loading and manipulation.    )absolute_importN)YamlFile_CommentedMap_block_style_all_nodes)zanaconda-project-lock.ymlzanaconda-project-lock.yamlc                   \     e Zd ZdZdZedd            Z fdZd Zd Z	d Z
d	 Zd
 Z xZS )ProjectLockFilezZRepresents the ``anaconda-project-lock.yml`` file which describes locked package versions.a  
# This is an Anaconda project lock file.
# The lock file locks down exact versions of all your dependencies.
#
# In most cases, this file is automatically maintained by the `anaconda-project` command or GUI tools.
# It's best to keep this file in revision control (such as git or svn).
# The file is in YAML format, please see http://www.yaml.org/start.html for more.
#

#
# Set to false to ignore locked versions.
#
locking_enabled: false

#
# A key goes in here for each env spec.
#
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 )a  Load the project lock file from the given directory, even if it doesn't exist.

        If the directory has no project file, the loaded
        ``ProjectLockFile`` 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

        Returns:
            a new ``ProjectLockFile``

        )
ospathrealpathdirname possible_project_lock_file_namesjoinisfiler   abspathDEFAULT_PROJECT_LOCK_FILENAME)cls	directoryscan_parentscurrent_dirnamer   s         Blib/python3.11/site-packages/anaconda_project/project_lock_file.pyload_for_directoryz"ProjectLockFile.load_for_directory,   s    ,  RW--bgook.J.JKKK 
	8 1 1w||K667>>$'' 1*4000001   goobgook.J.JKK rw||I7TUUVVV    c                 X    t          t          |                               |           dS )a&  Construct a ``ProjectLockFile`` with the given filename.

        It's easier to use ``ProjectLockFile.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)superr   __init__)selffilename	__class__s     r   r   zProjectLockFile.__init__R   s)     	ot$$--h77777r   c                     dS )NF )r   s    r   _save_default_contentz%ProjectLockFile._save_default_contentc   s    ur   c                 8    |                      d|dg|           dS )Library-internal method.	env_specsenv_spec_hashN	set_value)r   env_spec_namer'   s      r   _set_lock_set_hashz"ProjectLockFile._set_lock_set_hashg   s#    ]ODmTTTTTr   c                    |J |J |J ||v sJ |                      dgd          }|s|                     dgd           |                      dgd          }|4t                      }t          |           |                     dg|           |D ]H}||k    r	|                    |d          }|"t                      }t          |           |||<   d|d<   I|                                }|                     d|g|           dS )r%   Nlocking_enabledTr&   Flocked)	get_valuer)   r   r   getto_json)	r   r*   lock_set	all_namesfor_allnew_env_specsr   
single_envas_jsons	            r   _set_lock_setzProjectLockFile._set_lock_setk   sV   (((###$$$	))))
 .."3!4d;; 	-NN-.555 NNK=$??M = -&}555}m<<<! 	- 	-=( *..tT::
 5!.J*:666*4M$'',
8$$ ""$$]3W=====r   c                 :    |                      d|ddg|           d S )Nr&   packagespipr(   )r   r*   pip_packagess      r   _add_pip_packagesz!ProjectLockFile._add_pip_packages   s%    ]JFUUUUUr   c                     |/|                      dgd           |                     dg           dS |                      d|dgd           |                     d|dg           |                     d|dg           dS )r%   Nr-   Fr&   r.   r:   	platforms)r)   unset_value)r   r*   s     r   _disable_lockingz ProjectLockFile._disable_locking   s     	HNN-.666k]+++++NNKA5IIIk=*EFFFk=+FGGGGGr   )T)__name__
__module____qualname____doc__templateclassmethodr   r   r#   r+   r8   r=   rA   __classcell__)r    s   @r   r   r      s        ddH( #W #W #W [#WJ8 8 8 8 8"  U U U!> !> !>FV V VH H H H H H Hr   r   )rE   
__future__r   r
   anaconda_project.yaml_filer   r   r   r   r   r   r"   r   r   <module>rK      s    2 1 & & & & & & 				 V V V V V V V V V V $_   @ C DH DH DH DH DHh DH DH DH DH DHr   