ó
æNXc           @  s~   d  Z  d d l m Z d d l Z d d l m Z d d l m Z m Z m	 Z	 d d l
 m Z e d e f d „  ƒ  Yƒ Z d S(	   s?   Implementation of magic functions for the extension machinery.
iÿÿÿÿ(   t   print_functionN(   t
   UsageError(   t   Magicst   magics_classt
   line_magic(   t   warnt   ExtensionMagicsc           B  sM   e  Z d  Z e d d „ ƒ Z e d „  ƒ Z e d „  ƒ Z e d „  ƒ Z RS(   s/   Magics to manage the IPython extensions system.t    c         C  s­   t  d t ƒ |  j | d ƒ \ } } y% |  j j j | | j d ƒ ƒ } Wn t k
 rj } t | ƒ d SXt	 j
 j | ƒ } t d | ƒ t d t	 j
 j | ƒ d ƒ d S(   s”  Download and install an extension from a URL, e.g.::

            %install_ext https://bitbucket.org/birkenfeld/ipython-physics/raw/d1310a2ab15d/physics.py

        The URL should point to an importable Python module - either a .py file
        or a .zip file.

        Parameters:

          -n filename : Specify a name for the file, rather than taking it from
                        the URL.
        sU   %install_ext` is deprecated, please distribute your extension(s)as a python packages.s   n:t   nNs   Installed %s. To use it, type:s     %%load_ext %si    (   R   t   UserWarningt   parse_optionst   shellt   extension_managert   install_extensiont   gett
   ValueErrort   printt   ost   patht   basenamet   splitext(   t   selft   parameter_st   optst   argst   filenamet   e(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/extension.pyt   install_ext    s    
c         C  su   | s t  d ƒ ‚ n  |  j j j | ƒ } | d k rT t d | ƒ t d | ƒ n | d k rq t d | ƒ n  d S(   s-   Load an IPython extension by its module name.s   Missing module name.s   already loadeds6   The %s extension is already loaded. To reload it, use:s     %reload_exts   no load functions*   The %s module is not an IPython extension.N(   R   R   R   t   load_extensionR   (   R   t
   module_strt   res(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/extension.pyt   load_ext=   s    c         C  sh   | s t  d ƒ ‚ n  |  j j j | ƒ } | d k rG t d | ƒ n | d k rd t d | ƒ n  d S(   s·   Unload an IPython extension by its module name.
        
        Not all extensions can be unloaded, only those which define an
        ``unload_ipython_extension`` function.
        s   Missing module name.s   no unload functions1   The %s extension doesn't define how to unload it.s
   not loadeds   The %s extension is not loaded.N(   R   R   R   t   unload_extensionR   (   R   R   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/extension.pyt
   unload_extJ   s    c         C  s,   | s t  d ƒ ‚ n  |  j j j | ƒ d S(   s/   Reload an IPython extension by its module name.s   Missing module name.N(   R   R   R   t   reload_extension(   R   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/extension.pyt
   reload_ext[   s    (   t   __name__t
   __module__t   __doc__R   R   R   R!   R#   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/extension.pyR      s   (   R&   t
   __future__R    R   t   IPython.core.errorR   t   IPython.core.magicR   R   R   t   warningsR   R   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/magics/extension.pyt   <module>   s   