ó
¼S]c           @@  ss  d  Z  d d l m Z d d l Z d d l m Z m Z d d l Z d d l m Z d d l	 m
 Z
 m Z m Z m Z d d l m Z d d l m Z d d	 l m Z m Z d d
 l m Z d d l m 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# d d l$ m% Z% d d l& m' Z' m( Z( m) Z) d d l* m+ Z+ m, Z, m- Z- d d l. m/ Z/ d d l0 m1 Z1 d d l2 j3 j4 Z4 d d l5 j3 j6 Z6 d d l7 j3 j8 Z8 d d l9 m: Z; d Z< d Z= d Z> d Z? d Z@ e< e= e> e? e@ f ZA d eB f d „  ƒ  YZC d „  ZD eE eE d „ ZF d  „  ZG d! „  ZH d" eB f d# „  ƒ  YZI d$ eB f d% „  ƒ  YZJ d S(&   s/   Project class representing a project directory.i    (   t   absolute_importN(   t   deepcopyt   copy(   t   join(   t   EnvSpect   _anaconda_default_env_spect   _find_importable_spect!   _find_out_of_sync_importable_spec(   t   RequirementsRegistry(   t   EnvVarRequirement(   t   CondaEnvRequirementt   CondaBootstrapEnvRequirement(   t   DownloadRequirement(   t   ServiceRequirement(   t   ProjectCommandt   all_known_command_attributes(   t   ProjectFile(   t   ProjectLockFile(   t0   _list_relative_paths_for_unignored_project_files(   t   version(   t   CondaLockSet(   t   _null_frontendt   _new_error_recordert   Frontend(   t	   is_stringt   is_listt   is_dict(   t   SimpleStatus(   t   slugify(   t   pluginst   conda_app_entryt   unixt   windowst   notebookt	   bokeh_appt   ProjectProblemc           B@  sM   e  Z d  Z d d d d e d d d „ Z e d „  ƒ Z d „  Z d „  Z	 RS(   s.   A possibly-autofixable problem with a project.c	   	      C@  sƒ   | |  _  | d k r! | |  _ n d t j j | ƒ | f |  _ | |  _ | |  _ | |  _ | |  _	 | |  _
 | |  _ | |  _ d S(   s   Create a project problem.s   %s: %sN(   t   text_without_filenamet   Nonet   textt   ost   patht   basenamet
   fix_promptt   fix_functiont   no_fix_functiont   only_a_suggestiont   maybe_filenamet   maybe_line_numbert   maybe_column_number(	   t   selfR&   t   filenameR*   R+   R,   R-   t   line_numbert   column_number(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   __init__7   s    
							c         C@  s   |  j  d k	 S(   s&   True if the problem can be auto-fixed.N(   R+   R%   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   can_fixN   s    c         C@  s$   |  j  d k	 r |  j  | ƒ Sd Sd S(   s   Perform the auto-fix.N(   R+   R%   (   R1   t   project(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   fixS   s    c         C@  s$   |  j  d k	 r |  j  | ƒ Sd Sd S(   s&   Take an action on deciding not to fix.N(   R,   R%   (   R1   R7   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   no_fixZ   s    N(
   t   __name__t
   __module__t   __doc__R%   t   FalseR5   t   propertyR6   R8   R9   (    (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR#   4   s   	c         C@  sP   g  } xC |  D]; } t  | t ƒ r2 | j | ƒ q | j t d | ƒ ƒ q W| S(   NR&   (   t
   isinstanceR#   t   append(   t   problemst   new_problemst   p(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _make_problems_into_objectsd   s    c      
   C@  s/   |  j  t d | d | j d | d | ƒ ƒ d  S(   NR&   R2   R*   R+   (   R@   R#   R2   (   RA   t	   yaml_fileR&   R*   R+   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _file_problemn   s    c      	   C@  sS   xL | j  ƒ  D]> } | | k r | j t d d | d |  j d t ƒ ƒ q q Wd  S(   NR&   s   Unknown field name '%s'R2   R-   (   t   keysR@   R#   R2   t   True(   t   project_fileRA   t	   yaml_dictt   known_fieldst   key(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _unknown_field_suggestionss   s
    c         C@  s5   x. |  D]& } t  | t ƒ s  t S| j s t Sq Wt S(   N(   R?   R#   RH   R-   R=   (   RA   RC   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _fatal_problem{   s    	t   _ConfigCachec           B@  sà   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C@  s¬   | |  _  | d  k r! t ƒ  } n  | |  _ d  |  _ d |  _ d  |  _ t ƒ  |  _ d  |  _	 d |  _
 d |  _ t ƒ  |  _ t ƒ  |  _ t |  _ d  |  _ d  |  _ | |  _ d  S(   Nt    i    (   t   directory_pathR%   R   t   registryt   namet   descriptiont   icont   dictt   commandst   default_command_namet   project_file_countt   lock_file_countt	   env_specst	   lock_setsR=   t   locking_globally_enabledt   default_env_spec_namet   global_base_env_spect
   must_exist(   R1   RQ   RR   R`   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR5   ‡   s"    											c         @  sÍ  | j  ˆ  j k r( | j  ˆ  j k r( d  S| j  ˆ  _ | j  ˆ  _ t ƒ  } g  } ‡  f d †  } t j j ˆ  j ƒ } | s | j d ˆ  j ƒ n^ ˆ  j	 rî t j j
 | j ƒ rî | j t d d t j j | j ƒ d d | j d | ƒ ƒ n  | j r2| j t d d | j d	 | j d
 | j d | j ƒ ƒ n  | j rv| j t d d | j d	 | j d
 | j d | j ƒ ƒ n  | r€| j p‹| j r€t | | | j d ƒ t | | | j d ƒ ˆ  j | | ƒ ˆ  j | | ƒ ˆ  j | | ƒ ˆ  j | | ƒ ˆ  j | | | ƒ ˆ  j | | | ƒ ˆ  j | | | ƒ ˆ  j | | | ƒ ˆ  j | | | ƒ ˆ  j | | | ƒ ˆ  j | | ƒ n  | ˆ  _ t  | ƒ ˆ  _! t" g  ˆ  j! D] } | j# s¥| j$ ^ q¥ƒ ˆ  _% d  S(   Nc         @  s   t  ˆ  _ d  S(   N(   R=   R`   (   R7   (   R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   accept_project_creation¦   s    s&   Project directory '%s' does not exist.R&   s!   Project file '%s' does not exist.R*   s   Create file '%s'?R+   s   Syntax error: %sR2   R3   R4   RS   RT   RU   t	   variablest	   downloadst   servicesR[   RW   t   packagest   dependenciest   channelst	   platformst   skip_importst   locking_enabled(   RS   RT   RU   Rb   Rc   Rd   R[   RW   Re   Rf   Rg   Rh   Ri   (   R[   Rj   (&   t   change_countRY   RZ   RV   R'   R(   t   isdirRQ   R@   R`   t   isfileR2   R#   R)   t	   corruptedt   corrupted_error_messaget   corrupted_maybe_linet   corrupted_maybe_columnRM   t   roott   _update_namet   _update_descriptiont   _update_icont   _update_lock_setst   _update_env_specst   _update_variablest   _update_downloadst   _update_servicest   _update_conda_env_requirementst   _update_commandst   _verify_command_dependenciest   requirementsRD   RA   t   listR-   R&   t   problem_strings(   R1   RI   t	   lock_fileR~   RA   Ra   t   project_existsRC   (    (   R1   s7   lib/python2.7/site-packages/anaconda_project/project.pyt   update›   sf    							 	c      
   @  s  t  j j |  j ƒ ‰  d | j k re ‡  f d †  } | j t d d d | j d d ˆ  d | ƒ ƒ n  | j d d  ƒ } | d  k	 rà t
 | ƒ s¬ t | | d	 | ƒ d  } qà t | j ƒ  ƒ d
 k rà t | | d ƒ d  } qà n  | d  k rõ ˆ  } n  | |  _ d  S(   NRS   c         @  s   |  j  j d ˆ  ƒ d  S(   NRS   (   RI   t	   set_value(   R7   (   t   default_name(    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   set_name_fieldé   s    R&   s   The 'name:' field is missing.R2   R*   s   Name the project '%s'?R+   s-   name: field should have a string value not %ri    s1   name: field is an empty or all-whitespace string.(   R'   R(   R)   RQ   Rr   R@   R#   R2   t	   get_valueR%   R   RF   t   lent   stripRS   (   R1   RA   RI   R†   RS   (    (   R…   s7   lib/python2.7/site-packages/anaconda_project/project.pyRs   â   s(    	
		c         C@  sj   | j  d d  ƒ } | d  k	 rH t | ƒ rH t | | d | ƒ d  } n  | d  k r] d } n  | |  _ d  S(   NRT   s4   description: field should have a string value not %rRP   (   R‡   R%   R   RF   RT   (   R1   RA   RI   t   desc(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRt     s    		c         C@  s¨   | j  d d  ƒ } | d  k	 rH t | ƒ rH t | | d | ƒ d  } n  | d  k	 r› t j j |  j | ƒ } t j j | ƒ s› | j	 d | ƒ d  } q› n  | |  _
 d  S(   NRU   s-   icon: field should have a string value not %rs   Icon file %s does not exist.(   R‡   R%   R   RF   R'   R(   R   RQ   Rm   R@   RU   (   R1   RA   RI   RU   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRu     s    	c         C@  s7   | j  | k r g  | | j  <n  | | j  j | ƒ d  S(   N(   RS   R@   (   R1   R~   t   env_spect   requirement(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _add_requirement  s    c   	      C@  sz   | j  | ƒ } | | | | |  j | ƒ xK |  j j ƒ  D]: } | j  d | j | g d  ƒ } | | | | | | ƒ q8 Wd  S(   NR[   (   R‡   R_   R[   t   valuesRS   R%   (	   R1   R~   RA   RI   t	   dict_namet   updatert   global_dictR‹   t   env_dict(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _update_requirements#  s
    c         C@  s    |  j  | | | d |  j ƒ d  S(   NRb   (   R“   t   _update_variables_for_env_spec(   R1   R~   RA   RI   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRx   *  s    c         C@  s    |  j  | | | d |  j ƒ d  S(   NRc   (   R“   t   _update_downloads_for_env_spec(   R1   R~   RA   RI   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRy   .  s    c         C@  s    |  j  | | | d |  j ƒ d  S(   NRd   (   R“   t   _update_services_for_env_spec(   R1   R~   RA   RI   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRz   2  s    c         @  s  ‡  ‡ f d †  } | d  k r! nßt | ƒ r(xÐ| j ƒ  D]ç } | | ƒ rR q: n  | j ƒ  d k rƒ t ˆ  ˆ d j | ƒ ƒ q: n  | | } | d  k r¢ i  }	 n* t | ƒ r½ t | ƒ }	 n t d | ƒ }	 t |	 t ƒ sá t	 ‚ t
 j |	 | ˆ  ƒ r: |  j j | |	 ƒ }
 |  j | | |
 ƒ q: q: WnØ t | ƒ räxÉ | D]¢ } t | ƒ rÁ| j ƒ  d k r~t ˆ  ˆ d j | ƒ ƒ q;n  | | ƒ rq;n  |  j j | d t ƒ  ƒ}
 |  j | | |
 ƒ q;t ˆ  ˆ d j d | ƒ ƒ q;Wn t ˆ  ˆ d j d	 | ƒ ƒ d  S(
   Nc         @  s0   |  d k r( t  ˆ  ˆ d d |  ƒ t St Sd  S(   Nt   CONDA_DEFAULT_ENVt   CONDA_ENV_PATHt   CONDA_PREFIXs5   Environment variable %s is reserved for Conda's use, s,   so it can't appear in the variables section.(   R—   R˜   R™   (   RF   RH   R=   (   RL   (   RA   RI   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   check_conda_reserved6  s
    RP   s9   Variable name cannot be empty string, found: '{}' as namet   defaultt   optionssS   variables section should contain environment variable names, {item} is not a stringt   items[   variables section contains wrong value type {value}, should be dict or list of requirementst   value(   R%   R   RG   R‰   RF   t   formatR   RV   R?   t   AssertionErrorR	   t   _parse_defaultRR   t   find_requirement_by_env_varR   R   R   (   R1   R~   RA   RI   R‹   Rb   Rš   RL   t   raw_optionsRœ   RŒ   R   (    (   RA   RI   s7   lib/python2.7/site-packages/anaconda_project/project.pyR”   5  sP    	
				c   
      C@  sÝ   | d  k r d  St | ƒ s? t | | d j t | ƒ ƒ ƒ d  Sx— | j ƒ  D]‰ \ } } | j ƒ  d k r‰ t | | d j | ƒ ƒ qL n  t j | | | ƒ } | d  k r° qL n  t |  j	 |  }	 |  j
 | | |	 ƒ qL Wd  S(   Ns5   'downloads:' section should be a dictionary, found {}RP   s9   Download name cannot be empty string, found: '{}' as name(   R%   R   RF   RŸ   t   reprt   itemsR‰   R   t   _parseRR   R   (
   R1   R~   RA   RI   R‹   Rc   t   varnameR   t   download_kwargsRŒ   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR•   q  s     	c         C@  sF  | d  k r d  St | ƒ sC t | | d d j t | ƒ ƒ ƒ d  Sxü | j ƒ  D]î \ } } | j ƒ  d k r t | | d j | ƒ ƒ qP n  t j | | | ƒ } | d  k r´ qP n  | d }	 |  j	 j
 |   sï | j d j | |	 ƒ ƒ qP n  |  j	 j |   }
 t |
 t ƒ st ‚ d |
 j k s+t ‚ |  j | | |
 ƒ qP Wd  S(   NsH   'services:' section should be a dictionary from environment variable to s   service type, found {}RP   s8   Service name cannot be empty string, found: '{}' as namet   service_types$   Service {} has an unknown type '{}'.t   type(   R%   R   RF   RŸ   R¤   R¥   R‰   R   R¦   RR   t$   can_find_requirement_by_service_typeR@   t    find_requirement_by_service_typeR?   R    Rœ   R   (   R1   R~   RA   RI   R‹   Rd   R§   R   t   service_kwargsR©   RŒ   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR–   †  s.    		
c         C@  sÇ   | j  | g  ƒ } t | ƒ sE t | | d | | | f ƒ g  g  f Sg  } g  }	 xi | D]a }
 t |
 ƒ r€ | j |
 j ƒ  ƒ qX | |
 ƒ rœ |	 j |
 ƒ qX t | | d | | |
 f ƒ qX W| |	 f S(   Ns+   %s: value should be a list of %ss, not '%r's/   %s: value should be a %s (as a string) not '%r'(   t   getR   RF   R   R@   R‰   (   R1   RA   RE   t   parent_dictRL   t   whatt   special_filterR¥   t   cleanedt   specialR   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _parse_string_list_with_special¤  s    
	c         C@  s&   |  j  | | | | | d d „  ƒd S(   NR±   c         S@  s   t  S(   N(   R=   (   t   x(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   <lambda>·  RP   i    (   R´   (   R1   RA   RE   R¯   RL   R°   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _parse_string_listµ  s    c   	   	   C@  s–   |  j  | | | d d ƒ } t j | ƒ \ } } } x7 | D]/ } | j t d d | d | j d t ƒ ƒ q: Wx" | D] } t | | d | ƒ qt W| S(   NRh   s   platform nameR&   sX   Unusual platform name '%s' may be a typo (more usual examples: linux-64, osx-64, win-64)R2   R-   sH   Platform name '%s' is invalid (valid examples: linux-64, osx-64, win-64)(   R·   t	   conda_apit   validate_platform_listR@   R#   R2   RH   RF   (	   R1   RA   RE   R¯   Rh   t   unknownt   invalidt   ut   i(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _parse_platforms¹  s    
		c         C@  sö   |  j  | | | | d d „  ƒ \ } } x@ | D]8 } t j | ƒ } | d  k r. t | | d | ƒ q. q. Wg  }	 x6 | D]. }
 |  j | | |
 d d ƒ } |	 j | ƒ qw Wx@ |	 D]8 } t j | ƒ } | d  k r° t | | d | ƒ q° q° W| |	 f S(   Ns   package namec         S@  s   t  |  ƒ o d |  k S(   Nt   pip(   R   (   Rµ   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR¶   Ê  RP   s!   invalid package specification: %sR¿   s   pip package names!   invalid pip package specifier: %s(   R´   R¸   t
   parse_specR%   RF   R·   t   extendt   pip_api(   R1   RA   RE   RL   R¯   t   depst	   pip_dictst   dept   parsedt   pip_depst   pip_dictt   pip_list(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _parse_packagesÈ  s    c      
   C@  s¾  t  ƒ  |  _ t |  _ | j d g t ƒ } t | t ƒ sP t | | d | ƒ n	 | |  _ | j d g i  ƒ } t	 | ƒ s¡ t | | d d j
 t | ƒ ƒ ƒ d  Sx| j ƒ  D]\ } } t	 | ƒ sæ t | | d | | f ƒ q® n  t | | | d ƒ | j d
 |  j ƒ } t | t ƒ s=t | | d | | f ƒ q® n  | j d d  ƒ } | d  k	 rˆt | ƒ rˆt | | d | | f ƒ q® n  |  j | | | ƒ } t  ƒ  }	 | j d i  ƒ }
 t	 |
 ƒ sät | | d | |
 f ƒ q® n  xž |
 j ƒ  D] } t | ƒ } |  j | | | |
 ƒ \ } } t | ƒ | k r9qñn  t | ƒ d k rw| j t d d | d | j d t ƒ ƒ n  | |	 | <qñWt d |	 d	 | d | ƒ } | | _ | |  j | <q® Wd  S(   NRj   s;   Value for locking_enabled should be true or false, found %rR[   s>   'env_specs:' section in lock file should be a dictionary from s,   env spec names to lock information, found {}sE   Field '%s' in env_specs in lock file should be a dictionary, found %rRe   Rf   Rh   t   lockedt   env_spec_hashsD   Value for locked for env spec '%s' should be true or false, found %rsF   Value for env_spec_hash for env spec '%s' should be a string, found %rsR   'packages:' section in env spec '%s' in lock file should be a dictionary, found %ri    R&   sF   env spec '%s': pip dependencies are currently ignored in the lock fileR2   R-   t   package_specs_by_platformt   enabled(   Re   Rf   Rh   RË   RÌ   (   RV   R\   R=   R]   R‡   RH   R?   t   boolRF   R   RŸ   R¤   R¥   RM   R®   R%   R   R¾   RG   Rˆ   RÊ   R@   R#   R2   R   RÌ   (   R1   RA   R   RÎ   R\   RS   t   lock_setRÌ   Rh   t   conda_packages_by_platformt   packages_by_platformt   platformt   previous_problem_countRÃ   RÇ   t   lock_set_object(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRv   Ý  sn    				
		c   /      @  sü	  ‡ ‡ ‡ f d †  ‰  ‡  f d †  } ‡ ‡ ‡ f d †  } ‡ ‡ ‡ f d †  } | ˆ j  ƒ \ } } | ˆ j  ƒ }	 | ˆ j  ƒ }
 ˆ j d d d  ƒ} d  } t } t } t d d  d | d	 | d
 |	 d |
 d d d dA d dB ƒ ˆ _ t ƒ  ‰ | d  k rt } n7t | ƒ r%t	 | ƒ d k r)t } n  x| j
 ƒ  D]è\ } } | j ƒ  d k rst ˆ ˆ d j | ƒ ƒ q6n  | j d d  ƒ } | d  k	 r½t | ƒ r½t ˆ ˆ d j | ƒ ƒ q6n  t	 ˆ ƒ } | j d d  ƒ } | d  k rðg  } n0 t | ƒ r| j ƒ  g } n ˆ  | d d ƒ } t	 ˆ ƒ | k r8q6n  | | ƒ \ } } | | ƒ } | | ƒ } ˆ j j | d  ƒ } | d  k r­t d t ƒ  d g  d ˆ j d t ƒ } n  t d | d | d	 | d
 | d | d | d t | ƒ d dC d | ƒ 	ˆ | <| d  k r| } n  t ˆ ˆ | dD ƒ q6Wn t ˆ ˆ d | ƒ t ƒ  ˆ _ ‡ ‡ ‡ ‡ ‡ f d †  ‰ x6 ˆ j ƒ  D]( } ˆ | g  ƒ | ˆ j k smt ‚ qmWg  } d } xd ˆ j j ƒ  D]S } | j j rÔ| d  7} n  | j j rµt	 | j ƒ d k rµ| j | j ƒ qµqµW| d k rÓt j ƒ  ‰ t	 | ƒ } | | k rw‡ f d! †  } t ˆ ˆ d" d# d$ d% j  ˆ ƒ d& | ƒqÓxY t! | ƒ D]H } ‡ f d' †  } t ˆ ˆ d( | d# d$ d% j  ˆ ƒ d& | | ƒ ƒq„Wn  xŽˆ j j ƒ  D]}} | j j" rûqãn  | j j# }  |  d  k	 rc|  | j$ k rcd) | j |  | j$ f }! ˆ j t% d* |! d+ | j& d, t ƒ ƒ n  | j | j j k rt	 | j j ƒ d k r²d- | j d. j  | j ƒ f }! n5 d/ d0 | j d. j  | j ƒ d. j  | j j ƒ f }! ˆ j t% d* |! d+ | j& d, t ƒ ƒ n  t	 | j' ƒ d k rãx9| j j D](}" | j j( |" ƒ }# t	 |# ƒ d k r–d1 | j |" f }! ˆ j t% d* |! d+ | j& d, t ƒ ƒ q1t) ƒ  }$ x< |# D]4 }% t j* |% ƒ }& |& d  k	 r¦|$ j+ |& j ƒ q¦q¦W| j, |$ }' t	 |' ƒ d k r1d2 t	 |' ƒ | j |" d. j  t! t- |' ƒ ƒ ƒ f }! ˆ j t% d* |! d+ | j& d, t ƒ ƒ q1q1WqãqãWxa ˆ j j ƒ  D]P } | ˆ j k rtd3 | ˆ j. f }! ˆ j t% d* |! d+ | j& d, t ƒ ƒ qtqtWt/ ˆ j j ƒ  ˆ j0 ƒ \ ‰ }( ˆ d  k	 r%ˆ j d4 d5 g ƒ }) |) ˆ j$ k r%d  ‰ q%n  ˆ d  k	 rIˆ j j ˆ j ƒ }* n  ˆ d  k	 ry|* d  k	 ryˆ j1 |* ƒ ryd  ‰ n  ˆ d  k	 rh	|* d  k rÛd6 ˆ j |( t2 j3 j. ˆ j& ƒ f }! d7 ˆ j t2 j3 j. ˆ j& ƒ f }+ nD d8 ˆ j |( t2 j3 j. ˆ j& ƒ ˆ j4 |* ƒ f }! d9 ˆ j |( f }+ ‡ f d: †  }, ‡ f d; †  }- ˆ j t% d* |! d# |+ d& |, d< |- ƒ ƒ nl | st	| rÔ	‡ f d= †  }. ˆ j t% d* d> | rž	d n d? d+ ˆ j& d# d@ t2 j3 j. ˆ j& ƒ d& |. ƒ ƒ n  d ˆ j k rï	d ˆ _5 n	 | ˆ _5 d  S(E   Nc         @  s   ˆ j  ˆ  ˆ |  | | ƒ S(   N(   R·   (   R¯   RL   R°   (   RA   RI   R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR·   ,  s    c         @  s   ˆ  |  d d ƒ S(   NRg   s   channel name(    (   R¯   (   R·   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _parse_channels/  s    c         @  s   ˆ j  ˆ  ˆ |  ƒ S(   N(   R¾   (   R¯   (   RA   RI   R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR¾   2  s    c         @  s   ˆ j  ˆ  ˆ d |  ƒ S(   NRe   (   RÊ   (   R¯   (   RA   RI   R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRÊ   5  s    R[   R›   RS   t   conda_packagest   pip_packagesRg   Rh   RT   s   Global packages and channelst   inherit_from_namest   inherit_fromi    RP   sA   Environment spec name cannot be empty string, found: '{}' as names6   'description' field of environment {} must be a strings   env spec nameRÍ   RÎ   t   missingRÐ   Re   Rf   Rb   Rd   Rc   sX   env_specs should be a dictionary from environment name to environment attributes, not %rc         @  s:  |  ˆ  k s t  ‚ |  ˆ j k r/t } |  | k rd t ˆ ˆ d j d j t | ƒ ƒ ƒ ƒ t } n  | j |  ƒ ˆ  |  } | sö | d } xh | D]] } | ˆ  k rË t ˆ ˆ d d j | | d ƒ ƒ q’ ˆ | | ƒ } | d | f | d <q’ Wn  | d d k rˆ j	 f | d <n  t
 |   ˆ j |  <n  ˆ j |  S(	   NsK   'inherit_from' fields create circular inheritance among these env specs: {}s   , RÙ   s@   name '{}' in 'inherit_from' field of env spec {} does not match s   the name of another env specRS   RÚ   (    (   R    R[   R=   RF   RŸ   R   t   sortedRH   R@   R_   R   (   RS   t   trailt	   was_cyclet   attrsRÙ   t   parentRÚ   (   t   env_spec_attrst   make_env_specRA   RI   R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRâ   Ž  s.    		

	i   c         @  s   |  j  j d g ˆ  ƒ d  S(   NRh   (   RI   R„   (   R7   (   t   default_platforms(    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   set_global_default_platformsË  s    sB   The 'platforms:' field should list platforms the project supports.R*   s   Set platforms to '%s'?s   , R+   c         @  s   ‡ ‡  f d †  } | S(   Nc         @  s    |  j  j d ˆ d g ˆ  ƒ d  S(   NR[   Rh   (   RI   R„   (   R7   (   Rã   RÛ   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   set_env_spec_platformsØ  s    (    (   RÛ   Rå   (   Rã   (   RÛ   s7   lib/python2.7/site-packages/anaconda_project/project.pyt   make_fix×  s    s=   Env spec %s does not have anything in its 'platforms:' field.sh   Env spec '%s' has changed since the lock file was last updated (env spec hash has changed from %s to %s)R&   R2   R-   sR   Env spec '%s' specifies platforms '%s' but the lock file lists no platforms for itt   ,s=   Env spec '%s' specifies platforms '%s' but the lock file has s"   locked versions for platforms '%s's<   Lock file lists no packages for env spec '%s' on platform %ss;   Lock file is missing %s packages for env spec %s on %s (%s)s0   Lock file lists env spec '%s' which is not in %sRi   t   environments+   Environment spec '%s' from %s is not in %s.s   Add env spec %s to %s?s>   Environment spec '%s' from %s is out of sync with %s. Diff:
%ss/   Overwrite env spec %s with the changes from %s?c         @  s&   |  j  j d ˆ  j g ˆ  j ƒ  ƒ d  S(   NR[   (   RI   R„   RS   t   to_json(   R7   (   t   importable_spec(    s7   lib/python2.7/site-packages/anaconda_project/project.pyt"   overwrite_env_spec_from_importable<  s    c         @  s    |  j  j d d g ˆ  j ƒ d  S(   NRi   Rè   (   RI   R„   t   logical_hash(   R7   (   Rê   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   remember_no_import_importable?  s    R,   c         @  s5   t  ˆ  j ƒ } |  j j d | j g | j ƒ  ƒ d  S(   NR[   (   R   R_   RI   R„   RS   Ré   (   R7   t   default_spec(   R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   add_default_env_specQ  s    s   The env_specs section is %s.t   emptys   Add an environment spec to %s?(    (    (    (	   Re   Rf   Rg   Rh   RT   RÚ   Rb   Rd   Rc   (6   Rr   R‡   R%   R=   R   R_   RV   RH   R   Rˆ   R¥   R‰   RF   RŸ   R®   R   R\   R   R]   t   tupleRM   R[   RG   R    RŽ   RÐ   RÎ   Rh   R@   RS   R¸   t   default_platforms_with_currentR   RÜ   t   disabledRÌ   Rì   R#   R2   R×   t   package_specs_for_platformt   setRÀ   t   addt   conda_package_names_setR   R)   R   RQ   t#   diff_only_removes_notebook_or_bokehR'   R(   t	   diff_fromR^   (/   R1   RA   RI   R   RÖ   R¾   RÊ   t   shared_depst   shared_pip_depst   shared_channelst   shared_platformsR[   t   first_env_spec_namet   env_specs_is_emptyt   env_specs_is_missingRS   Rß   RT   t   problem_countRÙ   RÃ   RÇ   Rg   Rh   RÐ   t   missing_platformst   locked_specs_countR‹   t   missing_platform_countRä   RÛ   Ræ   t   locked_hashR&   RÓ   R×   t   lock_set_namest   packageRÆ   t   unlocked_namest   importable_filenamet   skip_spec_importt   oldt   promptRë   Rí   Rï   (    (   R·   Rã   Rá   Rê   Râ   RA   RI   R1   s7   lib/python2.7/site-packages/anaconda_project/project.pyRw   +  sn   									 &!

	((	
(	1-,	%	c         C@  s…   t  | ƒ r d  S|  j ƒ  rP t d |  j d |  j ƒ } |  j | |  j | ƒ n  t d |  j d |  j ƒ } |  j | |  j | ƒ d  S(   NRR   R[   (   RN   t   has_bootstrap_env_specR   RR   R[   R   R_   R
   (   R1   R~   RA   RI   RŒ   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR{   c  s    c      
   C@  s¡  t  } d  } t ƒ  } | j d d  ƒ } t j d ƒ } t t | j ƒ  ƒ }	 | d  k	 r‚ t	 | ƒ r‚ t
 | | d | ƒ t } nº| d  k	 r<x«| j ƒ  D]š\ }
 } |
 j ƒ  d k rÞ t
 | | d j |
 ƒ ƒ t } q› n  | d  k ró |
 } n  t	 | ƒ s%t
 | | d |
 | f ƒ t } q› n  t | | | |	 ƒ d | k rwt | d ƒ rwt
 | | d j |
 ƒ ƒ t } n  d	 | k r¹t | d	 t ƒ r¹t
 | | d
 j |
 ƒ ƒ t } n  d | k r4t | d ƒ s÷t
 | | d j |
 ƒ ƒ t } q4| d |  j k r4t
 | | d | d |
 f ƒ t } q4n  d | k rvt | d t ƒ rvt
 | | d j |
 ƒ ƒ t } n  t | ƒ } d | k rž|  j | d <n  g  } t } x t t | j ƒ  ƒ D]x } | | k rÙqÁn | | k rò| | } n  | j | ƒ t | | ƒ sÁt
 | | d |
 | | | f ƒ t } qÁqÁWt | ƒ d k rlt
 | | d |
 ƒ t } n  d | k s„d | k rt | ƒ d k rd | k r¨d n d } t | ƒ } | j | ƒ g  | D] } d | ^ qÎ} t
 | | d |
 | d j | ƒ f ƒ t } n  | s› | d |
 d | ƒ | |
 <q› q› Wn  |  j | | | | ƒ | rpt ƒ  |  _ d  |  _ n	 | |  _ d |  j k r”d |  _ n	 | |  _ d  S(   NRW   t   command_runsS   'commands:' section should be a dictionary from command names to attributes, not %rRP   sA   Command variable name cannot be empty string, found: '{}' as namesI   command name '%s' should be followed by a dictionary of attributes not %rRT   s2   'description' field of command {} must be a stringt   supports_http_optionss=   'supports_http_options' field of command {} must be a booleanR‹   sJ   'env_spec' field of command {} must be a string (an environment spec name)sG   env_spec '%s' for command '%s' does not appear in the env_specs sectiont   registers_fusion_functionsA   'registers_fusion_function' field of command {} must be a booleans7   command '%s' attribute '%s' should be a string not '%r'i    s/   command '%s' does not have a command line in itR!   R"   i   s   '%s's?   command '%s' has multiple commands in it, '%s' can't go with %ss   , RS   t
   attributesR›   (    R=   R%   RV   R‡   t   plugins_apit   get_pluginsR   Rñ   RG   R   RF   RH   R¥   R‰   RŸ   RM   R   R?   RÏ   R[   R   R^   R   t   ALL_COMMAND_TYPESR@   Rˆ   R   t   removeR   t   _verify_notebook_commandsRW   RX   (   R1   RA   RI   R~   t   failedt   first_command_nameRW   t   commands_sectionR   t%   all_known_command_attributes_extendedRS   Rß   t   copied_attrst   command_typest   ProjectCommandClasst   attrt   labelt   otherst   other(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR|   n  s¶    						 			 				*		#	c         @  s(  | j  d d g ƒ ‰ ˆ d  k	 rc ˆ t k r1 d  St ˆ ƒ si t | | d j t ˆ ƒ ƒ ƒ d  Sn g  ‰ t t ƒ  ƒ } g  } x! | j	 ƒ  D] } | j
 | ƒ q‹ Wt ˆ j d | d | ƒ} | d  k rò | j
 | j ƒ  ƒ | g  k sî t ‚ d  Sg  | D] }	 |	 d d k sù |	 ^ qù } g  | D] }	 |	 j d d	 ƒ ^ q"} t | ƒ } ‡ ‡ f d
 †  }
 ‡ f d †  } d „  } g  } x< | D]4 } | j d ƒ rƒ|
 | ƒ r·| j | ƒ q·qƒqƒW| j ƒ  t | ƒ d k rP| d } t d d | d | j d d t j j | j ƒ | f d | | ˆ j ƒ d | | ƒ d t ƒ } | j | ƒ nÔ t | ƒ d k r$g  | D] } | | ˆ j ƒ ^ qi‰  g  | D] } | | ƒ ^ qŽ‰ ‡  f d †  } ‡ f d †  } t d d d j | ƒ d | j d d t j j | j ƒ d | d | d t ƒ } | j | ƒ n  d  S(   NRi   t	   notebookss;   'skip_imports: notebooks:' value should be a list, found {}t   frontendR~   i    t   .s   \t   /c         @  s>   x' ˆ  j  ƒ  D] } | j |  k r t Sq W|  ˆ k r: t St S(   N(   RŽ   R!   R=   RH   (   t   relative_namet   command(   RW   t   skipped_notebooks(    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   need_to_import_notebook  s    c         @  s   ‡  ‡ ‡ f d †  } | S(   Nc         @  sŒ   g  } t  j t j j ˆ j ˆ ƒ | ƒ } g  | k s< t ‚ | d  k	 sN t ‚ i ˆ d 6ˆ  d 6} | j | ƒ |  j	 j
 d ˆ g | ƒ d  S(   NR!   R‹   RW   (   t   notebook_analyzert   extrasR'   R(   R   RQ   R    R%   Rƒ   RI   R„   (   R7   t   errorsR+  t   command_dict(   t   env_spec_nameR&  R1   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   add_notebook  s    $(    (   R&  R.  R/  (   R1   (   R.  R&  s7   lib/python2.7/site-packages/anaconda_project/project.pyt   make_add_notebook_func  s    c         @  s   ‡  f d †  } | S(   Nc         @  sH   |  j  j d d g d g  ƒ} | j ˆ  ƒ |  j  j d d g | ƒ d  S(   NRi   R"  R›   (   RI   R‡   R@   R„   (   R7   R(  (   R&  (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   no_add_notebook(  s    (    (   R&  R1  (    (   R&  s7   lib/python2.7/site-packages/anaconda_project/project.pyt   make_no_add_notebook_func'  s    s   .ipynbi   R&   s   No command runs notebook %sR2   R*   s   Create a command in %s for %s?R+   R,   R-   c         @  s   x ˆ  D] } | |  ƒ q Wd  S(   N(    (   R7   t   f(   t	   add_funcs(    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   add_allH  s    c         @  s   x ˆ  D] } | |  ƒ q Wd  S(   N(    (   R7   R3  (   t   no_add_funcs(    s7   lib/python2.7/site-packages/anaconda_project/project.pyt
   no_add_allL  s    s   No commands run notebooks %ss   , s0   Create commands in %s for all missing notebooks?(   R‡   R%   RH   R   RF   RŸ   R¤   R   R   RŽ   RÁ   R   RQ   t
   pop_errorsR    t   replaceRÜ   t   endswithR@   t   sortRˆ   R#   R2   R'   R(   R)   R^   R   (   R1   RW   RA   R~   RI   t   recordert   flat_requirementst   reqst   filesR3  R)  R0  R2  t   need_to_importR&  t   problemR5  R7  (    (   R4  RW   R6  R1   R(  s7   lib/python2.7/site-packages/anaconda_project/project.pyR  è  sp    )%
	


		%		c         @  sõ   xî |  j  j ƒ  D]Ý } | j |  j k r, d  S|  j | j ‰  | j ˆ  ƒ ‰ t ˆ ƒ d k r ‡  ‡ f d †  } t d d | j ˆ  j d j ˆ ƒ f d | j	 d d d j ˆ ƒ ˆ  j t
 j j | j	 ƒ f d	 | d
 t ƒ } | j | ƒ q q Wd  S(   Ni    c         @  s   |  j  j d ˆ  j g ƒ } | d  k	 s- t ‚ | j d g  ƒ } x* ˆ D]" } | | k rF | j | ƒ qF qF W|  j  j d ˆ  j d g | ƒ d  S(   NR[   Re   (   RI   R‡   RS   R%   R    R®   R@   R„   (   R7   R’   Re   t   m(   R‹   RÛ   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   add_packages_to_env_specd  s    R&   s@   Command %s uses env spec %s which does not have the packages: %ss   , R2   R*   s   Add %s to env spec %s in %s?R+   R-   (   RW   RŽ   R^   R[   t   missing_packagesRˆ   R#   RS   R   R2   R'   R(   R)   RH   R@   (   R1   RA   RI   R'  RC  RA  (    (   R‹   RÛ   s7   lib/python2.7/site-packages/anaconda_project/project.pyR}   Z  s     		c         C@  s   d |  j  k S(   s>   Return True if bootstrap-env is in env_specs, False otherwise.s   bootstrap-env(   R[   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR  y  s    (   R:   R;   R5   Rƒ   Rs   Rt   Ru   R   R“   Rx   Ry   Rz   R”   R•   R–   R´   R·   R¾   RÊ   Rv   Rw   R{   R|   R  R}   R  (    (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRO   †   s2   		G	"								<							N	ÿ 9		z	r	t   Projectc           B@  so  e  Z d  Z d2 d2 e d „ Z d „  Z e d „  ƒ Z e d „  ƒ Z	 e d „  ƒ Z
 e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e j d „  ƒ Z d2 d2 d „ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z d2 d „ Z e d „  ƒ Z e d „  ƒ Z d „  Z  e d „  ƒ Z! e d „  ƒ Z" e d „  ƒ Z# e d „  ƒ Z$ e d „  ƒ Z% e d „  ƒ Z& e d  „  ƒ Z' d! „  Z( d" „  Z) d# „  Z* d$ „  Z+ e d% „  ƒ Z, d& „  Z- e d' „  ƒ Z. e d( „  ƒ Z/ d2 d) „ Z0 d* „  Z1 d+ „  Z2 d, „  Z3 d- „  Z4 d. „  Z5 e d/ „  ƒ Z6 d0 „  Z7 d1 „  Z8 RS(3   sý   Represents the information we've inferred about a project.

    The Project class encapsulates information from the project
    file, and also anything else we've guessed by snooping around in
    the project directory or global user configuration.
    c         @  sÇ   t  j j ˆ  ƒ j t  j ƒ |  _ ‡  f d †  } t j ˆ  d | ƒ|  _ t	 j ˆ  ƒ |  _
 t  j j |  j ƒ |  _ t |  j | | ƒ |  _ | d k r¢ t ƒ  } n  t | t ƒ s· t ‚ | g |  _ d S(   sÞ  Construct a Project with the given directory and plugin registry.

        Args:
            directory_path (str): path to the project directory
            plugin_registry (RequirementsRegistry): where to look up Requirement and Provider instances,
                                                    None for default
            frontend (Frontend): the UX using this Project instance
            must_exist (bool): if True, the absence of a project file is a problem
        c          @  s9   t  ˆ  ƒ \ }  } |  d  k	 r% |  g St d d  ƒ g Sd  S(   Nt   shared_base_spec(   R   R%   R   (   Rê   R	  (   RQ   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   load_default_specs’  s    t   default_env_specs_funcN(   R'   R(   t   realpatht   rstript   sept   _directory_pathR   t   load_for_directoryt   _project_fileR   t
   _lock_fileR)   t   _directory_basenameRO   t   _config_cacheR%   R   R?   R   R    t
   _frontends(   R1   RQ   t   plugin_registryR#  R`   RG  (    (   RQ   s7   lib/python2.7/site-packages/anaconda_project/project.pyR5   †  s    
!c         C@  s    |  j  j |  j |  j ƒ |  j  S(   N(   RQ  Rƒ   RN  RO  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   _updated_cache¢  s    c         C@  s   |  j  S(   s"   Get path to the project directory.(   RL  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRQ   ¦  s    c         C@  s   |  j  d S(   s   Return the current UX frontend.iÿÿÿÿ(   RR  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR#  «  s    c         C@  s   |  j  S(   s)   Get the ``ProjectFile`` for this project.(   RN  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRI   °  s    c         C@  s   |  j  S(   s-   Get the ``ProjectLockFile`` for this project.(   RO  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR   µ  s    c         C@  s
   |  j  j S(   s2   Get the ``RequirementsRegistry`` for this project.(   RQ  RR   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRS  º  s    c         C@  s=   g  } x0 |  j  j ƒ  D] } | j |  j | j ƒ ƒ q W| S(   s@   Required items for ALL envs (list of ``Requirement`` instances).(   R[   RŽ   RÁ   R~   RS   (   R1   t   combinedR‹   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt"   union_of_requirements_for_all_envs¿  s    c         @  s~   | d k r |  j } n  |  j ƒ  j ‰  ‡  f d †  } d „  } |  j j | ƒ } | d k ra g  St | j | d | ƒƒ Sd S(   sP   Required items in order to run this project (list of ``Requirement`` instances).c         @  s   ˆ  j  |  j g  ƒ S(   N(   R®   RS   (   R‹   (   R~   (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   get_reqsÐ  s    c         S@  s   t  |  t ƒ s t ‚ |  j S(   N(   R?   R	   R    t   env_var(   t   req(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   req_keyÓ  s    t   key_funcN(   R%   R^   RT  R~   R[   R®   R   t   _get_inherited_with_getter(   R1   R.  RW  RZ  R‹   (    (   R~   s7   lib/python2.7/site-packages/anaconda_project/project.pyR~   Ê  s    	c         C@  s   |  j  | d t ƒS(   s7   All requirements that are ServiceRequirement instances.t   klass(   t   find_requirementsR   (   R1   R.  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   service_requirementsá  s    c         C@  s   |  j  | d t ƒS(   s8   All requirements that are DownloadRequirement instances.R]  (   R^  R   (   R1   R.  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   download_requirementså  s    c         C@  s   |  j  | d t ƒS(   s›   All requirements that have an associated environment variable.

        Note: this will include services, downloads, and even CondaEnvRequirement.
        R]  (   R^  R	   (   R1   R.  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   all_variable_requirementsé  s    c         C@  s/   g  |  j  | ƒ D] } | j t k r | ^ q S(   s´   All 'plain' variables (that aren't services, downloads, or a Conda environment for example).

        Use the ``all_variable_requirements`` property to get every variable.
        (   Ra  t	   __class__R	   (   R1   R.  RY  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   plain_variable_requirementsð  s    c         C@  s   |  j  j t ƒ  ƒ d S(   sx   Push a no-op frontend overriding the currently-active one.

        This is used to disable output temporarily.
        N(   RR  R@   R   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   push_null_frontend÷  s    c         C@  s/   t  |  j ƒ d k s t ‚ |  j d  |  _ d S(   s   Pop the no-op frontend.i   iÿÿÿÿN(   Rˆ   RR  R    (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   pop_null_frontendþ  s    c         c@  s%   |  j  ƒ  z	 d VWd |  j ƒ  Xd S(   s,   Create a context with the frontend disabled.N(   Rd  Re  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   null_frontend  s    
	c         C@  s„   g  } xw |  j  | ƒ D]f } | d k	 rM t | t ƒ oC | j | k rM q n  | d k	 ro t | | ƒ ro q n  | j | ƒ q W| S(   sÖ  Find requirements that match the given env var and class.

        If env_var and klass are both provided, BOTH must match.

        Args:
           env_spec_name (str): name of env spec to find requirements of
           env_var (str): if not None, filter requirements that have this env_var
           klass (class): if not None, filter requirements that are an instance of this class

        Returns:
           list of matching requirements (may be empty)
        N(   R~   R%   R?   R	   RX  R@   (   R1   R.  RX  R]  t   foundRY  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR^    s    +c         C@  s   |  j  ƒ  j S(   s  List of strings describing problems with the project configuration.

        This list contains problems which keep the project from loading, such as corrupt
        config files; it does not contain missing requirements and other "expected"
        problems.
        (   RT  R€   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRA   "  s    c         C@  s)   g  |  j  ƒ  j D] } | j s | ^ q S(   sT   List of ProjectProblem instances describing problems with the project configuration.(   RT  RA   R-   (   R1   RA  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   problem_objects,  s    c         C@  s-   g  |  j  D] } | j r
 | j r
 | ^ q
 S(   s8   List of ProjectProblem that have associated fix prompts.(   Rh  R6   R-   (   R1   RC   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   fixable_problems1  s    c         C@  s.   g  |  j  D]  } | j r
 | j r
 | ^ q
 S(   s,   List of ProjectProblem that cannot be fixed.(   Rh  R6   R-   (   R1   RC   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   unfixable_problems6  s    c         C@  sr   t  |  j ƒ d k rj g  } x |  j D] } | j | ƒ q% W| d k rQ d } n  t d t d | d | ƒ Sd Sd S(   sI   Get a ``Status`` describing project problems, or ``None`` if no problems.i    s   Unable to load the project.t   successRT   R,  N(   Rˆ   RA   R@   R%   R   R=   (   R1   RT   R,  RA  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   problems_status;  s    	c         C@  s   g  |  j  D] } | j ^ q
 S(   sJ   List of strings describing suggested changes to the project configuration.(   t   suggestion_objectsR&   (   R1   RA  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   suggestionsG  s    c         C@  s)   g  |  j  ƒ  j D] } | j r | ^ q S(   s[   List of ProjectProblem instances describing suggested changes to the project configuration.(   RT  RA   R-   (   R1   RA  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRm  L  s    c         C@  sy   d } xl | d k rt t  } x6 |  j ƒ  j D]% } | j r+ | j |  ƒ t } q+ q+ W| rg |  j ƒ  n  | d 8} q	 Wd S(   s%   Fix fixable problems and suggestions.i   i    i   N(   R=   RT  RA   R6   R8   RH   t   use_changes_without_saving(   R1   t
   iterationst   fixed_a_thingRA  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   fix_problems_and_suggestionsQ  s    	c         C@  s   |  j  ƒ  j S(   s¸   Get the project's human-readable name.

        Prefers in order: `name` field from anaconda-project.yml, `package:
        name:` from meta.yaml, then project directory name.
        (   RT  RS   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRS   d  s    c         C@  s   t  |  j ƒ S(   s$   Get the project's url-friendly name.(   R   RS   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   url_friendly_namem  s    c         C@  s   |  j  ƒ  j S(   s   Get the project description.(   RT  RT   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRT   r  s    c         C@  s   |  j  ƒ  j S(   s¯   Get the project's icon as an absolute path or None if no icon.

        Prefers in order: `icon` field from anaconda-project.yml, `app:
        icon:` from meta.yaml.
        (   RT  RU   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRU   w  s    c         C@  s   |  j  ƒ  j S(   sD   Get a dictionary of environment names to CondaEnvironment instances.(   RT  R[   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR[   €  s    c         C@  s   |  j  ƒ  j S(   sK   Get whether locking is enabled by default for lock sets that don't specify.(   RT  R]   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR]   …  s    c         C@  s   |  j  ƒ  j S(   sõ   Get the env spec representing global packages, channels, and platforms sections.

        This env spec has no name (its name is None) and can't be used directly
        to create environments, but every other env spec inherits from it.
        (   RT  R_   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR_   Š  s    c         C@  s#   g  |  j  | ƒ D] } | j ^ q S(   sR   Get a list of strings with the variables names from ``all_variable_requirements``.(   Ra  RX  (   R1   R.  t   r(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   all_variables“  s    c         C@  s#   g  |  j  | ƒ D] } | j ^ q S(   sT   Get a list of strings with the variables names from ``plain_variable_requirements``.(   Rc  RX  (   R1   R.  Rt  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   plain_variables—  s    c         C@  s#   g  |  j  | ƒ D] } | j ^ q S(   sT   Get a list of strings with the variable names for the project services requirements.(   R_  RX  (   R1   R.  Rt  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRd   ›  s    c         C@  s#   g  |  j  | ƒ D] } | j ^ q S(   sT   Get a list of strings with the variable names for the project download requirements.(   R`  RX  (   R1   R.  Rt  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRc   Ÿ  s    c         C@  s   |  j  ƒ  j S(   s&  Get the named environment to use by default.

        This will be the one named "default" if it exists, and
        otherwise the first-listed one.

        Note that each command may have its own default, so
        this should only be used in contexts with no known
        command.
        (   RT  R^   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR^   £  s    c         C@  s3   | d k r |  j St | t ƒ s( t ‚ | j Sd S(   su   Get the named environment to use by default for a given ProjectCommand.

        the command may be ``None``
        N(   R%   R^   R?   R   R    (   R1   R'  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt!   default_env_spec_name_for_command°  s    c         C@  s   |  j  ƒ  j S(   s²   Get the dictionary of commands to run the project.

        This dictionary can be empty.

        Returns:
            dictionary of command names to ``ProjectCommand``
        (   RT  RW   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRW   »  s    	c         C@  s1   |  j  ƒ  } | j d k r d S| j | j Sd S(   s†   Get the default ``ProjectCommand`` or None if we don't have one.

        Returns:
            the default ``ProjectCommand``
        N(   RT  RX   R%   RW   (   R1   t   cache(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   default_commandÆ  s    c         C@  s3   |  j  } | d k r d S| j d | d | ƒ Sd S(   s  Get the information needed to run the project's default command.

        Args:
            environ (dict): the environment
            extra_args (list of str): extra args to append to the command line
        Returns:
            a CommandExecInfo instance
        t   environt
   extra_argsN(   Ry  R%   t   exec_info_for_environment(   R1   Rz  R{  R'  (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt!   default_exec_info_for_environmentÓ  s    		c         C@  s\   | d k r |  j ƒ  j } n  | d k r. d S| |  j ƒ  j k rT |  j ƒ  j | Sd Sd S(   sÐ   Get the ProjectCommand for the given command name, or None if no commands.

        Args:
           command_name (str): the command name
        Returns:
           a ProjectCommand instance or None
        N(   R%   RT  RX   RW   (   R1   t   command_name(    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   command_for_nameâ  s    c         C@  s.  t  ƒ  } |  j | d <|  j | d <|  j | d <t | d <t  ƒ  } x|  j j ƒ  D]\ } } t  d | j ƒ | | <| j d k	 r˜ | j | | d <n  | j	 d k	 r» | j	 | | d <n  | j
 d k	 rÞ | j
 | | d <n  | j d k	 r| j | | d <n  | |  j k r!t | | d	 <n  | j | | d
 <| j | | d <| | j | j ƒ qS W| | d <t  ƒ  } x¯|  j j ƒ  D]ž\ } } t  d t | j ƒ d t | j ƒ d | j d | j j d t | j ƒ ƒ | | <t  ƒ  } t  ƒ  } t  ƒ  }	 xû |  j | ƒ D]ê }
 t |
 t ƒ rqn  t |
 t ƒ rt  d |
 j d |
 j d |
 j ƒ } |
 j } | d k	 rt| | d	 <n  t |
 t  ƒ r |
 j! | d <| | |
 j" <qît |
 t# ƒ rÌ|
 j$ | d <| |	 |
 j" <qît |
 t ƒ rî| | |
 j" <qîqqW| | | d <| | | d <|	 | | d <q~W| | d <| S(   sq  Get JSON-serializable information to be stored as metadata when publishing the project.

        This is a "baked" version of anaconda-project.yml which also
        includes any defaults or automatic configuration.

        Before calling this, check that Project.problems is empty.

        Returns:
            A dictionary containing JSON-compatible types.
        RS   Rs  RT   t   anaconda_project_versionR"   R!   R    R   R›   R‹   R  RW   Re   Rg   RË   Rh   t   titlet	   encryptedt   urlRª   Rc   Rb   Rd   R[   N(%   RV   RS   Rs  RT   R   RW   R¥   R"   R%   R!   t   windows_cmd_commandlinet   unix_shell_commandlineRy  RH   R^   R  Rƒ   R+  R[   R   R×   Rg   RÐ   RÎ   Rh   R~   R?   R
   R	   R  R‚  t   default_as_stringR   Rƒ  RX  R   R©   (   R1   t   jsonRW   RL   R'  t   envst   envRb   Rc   Rd   RY  t   dataR›   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   publication_infoó  sl    	
	
					$	
c         C@  s   |  j  j ƒ  |  j j ƒ  d S(   sú   Revert the project configuration by reloading config from disk.

        Discards all unsaved changes.

        This isn't needed when creating a Project, just if you want to
        revert to disk. We automatically load on Project creation.
        N(   RI   t   loadR   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRŒ  ?  s    c         C@  s   |  j  j ƒ  |  j j ƒ  d S(   sl   Save any modified project configuration.

        Does nothing for config files that are not dirty.
        N(   RI   t   saveR   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR  J  s    c         C@  s   |  j  j ƒ  |  j j ƒ  d S(   sÍ   Rebuild project state from in-memory changes.

        This causes the Project instance to reload from
        the in-memory (but possibly unsaved) state of
        the project file and lock file.
        N(   RI   Ro  R   (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRo  R  s    c         C@  s   t  |  j d d ƒ S(   s)   Fullpath to bootstrap environment prefix.Rˆ  s   bootstrap-env(   R   RL  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   bootstrap_env_prefix\  s    c         C@  s   t  j d |  j k S(   sZ   Return True if anaconda-project is running inside a project bootstrap env False otherwise.R™   (   R'   Rz  RŽ  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   is_running_in_bootstrap_enva  s    c         C@  s   |  j  j ƒ  S(   s>   Return True if bootstrap-env is in env_specs, False otherwise.(   RQ  R  (   R1   (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyR  e  s    N(9   R:   R;   R<   R%   R=   R5   RT  R>   RQ   R#  RI   R   RS  RV  R~   R_  R`  Ra  Rc  Rd  Re  t
   contextlibt   contextmanagerRf  R^  RA   Rh  Ri  Rj  Rl  Rn  Rm  Rr  RS   Rs  RT   RU   R[   R]   R_   Ru  Rv  Rd   Rc   R^   Rw  RW   Ry  R}  R  R‹  RŒ  R  Ro  RŽ  R  R  (    (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyRE  ~  sd   									
											L			
	(K   R<   t
   __future__R    R  R   R   R'   t   os.pathR   t   anaconda_project.env_specR   R   R   R   t/   anaconda_project.requirements_registry.registryR   t2   anaconda_project.requirements_registry.requirementR	   t=   anaconda_project.requirements_registry.requirements.conda_envR
   R   t<   anaconda_project.requirements_registry.requirements.downloadR   t;   anaconda_project.requirements_registry.requirements.serviceR   t!   anaconda_project.project_commandsR   R   t   anaconda_project.project_fileR   t"   anaconda_project.project_lock_fileR   t   anaconda_project.archiverR   t   anaconda_project.versionR   t   anaconda_project.conda_managerR   t   anaconda_project.frontendR   R   R   t$   anaconda_project.internal.py2_compatR   R   R   t'   anaconda_project.internal.simple_statusR   t!   anaconda_project.internal.slugifyR   t+   anaconda_project.internal.notebook_analyzert   internalR*  t#   anaconda_project.internal.conda_apiR¸   t!   anaconda_project.internal.pip_apiRÂ   t   anaconda_project.internalR   R  t   COMMAND_TYPE_CONDA_APP_ENTRYt   COMMAND_TYPE_SHELLt   COMMAND_TYPE_WINDOWSt   COMMAND_TYPE_NOTEBOOKt   COMMAND_TYPE_BOKEH_APPR  t   objectR#   RD   R%   RF   RM   RN   RO   RE  (    (    (    s7   lib/python2.7/site-packages/anaconda_project/project.pyt   <module>   sT   "	0	
		ÿ ÿ ÿ û