ó
‹'=[c           @   s#  d  Z  d d l Z d d l m Z m Z m Z m Z m Z m Z m	 Z	 m
 Z
 d d l m Z 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 m Z d d l m Z m Z d d l m Z d d l m Z m  Z  d	 Z! d
 Z" d „  Z# d S(   sD   The main API for the v2 notebook format.

Authors:

* Brian Granger
iÿÿÿÿNi   (   t   NotebookNodet   new_code_cellt   new_text_cellt   new_notebookt
   new_outputt   new_worksheett   new_metadatat
   new_author(   t   readst   writes(   t   to_notebook(   R   (   t	   downgradet   upgradei   i    c         C   sz   t  j j |  ƒ \ } } | d k r- d } n@ | d k rB d } n+ | d k rW d } n |  } |  d }  d } |  | | f S(   s÷  Parse a notebook filename.

    This function takes a notebook filename and returns the notebook
    format (json/py) and the notebook name. This logic can be
    summarized as follows:

    * notebook.ipynb -> (notebook.ipynb, notebook, json)
    * notebook.json  -> (notebook.json, notebook, json)
    * notebook.py    -> (notebook.py, notebook, py)
    * notebook       -> (notebook.ipynb, notebook, json)

    Parameters
    ----------
    fname : unicode
        The notebook filename. The filename can use a specific filename
        extention (.ipynb, .json, .py) or none, in which case .ipynb will
        be assumed.

    Returns
    -------
    (fname, name, format) : (unicode, unicode, unicode)
        The filename, notebook name and format.
    u   .ipynbu   jsonu   .jsonu   .pyu   py(   t   ost   patht   splitext(   t   fnamet   basenamet   extt   format(    (    s3   lib/python2.7/site-packages/nbformat/v2/__init__.pyt   parse_filename0   s    			
($   t   __doc__R   t   nbbaseR    R   R   R   R   R   R   R   t   nbjsonR   t
   reads_jsonR	   t   writes_jsont	   read_jsont
   write_jsonR
   t   to_notebook_jsont   nbxmlt	   reads_xmlt   read_xmlt   to_notebook_xmlt   nbpyt   reads_pyt	   writes_pyt   read_pyt   write_pyt   to_notebook_pyt   convertR   R   t   nbformatt   nbformat_minorR   (    (    (    s3   lib/python2.7/site-packages/nbformat/v2/__init__.pyt   <module>   s   :