
    .Ph                     R   d dl Z d dlZd dlZd dlmZmZ d dlZd dlmZm	Z	 d dl
mZ d dlmZ d dlmZ ddlmZ  ej        d	          Z ej        d
          Zdedeeef         fdZdededededee         f
dZde j        dee         fdZde j        dee         dede	fdZdS )    N)ListTuple)
DependencyLockSpecification)conda_spec_to_versioned_dep)evaluate_marker)filter_platform_selectors   )parse_python_requirementz\s+z-^(?P<name>[A-Za-z0-9_-]+)\s?(?P<version>.*)?$reqreturnc                     t                               |           }|rC|                    d          t                              d|                    d                    fS t          d|  d          )Nname versionzCan't parse conda spec from '')_conda_package_patternmatchgroup_whitespacesub
ValueError)r   r   s     f/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/conda_lock/src_parser/environment_yaml.pyparse_conda_requirementr      si    "((--E A{{6""KOOBI8N8N$O$OOO????@@@    contentcategoryplatformmapping_urlc                |   d                     t          | |                    }t          j        |          }|d         }d |D             }d |D             }g }|D ]%}	|                    t          |	|                     &|D ]}
|
                    d          }||D ]t}	t          j        d|	          r t          d	|	 d
t          j                   7t          |	d||          }t          |j        |          r|                    |           u|                    t          dd|                     |S )a  
    Parse dependencies from a conda environment specification for an
    assumed target platform.

    Parameters
    ----------
    environment_file :
        Path to environment.yml
    platform :
        Target platform to use when parsing selectors to filter lines
    
)r   dependenciesc                 <    g | ]}t          |t                    |S  
isinstancestr.0xs     r   
<listcomp>z8_parse_environment_file_for_platform.<locals>.<listcomp>4   s'    @@@1Z3-?-?@Q@@@r   c                 <    g | ]}t          |t                    |S r$   r%   r(   s     r   r+   z8_parse_environment_file_for_platform.<locals>.<listcomp>5   s'    4441As!3!34Q444r   pipNz^-e .*$zWarning: editable pip dep 'zP' will not be included in the lock file. You will need to install it separately.)file)managerr   r   conda)r/   r   )joinr	   yaml	safe_loadappendr   getrer   printsysstderrr   r   markers)r   r   r   r   filtered_contentenv_yaml_dataspecsmapping_specsr"   specmapping_specr-   
dependencys                r   $_parse_environment_file_for_platformrB      s   $ yy!:7X!V!V!VWWN#344M.)E A@@@@M44444E%'L I I7hGGHHHH% 
 
u%%; 	0 	0Dx
D)) Bd B B B     1!'	  J z18<< 0 ##J/// 	$UGUUU	
 	
 	
 	
 r   environment_filec                 $   |                                  st          |  d          |                     d          5 }|                                }t	          j        |          }ddd           n# 1 swxY w Y   |                    dg           S )zC
    Parse the list of platforms from an environment-yaml file
    
 not foundrN	platforms)existsFileNotFoundErroropenreadr2   r3   r5   )rC   for   r<   s       r   parse_platforms_from_env_filerM   _   s     ""$$ A#3 ? ? ?@@@			s	#	# 0r''))w//0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ["---s   )A11A58A5rG   c                   	 |                                  st          |  d          |                     d          5 }|                                	ddd           n# 1 swxY w Y   t	          j        	          }|                    dg           }	 |                    d           n# t          $ r Y nw xY w|                    dg           }|                    d          pd	fd	|D             }t          |||| g
          S )aS  Parse a simple environment-yaml file for dependencies assuming the target platforms.

    * This will emit one dependency set per target platform. These may differ
      if the dependencies depend on platform selectors.
    * This does not support multi-output files and will ignore all lines with
      selectors other than platform.
    rE   rF   Nchannels
nodefaultszpip-repositoriesr   mainc           	      8    i | ]}|t          |           S ))r   r   r   )rB   )r)   r   r   r   r   s     r   
<dictcomp>z*parse_environment_file.<locals>.<dictcomp>   sF         	6h{
 
 
  r   )r"   rO   pip_repositoriessources)
rH   rI   rJ   rK   r2   r3   r5   remover   r   )
rC   rG   r   rL   r<   rO   rT   dep_mapr   r   s
     `     @@r   parse_environment_filerX   m   s    ""$$ A#3 ? ? ?@@@			s	#	# r''))               N7++M'++J;;H%%%%    #0"3"34F"K"K "%%j11;VH      "	  G )!"	   s#   A  A$'A$B, ,
B98B9)pathlibr6   r8   typingr   r   r2   conda_lock.models.lock_specr   r   "conda_lock.src_parser.conda_commonr   conda_lock.src_parser.markersr   conda_lock.src_parser.selectorsr	   pyproject_tomlr   compiler   r   r'   r   rB   PathrM   rX   r$   r   r   <module>rb      s    				 



          E E E E E E E E J J J J J J 9 9 9 9 9 9 E E E E E E 4 4 4 4 4 4 bj  #$TUU A AsCx A A A A?? ? 	?
 ? 
*? ? ? ?D.GL .T#Y . . . .,l,Cy, , 	, , , , , ,r   