ó
šxŠ\c           @   s8   d  Z  d d l Z d d l Z d e f d „  ƒ  YZ d S(   sŒ   
This module houses a utility class for mocking deprecated modules.
It is for internal use only and should not be used beyond this purpose.
iÿÿÿÿNt   _DeprecatedModulec           B   sM   e  Z d  Z d d d d „ Z d „  Z d „  Z e Z d „  Z d d „ Z	 RS(   sû   Class for mocking deprecated modules.

    Parameters
    ----------
    deprmod : name of module to be deprecated.
    deprmodto : name of module as a replacement, optional.
                If not given, the __module__ attribute will
                be used when needed.
    removals : objects or methods in module that will no longer be
               accessible once module is removed.
    moved : dict, optional
            dictionary of function name -> new location for moved
            objects
    c         C   sd   | |  _  | |  _ | |  _ |  j d  k	 r? t |  j ƒ |  _ n  | |  _ t t |  j ƒ ƒ |  _ d  S(   N(	   t   deprmodt	   deprmodtot   removalst   Nonet	   frozensett   movedt   dirt	   __class__t   self_dir(   t   selfR   R   R   R   (    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyt   __init__   s    				c         C   s   |  j  ƒ  } t | ƒ S(   N(   t   _import_deprmodR   (   R
   t
   deprmodule(    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyt   __dir__&   s    c         C   s   |  j  ƒ  } t | ƒ S(   N(   R   t   repr(   R
   R   (    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyt   __repr__*   s    c      	   C   s´  | |  j  k r t j |  | ƒ Sy |  j |  j ƒ } Wn8 t k
 ro |  j d  k rZ ‚  n  |  j |  j ƒ } n Xt | | ƒ } |  j	 d  k	 rË | |  j	 k rË t
 j d j d |  j d | ƒ t d d ƒnå |  j d  k	 r$| |  j k r$t
 j d j d |  j d | d |  j | ƒ t d d ƒnŒ |  j } | t k rgt
 j d j d |  j d | ƒ t d d ƒnI | d  k r| j } n  t
 j d j d |  j d | d	 | ƒ t d d ƒ| S(
   NsG   {deprmod}.{name} is deprecated and will be removed in a future version.R   t   namet
   stackleveli   sa   {deprmod} is deprecated and will be removed in a future version.
You can access {name} as {moved}R   sF   {deprmod}.{name} is deprecated. Please use {deprmodto}.{name} instead.R   (   R	   t   objectt   __getattribute__R   R   t   ImportErrorR   R   t   getattrR   t   warningst   warnt   formatt   FutureWarningR   t   Falset
   __module__(   R
   R   R   t   objR   (    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyt   __getattr__0   sD    						c         C   sU   | d  k r |  j } n  t j ƒ  + t j d d t ƒt j | ƒ } | SWd  QXd  S(   Nt   ignoret   category(   R   R   R   t   catch_warningst   filterwarningsR   t	   importlibt   import_module(   R
   t   modR   (    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyR   `   s    N(
   t   __name__R   t   __doc__R   R   R   R   t   __str__R   R   (    (    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyR    
   s   			0(   R'   R#   R   R   R    (    (    (    s7   lib/python2.7/site-packages/pandas/util/_depr_module.pyt   <module>   s   