File: //lib64/python2.7/site-packages/hgdemandimport/demandimportpy2.pyc
�
1�3\c @@ s� d Z d d l m Z d d l Z d d l Z d d l Z d d l m Z e j Z e
Z e � Z
d � Z d e f d � � YZ d e j k Z d d d d
d � Z e � a d � Z d
� Z d � Z d � Z e 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 ( t absolute_importNi ( t tracingc O@ s� y | | | | | � SWn� t k
r� | s3 � n d | } | j d d � d } | j d d � j d d � d } | | k r� � n | | | | | � SXd S( Ns hgext_%st .i i t __name__t ( t ImportErrort splitt get( t
importfunct namet globalst argst kwargst hgextnamet nameroott contextroot( ( sD /usr/lib64/python2.7/site-packages/hgdemandimport/demandimportpy2.pyt _hgextimport) s
"t
_demandmodc B@ st e Z d Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z
e d � � Z e d
� � Z RS( sx module demand-loader and proxy
Specify 1 as 'level' argument at construction, to import module
relatively.
c C@ s{ d | k r0 | j d d � \ } } | g } n | } g } t j | d | | | | | t � f � t j | d d � d S( NR i t _datat _module( R t objectt __setattr__t sett None( t selfR R
t localst levelt headt restt after( ( sD /usr/lib64/python2.7/site-packages/hgdemandimport/demandimportpy2.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 ( ( sD /usr/lib64/python2.7/site-packages/hgdemandimport/demandimportpy2.pyt _extendJ s c C@ s | j d j | � d S( s� Record that the named module ``name`` imports this module.
References to this proxy class having the name of this module will be
replaced at module load time. We assume the symbol inside the importing
module is identical to the "head" name of this module. We don't
actually know if "as X" syntax is being used to change the symbol name
because this information isn't exposed to __import__.
i N( R t add( R R ( ( sD /usr/lib64/python2.7/site-packages/hgdemandimport/demandimportpy2.pyt _addrefN s c @ s� | j s�t j d | j d � �h| j \ } } } } } } t t | | | d | � } | | k r� | j } | r� | | k s� t d | | f � � d S� f d � � x | D] } � | | � q� W| r| j | � | k r� | | | <q| j | d � | k r| | | d <qn xT | D]L } t j
j | d � }
|
r#t |
| d � | k r#t |
| | � q#q#Wt
j | d | � Wd QXn d S( Ns demandimport %si s %s, %sc @ s� | d } } d | k r4 | j d d � \ } } n t | | t � t k rw t | | t | | j | j d d �� n | r� � t | | � | � n d S( NR i R ( R R t getattrt nothingt setattrR t __dict__( t modt pt ht t( t subload( sD /usr/lib64/python2.7/site-packages/hgdemandimport/demandimportpy2.pyR+ q s
R'