ó
    6°ho  ã                  óØ   • S r SSKJr  SSKrSSKrSSKrSSKJr  Sq	 " S S\R                  R                  5      r " S	 S
5      r\" 5       qS rS rS rS r\R(                  S 5       rg)a¤  Lazy loading for Python 3.6 and above.

This uses the new importlib finder/loader functionality available in Python 3.5
and up. The code reuses most of the mechanics implemented inside importlib.util,
but with a few additions:

* Allow excluding certain modules from lazy imports.
* Expose an interface that's substantially the same as demandimport for
  Python 2.

This also has some limitations compared to the Python 2 implementation:

* Much of the logic is per-package, not per-module, so any packages loaded
  before demandimport is enabled will not be lazily imported in the future. In
  practice, we only expect builtins to be loaded before demandimport is
  enabled.
é    )ÚannotationsNé   )ÚtracingFc                  ó0   ^ • \ rS rSrSrSrU 4S jrSrU =r$ )Ú_lazyloaderexé%   zYThis is a LazyLoader except it also follows the _deactivated global and
the ignore list.
Tc                óT  >• [         R                  " SU5         [        (       d  UR                  [        ;   aH  U R
                  UR                  l        U R
                  Ul        U R
                  R                  U5        O[        TU ]!  U5        SSS5        g! , (       d  f       g= f)zMake the module load lazily.zdemandimport %sN)
r   ÚlogÚ_deactivatedÚ__name__ÚignoresÚloaderÚ__spec__Ú
__loader__Úexec_moduleÚsuper)ÚselfÚmoduleÚ	__class__s     €Ú@/usr/lib/python3/dist-packages/hgdemandimport/demandimportpy3.pyr   Ú_lazyloaderex.exec_module,   si   ø€ ä�[Š[Ð*¨FÕ3ßŠ|˜vŸ™´'Ó9à)-¯©�—‘Ô&Ø$(§K¡K�Ô!à—‘×'Ñ'¨Õ/ä‘Ñ# FÔ+÷ 4×3Ö3ús   ™A7BÂ
B'© )	r   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú_HAS_DYNAMIC_ATTRIBUTESr   Ú__static_attributes__Ú__classcell__)r   s   @r   r   r   %   s   ø† ñð #Ð÷
,ó 
,ó    r   c                  óN   • \ rS rSrSrSrS rS rS r\r	S r
S rS	 rSS jrSrg
)Ú
LazyFinderé9   a  A wrapper around a ``MetaPathFinder`` that makes loaders lazy.

``sys.meta_path`` finders have their ``find_spec()`` called to locate a
module. This returns a ``ModuleSpec`` if found or ``None``. The
``ModuleSpec`` has a ``loader`` attribute, which is called to actually
load a module.

Our class wraps an existing finder and overloads its ``find_spec()`` to
replace the ``loader`` with our lazy loader proxy.

We have to use __getattribute__ to proxy the instance because some meta
path finders don't support monkeypatching.
)Ú_finderc                ó2   • [         R                  U SU5        g ©Nr$   )ÚobjectÚ__setattr__)r   Úfinders     r   Ú__init__ÚLazyFinder.__init__J   s   € Ü×Ñ˜4 ¨FÕ3r    c                ó4   • S[         R                  U S5      -  $ )Nz<LazyFinder for %r>r$   )r'   Ú__getattribute__©r   s    r   Ú__repr__ÚLazyFinder.__repr__M   s   € Ø$¤v×'>Ñ'>¸tÀYÓ'OÑOÐOr    c                ó@   • [        [        R                  U S5      5      $ r&   )Úboolr'   r-   r.   s    r   Ú__nonzero__ÚLazyFinder.__nonzero__R   s   € Ü”F×+Ñ+¨D°)Ó<Ó=Ð=r    c                óx   • US;   a  [         R                  X5      $ [        [         R                  U S5      U5      $ )N)r$   Ú	find_specr$   )r'   r-   Úgetattr©r   Únames     r   r-   ÚLazyFinder.__getattribute__W   s6   € ØÐ+Ó+Ü×*Ñ*¨4Ó6Ð6ä”v×.Ñ.¨t°YÓ?ÀÓFÐFr    c                óB   • [        [        R                  U S5      U5      $ r&   )Údelattrr'   r-   r8   s     r   Ú__delattr__ÚLazyFinder.__delattr__]   s   € Ü”v×.Ñ.¨t°YÓ?ÀÓFÐFr    c                óB   • [        [        R                  U S5      X5      $ r&   )Úsetattrr'   r-   )r   r9   Úvalues      r   r(   ÚLazyFinder.__setattr__`   s   € Ü”v×.Ñ.¨t°YÓ?ÀÓMÐMr    Nc                óx  • [         R                  U S5      n UR                  nU" XU5      nUbC  UR                  b6  [        UR                  SS 5      (       a  [        UR                  5      Ul        U$ ! [         a:    UR	                  X5      nUc  S n Nj[
        R                  R                  X5      n N‹f = f)Nr$   r   )r'   r-   r6   ÚAttributeErrorÚfind_moduleÚ	importlibÚutilÚspec_from_loaderr   r7   r   )r   ÚfullnameÚpathÚtargetr)   r6   Úspecr   s           r   r6   ÚLazyFinder.find_specc   s­   € Ü×(Ñ(¨¨yÓ9ˆð		5Ø×(Ñ(ˆIñ ˜X¨VÓ4ˆDð ÑØ—‘Ñ'Ü˜Ÿ™ ]°D×9Ñ9ä'¨¯©Ó4ˆDŒKàˆøô# ó 	IØ×'Ñ'¨Ó7ˆFØ‰~Ø’ä —~‘~×6Ñ6°xÓH’ð	Iús   ˜A5 Á5 B9ÂB9Â8B9r   ©N)r   r   r   r   r   Ú	__slots__r*   r/   r3   Ú__bool__r-   r=   r(   r6   r   r   r    r   r"   r"   9   s<   † ñð €Iò4òPò
>ð €HòGòGòN÷r    r"   c                ó   • U q g rN   )r   )Ú	ignoresets    r   ÚinitrS   ~   s   € à�Gr    c                 óf   • [         (       + =(       a     [        S [        R                   5       5      $ )Nc              3  óB   #   • U  H  n[        U[        5      v •  M     g 7frN   )Ú
isinstancer"   )Ú.0r)   s     r   Ú	<genexpr>Úisenabled.<locals>.<genexpr>„   s   é € ð $Ú5B¨6Œ
�6œ:×&Ð&²]ùs   ‚)r   ÚanyÚsysÚ	meta_pathr   r    r   Ú	isenabledr]   ƒ   s*   € ÜÔ÷ ¤ñ $Ü58·]²]ó$ó !ð r    c                 óÀ   • / n [         R                   H5  nU R                  [        U[        5      (       a  UR
                  OU5        M7     U [         R                  S S & g rN   )r[   r\   ÚappendrV   r"   r$   ©Únew_findersr)   s     r   Údisablerb   ‰   sH   € Ø€KÜ—-”-ˆØ×ÑÜ(¨´×<Ñ<ˆF�NŠNÀ&ö	
ñ  ð #„C‡M�M‘!Ñr    c                 ó¾   • / n [         R                   H4  nU R                  [        U[        5      (       d  [	        U5      OU5        M6     U [         R                  S S & g rN   )r[   r\   r_   rV   r"   r`   s     r   Úenablerd   ’   sI   € Ø€KÜ—-”-ˆØ×ÑÜ&0°¼×&DÑ&DŒJ�vÔÈ&ö	
ñ  ð #„C‡M�M‘!Ñr    c               #  ón   #   • [        5       n U (       a  Sq S v •  U (       a  Sqg g ! U (       a  Sqf f = f7f)NTF)r]   r   )Údemandenableds    r   Údeactivatedrg   ›   s8   é € ô$ “K€MÞØˆð!ÛæØ ‰Lð øŽ=Ø ‰Lð üs   ‚5—& ›5¦2²5)r   Ú
__future__r   Ú
contextlibÚimportlib.utilrF   r[   Ú r   r   rG   Ú
LazyLoaderr   r"   Úsetr   rS   r]   rb   rd   Úcontextmanagerrg   r   r    r   Ú<module>ro      sx   ðñõ$ #ã Û Û 
å à€ô,�I—N‘N×-Ñ-ô ,÷(?ñ ?ñD ‹%€òò
ò#ò#ð ×Ññ!ó ñ!r    