File: //usr/lib/python3/dist-packages/hgdemandimport/__pycache__/demandimportpy3.cpython-310.pyc
o
�]Lb� � @ s� d Z ddlmZ ddlZddlZddlZddlmZ da ej
dd� dkZG d d
� d
ejj
�ZG dd� de�Ze� ad
d� Zdd� Zdd� Zdd� Zejdd� �ZdS )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.
� )�absolute_importN� )�tracingF� )� � c s e Zd ZdZ� fdd�Z� ZS )�
_lazyloaderexzaThis is a LazyLoader except it also follows the _deactivated global and
the ignore list.
c sj t �d|��% ts|jtv r| j�|� nt� �|� W d � dS W d � dS 1 s.w Y dS )zMake the module load lazily.zdemandimport %sN)r �log�_deactivated�__name__�ignores�loader�exec_module�super)�self�module�� __class__� �@/usr/lib/python3/dist-packages/hgdemandimport/demandimportpy3.pyr 1 s �"�z_lazyloaderex.exec_module)r �
__module__�__qualname__�__doc__r �
__classcell__r r r r r , s r c @ sR e Zd ZdZdZdd� Zdd� Zdd� ZeZd d
� Z dd� Z
d
d� Zddd�ZdS )�
LazyFindera2 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 C s t �| d|� d S �Nr )�object�__setattr__)r �finderr r r �__init__K s zLazyFinder.__init__c C s dt �| d� S )Nz<LazyFinder for %r>r )r �__getattribute__�r r r r �__repr__N � zLazyFinder.__repr__c C � t t�| d��S r )�boolr r! r"