
    si
                        S r SSKJ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  SS
KJr  SSKJr  \(       a  SSKJr  SSKJr  \" \5      r " S S\5      rg)zDefine YAML spec.    )annotationsN)	getLogger)TYPE_CHECKING   )yaml)
deprecated)CondaValueError)EnvironmentSpecBase   )env)Environment)EnvironmentYamlc                  r    \ rS rSrSrSrSS1rSS jrS r\	\
" SS	S
S9SS j5       5       r\	SS j5       rSrg)YamlFileSpec   FNz.yamlz.ymlc                    Xl         S U l        g N)filenamemsg)selfr   kwargss      9lib/python3.13/site-packages/conda/env/specs/yaml_file.py__init__YamlFileSpec.__init__#   s         c                  ^ U R                   (       d  g[        R                  R                  U R                   5      u  nm[	        U4S j[
        R                   5       5      (       d  g [        R                  " U R                   5      n[        R                  " U5      nUc  g g! [         a"    [        R                  SU R                   SS9   gf = f)a  
Validates loader can process environment definition.
This can handle if:
    * the provided file exists
    * the provided file ends in the supported file extensions (.yaml or .yml)
    * the yaml file can be loaded and is not empty

:return: True or False
Fc              3  ,   >#    U  H	  oT:H  v   M     g 7fr    ).0spec_extfile_exts     r   	<genexpr>*YamlFileSpec.can_handle.<locals>.<genexpr>8   s     P8OHx'8Os   zFailed to load %s as a YAML.T)exc_info)r   ospathsplitextanyr   
extensionsr   	load_filer   loads	Exceptionlogdebug)r   _yamlstrdatar!   s       @r   
can_handleYamlFileSpec.can_handle'   s     }} gg&&t}}58 P8O8OPPP	mmDMM2G::g&D|  	  	II4dmmdIS	s   *9B& &)CCz26.3z26.9z*This method is not used anymore, use 'env')addendumc                   U R                   (       dR  U R                  5       (       d  [        SU R                   35      e[        R
                  " U R                  5      U l         U R                   c  [        S5      eU R                   $ )Nz Cannot handle environment file: zEnvironment could not be loaded)_environmentr2   r	   r   r   	from_filer   r   s    r   environmentYamlFileSpec.environmentF   sj       ??$$%(H
&STT #dmm <D$!"CDD   r   c                    U R                   (       d%  [        R                  " U R                  5      U l         U R                   R	                  5       $ r   )r6   r   r7   r   to_environment_modelr8   s    r   r   YamlFileSpec.envR   s5       #dmm <D  5577r   )r6   r   r   r   )returnr   )r>   r   )__name__
__module____qualname____firstlineno__detection_supportedr6   r)   r   r2   propertyr   r9   r   __static_attributes__r   r   r   r   r      s^      L6"J> )UV! W ! 8 8r   r   )__doc__
__future__r   r%   loggingr   typingr   common.serializer   deprecationsr   
exceptionsr	   plugins.typesr
    r   models.environmentr   r   r?   r-   r   r   r   r   <module>rP      sG     " 	    $ & ) 0 1% =8& =8r   