B
    '¦\  ã               @   sR   yd dl Z W n ek
r$   dZ Y nX ddlmZ ddlmZ G dd„ deƒZdS )é    Né   )ÚEnvironmenté   )ÚBinstarSpecc               @   s6   e Zd ZdZd
dd„Zdd„ Zdd„ Zedd	„ ƒZdS )ÚNotebookSpecNc             K   s   || _ i | _d S )N)ÚnameÚnb)Úselfr   Úkwargs© r   ú7lib/python3.7/site-packages/conda_env/specs/notebook.pyÚ__init__   s    zNotebookSpec.__init__c             C   s   |   ¡ }|rtdƒ |S )Nz¯WARNING: Notebook environments are deprecated and scheduled to be removed in conda 4.5. See conda issue #5843 at https://github.com/conda/conda/pull/5843 for more information.)Ú_can_handleÚprint)r	   Úresultr   r   r   Ú
can_handle   s    zNotebookSpec.can_handlec          	   C   s    y&t j t| jƒ ¡ ¡| _d| jd kS  tk
r@   d| _Y n\ t	k
r`   d 
| j¡| _Y n< t jjtfk
rˆ   d 
| j¡| _Y n tk
rš   dS X dS )NÚenvironmentÚmetadataz0Please install nbformat:
	conda install nbformatz&{} does not exist or can't be accessedz&{} does not looks like a notebook fileF)ÚnbformatÚreaderZreadsÚopenr   Úreadr   ÚAttributeErrorÚmsgÚIOErrorÚformatZNotJSONErrorÚKeyErrorÚ	Exception)r	   r   r   r   r      s    
zNotebookSpec._can_handlec             C   s8   d| j d d kr tdƒ}|jS tf | j d d ŽS d S )NZremoter   r   zdarth/deathstar)r   r   r   r   )r	   Úspecr   r   r   r   )   s    zNotebookSpec.environment)N)	Ú__name__Ú
__module__Ú__qualname__r   r   r   r   Úpropertyr   r   r   r   r   r      s
   
r   )r   ÚImportErrorÚenvr   Zbinstarr   Úobjectr   r   r   r   r   Ú<module>   s   
