Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/demandimport.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


�
�c	@swdZddkZeZdefd��YZddddd�Zdddd	d
ddd
gZd�Z	d�Z
dS(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�Nt
_demandmodcBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(smodule demand-loader and proxycCstd|jo%|idd�\}}|g}n
|}g}ti|d||||f�ti|dd�dS(Nt.it_datat_module(tsplittobjectt__setattr__tNone(tselftnametglobalstlocalstheadtresttafter((s)/sys/lib/python/mercurial/demandimport.pyt__init__ s

cCs|idi|�dS(s%add to the list of submodules to loadiN(Rtappend(RR	((s)/sys/lib/python/mercurial/demandimport.pyt_extend)scs�|ip�|i\}}}}t|||�}�fd��x|D]}�||�qGW|o$|i|�|jo|||<nti|d|�ndS(Ncs�|d}}d|jo|idd�\}}nt||�p&t||t||i|i��n"|o�t||�|�ndS(NRi(RRthasattrtsetattrRt__dict__tgetattr(tmodtpthtt(tsubload(s)/sys/lib/python/mercurial/demandimport.pyR1s

&R(RRt_origimporttgetRR(RRR
RRRtx((Rs)/sys/lib/python/mercurial/demandimport.pyt_load,s
	cCs,|iod|idSnd|idS(Ns<proxied module '%s'>is<unloaded module '%s'>(RR(R((s)/sys/lib/python/mercurial/demandimport.pyt__repr__Bs
cOstdt|���dS(Ns%s object is not callable(t	TypeErrortrepr(Rtargstkwargs((s)/sys/lib/python/mercurial/demandimport.pyt__call__FscCs;|djoti||�Sn|i�t|i|�S(NRRRR(s_datas_extends_loads_module(Rt__getattribute__RRR(Rtattr((s)/sys/lib/python/mercurial/demandimport.pyR%Hs

cCs!|i�t|i||�dS(N(RRR(RR&tval((s)/sys/lib/python/mercurial/demandimport.pyRMs
(
t__name__t
__module__t__doc__RRRRR$R%R(((s)/sys/lib/python/mercurial/demandimport.pyRs							c
Cs|p|tjp
|djo>|djot||||�Sqt|||||�Sn�|p�d|jo�|idd�\}}|o0|idd�|jot||||�Sn||jo5t||t�o||i|�n||Sq	nt|||�Sn�|dj	ot|||||�Snt|||�}x`|id�dD]K}t||�p&t	||t||i
|i
��nt||�}qjWxA|D]9}	t||	�p#t	||	t|	|i
|��q�q�W|SdS(Nt*RiR((R+(tignoreRRRRt
isinstanceRRRRRR(
R	R
RtfromlisttleveltbaseR
RtcompR((s)/sys/lib/python/mercurial/demandimport.pyt
_demandimportQs6"

 

&'t_hashlibt_xmlplustfcntlswin32com.gen_pyt	pythoncomtpwdtgrptresourcecCs
tt_dS(s'enable global demand-loading of modulesN(R2t__builtin__t
__import__(((s)/sys/lib/python/mercurial/demandimport.pytenable�scCs
tt_dS(s(disable global demand-loading of modulesN(RR:R;(((s)/sys/lib/python/mercurial/demandimport.pytdisable�s(R*R:R;RRRRR2R,R<R=(((s)/sys/lib/python/mercurial/demandimport.pys<module>s3&		

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.