ó
OåNc           @   sÒ   d  Z  d d l Z e Z e ƒ  Z y e e j i  i  d d ƒ Wn e k
 rZ d „  Z	 n Xe Z	 d e f d „  ƒ  YZ
 d d d d d „ Z d d d	 d
 d d d d d d d d d d g Z d „  Z d „  Z d S(   sU  
demandimport - automatic demandloading of modules

To enable this module, do:

  import demandimport; demandimport.enable()

Imports of the following forms will be demand-loaded:

  import a, b.c
  import a.b as c
  from a import b,c # a will be loaded immediately

These imports will not be delayed:

  from a import *
  b = __import__(a)
iÿÿÿÿNc         C   s   t  |  | | | ƒ S(   s'   call _origimport with no level argument(   t   _origimport(   t   namet   globalst   localst   fromlistt   level(    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   _import#   s    t
   _demandmodc           B   sM   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   s   module demand-loader and proxyc         C   sr   d | k r0 | j  d d ƒ \ } } | g } n | } g  } t j |  d | | | | f ƒ t j |  d d  ƒ d  S(   Nt   .i   t   _datat   _module(   t   splitt   objectt   __setattr__t   None(   t   selfR   R   R   t   headt   restt   after(    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   __init__+   s    c         C   s   |  j  d j | ƒ d S(   s%   add to the list of submodules to loadi   N(   R	   t   append(   R   R   (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   _extend4   s    c            sŸ   |  j  s› |  j \ } } } } t | | | ƒ } ‡  f d †  ‰  x | D] } ˆ  | | ƒ qF W| r… | j | ƒ |  k r… | | | <n  t j |  d | ƒ n  d  S(   Nc            s”   | d  } } d | k r4 | j d d ƒ \ } } n  t |  | t ƒ t k rq t |  | t | |  j |  j ƒ ƒ n | r ˆ  t |  | ƒ | ƒ n  d  S(   NR   i   (   R   R   t   getattrt   nothingt   setattrR   t   __dict__(   t   modt   pt   ht   t(   t   subload(    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyR   <   s    %R
   (   R
   R	   R    t   getR   R   (   R   R   R   R   R   R   t   x(    (   R   s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   _load7   s    		c         C   s'   |  j  r d |  j d Sd |  j d S(   Ns   <proxied module '%s'>i    s   <unloaded module '%s'>(   R
   R	   (   R   (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   __repr__M   s    	c         O   s   t  d t |  ƒ ƒ ‚ d  S(   Ns   %s object is not callable(   t	   TypeErrort   repr(   R   t   argst   kwargs(    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   __call__Q   s    c         C   s6   | d k r t  j |  | ƒ S|  j ƒ  t |  j | ƒ S(   NR	   R   R!   R
   (   s   _datas   _extends   _loads   _module(   R   t   __getattribute__R!   R   R
   (   R   t   attr(    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyR(   S   s    
c         C   s!   |  j  ƒ  t |  j | | ƒ d  S(   N(   R!   R   R
   (   R   R)   t   val(    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyR   X   s    
(
   t   __name__t
   __module__t   __doc__R   R   R!   R"   R'   R(   R   (    (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyR   )   s   							c   
   
   C   sÒ  | s |  t  k s | d k r5 t |  | | | | ƒ S| sá d |  k rÑ |  j d d ƒ \ } } | r“ | j d d  ƒ | k r“ t |  | | | | ƒ S| | k rÑ t | | t ƒ rÆ | | j | ƒ n  | | Sn  t |  | | ƒ S| d k rt |  | | | | ƒ St |  | | ƒ } xg |  j d ƒ d D]R } t	 | | t
 ƒ t
 k rlt | | t | | j | j ƒ ƒ n  t	 | | ƒ } q)WxH | D]@ }	 t	 | |	 t
 ƒ t
 k r†t | |	 t |	 | j | ƒ ƒ q†q†W| Sd  S(   Nt   *R   i   R+   iÿÿÿÿ(   R.   (   t   ignoreR   R   R   R   t
   isinstanceR   R   R    R   R   R   R   (
   R   R   R   R   R   t   baseR   R   t   compR    (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   _demandimport\   s.    %&t   _hashlibt   _xmlplust   fcntls   win32com.gen_pyt   _winregt	   pythoncomt   pwdt   grpt   resourcet   gtkt   __main__t   _sslt   rfc822t	   mimetoolsc           C   s   t  t _ d S(   s'   enable global demand-loading of modulesN(   R3   t   __builtin__t
   __import__(    (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   enable•   s    c           C   s   t  t _ d S(   s(   disable global demand-loading of modulesN(   R    RA   RB   (    (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   disable™   s    (   R-   RA   RB   R    R   R   R+   R   R#   R   R   R3   R/   RC   RD   (    (    (    s:   /sys/lib/python2.7/site-packages/mercurial/demandimport.pyt   <module>   s4   	3#		