
    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  \(       a  SSKJr  \" \5      r " S S\5      rg)z$Define cep-0024 compliant YAML spec.    )annotationsN)	getLogger)TYPE_CHECKING   )yaml)
CondaError)EnvironmentSpecBase   )env)Environmentc                  H    \ rS rSrSrSS1rS	S
S jjrS r\SS j5       r	Sr
g)Cep24YamlFileSpec   Nz.yamlz.ymlc                    Xl         g N)filename)selfr   kwargss      6lib/python3.13/site-packages/conda/env/specs/cep_24.py__init__Cep24YamlFileSpec.__init__   s         c                   U R                   (       d  g[        R                  R                  U R                   5      u  pUR	                  5       U R
                  ;  a  g [        R                  " U R                   5      n[        R                  " U5      n[        R                  " U5      nU(       a  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 provided file is compliant with the CEP-0024

:return: True or False
FTzFailed to load %s as a YAML.)exc_info)r   ospathsplitextlower
extensionsr   	load_filer   loadsget_schema_errorsr   logdebug)r   _file_extyamlstrdataerrorss         r   
can_handleCep24YamlFileSpec.can_handle   s     }} gg&&t}}5 >>4??2		mmDMM2G::g&D**40F 	II4dmmdIS	s   AB3 3)CCc                    U R                   (       d%  [        R                  " U R                  5      U l         U R                   R	                  5       $ r   )_environmentr   	from_filer   to_environment_model)r   s    r   r   Cep24YamlFileSpec.env=   s5       #dmm <D  5577r   )r-   r   r   )r   z
str | None)returnr   )__name__
__module____qualname____firstlineno__r-   r   r   r*   propertyr   __static_attributes__ r   r   r   r      s/    L6"J!> 8 8r   r   )__doc__
__future__r   r   loggingr   typingr   common.serializer   
exceptionsr   plugins.typesr	    r   models.environmentr   r2   r#   r   r8   r   r   <module>rB      sA    + " 	    $ $ 0 1 *8+ *8r   