ó
æNXc           @   sw   d  Z  d d l Z d d l Z d d l m Z d e f d „  ƒ  YZ d e f d „  ƒ  YZ d	 e j	 f d
 „  ƒ  YZ
 d S(   s%   A shim module for deprecated imports
iÿÿÿÿNi   (   t   import_itemt   ShimWarningc           B   s   e  Z d  Z RS(   sF   A warning to show when a module has moved, and a shim is in its place.(   t   __name__t
   __module__t   __doc__(    (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyR      s   t   ShimImporterc           B   s5   e  Z d  Z d „  Z d „  Z d d „ Z d „  Z RS(   s¨   Import hook for a shim.
    
    This ensures that submodule imports return the real target module,
    not a clone that will confuse `is` and `isinstance` checks.
    c         C   s   | |  _  | |  _ d  S(   N(   t   srct   mirror(   t   selfR   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   __init__   s    	c         C   s   |  j  | t |  j ƒ S(   s#   get the name of the mirrored module(   R   t   lenR   (   R   t   fullname(    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   _mirror_name   s    c         C   sk   | j  |  j d ƒ rg |  j | ƒ } y t | ƒ } Wn t k
 rI d SXt | t j ƒ s` d S|  Sn  d S(   s6   Return self if we should be used to import the module.t   .N(	   t
   startswithR   R   R    t   ImportErrort
   isinstancet   typest
   ModuleTypet   None(   R   R   t   patht   mirror_namet   mod(    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   find_module   s    c         C   s,   |  j  | ƒ } t | ƒ } | t j | <| S(   s:   Import the mirrored module, and insert it into sys.modules(   R   R    t   syst   modules(   R   R   R   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   load_module+   s    N(   R   R   R   R	   R   R   R   R   (    (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyR      s
   		t
   ShimModulec           B   sP   e  Z d  „  Z e d „  ƒ Z e d „  ƒ Z d „  Z e d „  ƒ Z d „  Z RS(   c         O   s   | j  d ƒ |  _ | j  d d  ƒ } | rG | j d d ƒ d | d <n  t t |  ƒ j | | Ž  | r‹ t j j	 t
 d | d |  j ƒ ƒ n  d  S(   NR   R   R   i   iÿÿÿÿt   name(   t   popt   _mirrorR   t   rsplitt   superR   R	   R   t	   meta_patht   appendR   (   R   t   argst   kwargsR   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyR	   5   s    	c         C   s   g  S(   N(    (   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   __path__A   s    c         C   s   t  |  j ƒ j S(   s&   Don't produce __spec__ until requested(   t
   __import__R   t   __spec__(   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyR'   E   s    c         C   s   t  t |  j ƒ ƒ S(   N(   t   dirR&   R   (   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   __dir__J   s    c         C   s[   t  |  j ƒ } y | j SWn: t k
 rV g  t | ƒ D] } | j d ƒ s7 | ^ q7 SXd S(   s    Ensure __all__ is always definedt   _N(   R&   R   t   __all__t   AttributeErrorR(   R   (   R   R   R   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyR+   M   s
    c         C   sE   d |  j  | f } y t | ƒ SWn t k
 r@ t | ƒ ‚ n Xd  S(   Ns   %s.%s(   R   R    R   R,   (   R   t   keyR   (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   __getattr__V   s
    (	   R   R   R	   t   propertyR%   R'   R)   R+   R.   (    (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyR   3   s   			(   R   R   R   t   importstringR    t   WarningR   t   objectR   R   R   (    (    (    sP   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/utils/shimmodule.pyt   <module>   s   %