ó
>ò†[c           @  s¶   d  Z  d d l m Z d d l Z d d l Z d d l m Z d d l m Z d d l	 m
 Z
 m Z m Z m Z m Z e j d ƒ Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d S(   ul   
[Deprecation warning]
`anaconda notebook` is going to be deprecated
use `anaconda upload/download` instead
iÿÿÿÿ(   t   unicode_literalsN(   t   errors(   t   get_server_api(   t   Uploadert
   Downloadert   parset   notebook_urlt   has_environmentu   binstar.notebookc      
   C  sT   d } |  j  d d t j d | d | d t ƒ} | j ƒ  } t | ƒ t | ƒ d  S(   Nu3   Interact with notebooks in your Anaconda repositoryu   notebookt   formatter_classt   helpt   descriptiont   epilog(   t
   add_parsert   argparset   RawDescriptionHelpFormattert   __doc__t   add_subparserst   add_upload_parsert   add_download_parser(   t
   subparsersR
   t   parsert   nb_subparsers(    (    s_   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/commands/notebook.pyR      s    		
c      
   C  sù   d } d } |  j  d d t j d | d | d | ƒ} | j d ƒ } | j d	 d
 d d ƒ| j d d d d ƒ| j d d d d ƒ| j d d d d ƒ| j d d d d ƒ| j d d d d d ƒ| j d d d d d ƒ| j d t ƒ d  S(    Nu-   Upload a notebook to your Anaconda repositoryus   
    [Deprecation warning]
    `anaconda notebook` is going to be deprecated
    use `anaconda upload` instead
    u   uploadR   R	   R
   R   u   metadata optionsu   -nu   --nameu'   Notebook's name (will be parameterized)u   -vu	   --versionu   Notebook's versionu   -su	   --summaryu   Set the summary of the notebooku   -tu   --thumbnailu   Notebook's thumbnail imageu   -uu   --useru*   User account, defaults to the current useru   --forceu,   Force a notebook upload regardless of errorst   actionu
   store_trueu   notebooku   Notebook to uploadu   storet   main(   R   R   R   t   add_argument_groupt   add_argumentt   set_defaultst   upload(   R   R
   R   R   t   mgroup(    (    s_   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/commands/notebook.pyR      s0    			c      
   C  s›   d } d } |  j  d d t j d | d | d | ƒ} | j d d d	 d
 d ƒ| j d d d d d
 d ƒ| j d d d d d d ƒ| j d t ƒ d  S(   Nu0   Download notebooks from your Anaconda repositoryuu   
    [Deprecation warning]
    `anaconda notebook` is going to be deprecated
    use `anaconda download` instead
    u   downloadR   R	   R
   R   u   handleu   user/notebookR   u   storeu   -fu   --forceu	   Overwriteu
   store_trueu   -ou   --outputu   Download ast   defaultu   .R   (   R   R   R   R   R   t   download(   R   R
   R   R   (    (    s_   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/commands/notebook.pyR   E   s(    				c         C  sò   t  |  j |  j ƒ } t | |  j d |  j d |  j d |  j d |  j d |  j	 ƒ} yh | j
 d |  j ƒ } t j d ƒ t j d ƒ t j d	 j |  j ƒ ƒ t j d
 j t | ƒ ƒ ƒ Wn/ t j t f k
 rí } t j t | ƒ ƒ n Xd  S(   Nt   usert   summaryt   versiont	   thumbnailt   namet   forceu-   `anaconda notebook` is going to be deprecatedu   use `anaconda upload` instead.u   {} has been uploaded.u!   You can visit your notebook at {}(   R   t   tokent   siteR   t   notebookR   R    R!   R"   R#   R   R$   t   loggert   warningt   infot   formatR   R   t   BinstarErrort   IOErrort   errort   str(   t   argst   aserver_apit   uploadert   upload_infot   e(    (    s_   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/commands/notebook.pyR   g   s    ! c         C  sK  t  |  j |  j |  j ƒ } t |  j ƒ \ } } | pC | j ƒ  d } t | | | ƒ } yº | d |  j d |  j	 ƒ } t
 j d ƒ t
 j d ƒ t
 j d j |  j | d ƒ ƒ t | d ƒ rt
 j d j | d ƒ ƒ t
 j d	 ƒ t
 j d
 j | d ƒ ƒ t
 j d ƒ n  Wn2 t j t j t f k
 rF} t
 j | j ƒ n Xd  S(   Nu   logint   outputR$   u-   `anaconda notebook` is going to be deprecatedu    use `anaconda download` instead.u   {} has been downloaded as {}.i    u   {} has an environment embedded.u   Run:u       conda env create {}u)   To install the environment in your system(   R   R%   R&   t	   log_levelR   t   handleR   R   R5   R$   R(   R)   R*   R+   R   R   t   DestionationPathExistst   NotFoundt   OSErrort   msg(   R0   R1   t   usernameR'   t
   downloadert   download_infot   err(    (    s_   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/commands/notebook.pyR   w   s      (   R   t
   __future__R    R   t   loggingt   binstar_clientR   t   binstar_client.utilsR   t   binstar_client.utils.notebookR   R   R   R   R   t	   getLoggerR(   R   R   R   R   R   (    (    (    s_   lib/python2.7/site-packages/anaconda_client-1.7.2-py2.7.egg/binstar_client/commands/notebook.pyt   <module>   s   (		'	"	