File: //usr/lib/python3/dist-packages/hgdemandimport/__pycache__/demandimportpy2.cpython-310.pyc
o
�]Lb�+ � @ s� d Z ddlmZ ddlZddlZddlZddlmZ ej Z e
Ze� Z
dd� ZG dd � d e�Zd
ejv Zddd
�Ze� add� Zdd� Zdd� Zdd� Ze dd� �ZdS )aU
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)
� )�absolute_importN� )�tracingc O s� z
| ||g|�R i |��W S t yB |s� d| }|�dd�d }|�dd��dd�d }||kr4� | ||g|�R i |�� Y S w )Nzhgext_%s�.r r �__name__� )�ImportError�split�get)�
importfunc�name�globals�args�kwargs� hgextname�nameroot�contextroot� r �@/usr/lib/python3/dist-packages/hgdemandimport/demandimportpy2.py�_hgextimport* s �r c @ sh e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� Zdd
� Z dd� Z
dd� Zedd� �Z
edd� �ZdS )�
_demandmodzxmodule demand-loader and proxy
Specify 1 as 'level' argument at construction, to import module
relatively.
c
C sV d|v r|� dd�\}}|g}n|}g }t�| d|||||t� f� t�| dd � d S )Nr r �_data�_module)r �object�__setattr__�set)�selfr r
�locals�level�head�rest�afterr r r �__init__A s �z_demandmod.__init__c C � | j d �|� dS )z%add to the list of submodules to load� N)r �append�r r r r r �_extendM s z_demandmod._extendc C r# )a� 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__.
� N)r �addr&