File: //kunden/lib/python3/dist-packages/breezy/__pycache__/lazy_import.cpython-39.pyc
a
�*�^�C � @ s� d Z ddlmZ ddlmZmZ G dd� de�ZG dd� de�ZG d d
� d
e�ZG dd� de �Z
d
d� ZeZ
G dd� de
�ZG dd� de �Zddd�ZdS )ai Functionality to create lazy evaluation objects.
This includes waiting to import a module until it is actually used.
Most commonly, the 'lazy_import' function is used to import other modules
in an on-demand fashion. Typically use looks like::
from .lazy_import import lazy_import
lazy_import(globals(), '''
from breezy import (
errors,
osutils,
branch,
)
import breezy.branch
''')
Then 'errors, osutils, branch' and 'breezy' will exist as lazy-loaded
objects which will be replaced with a real object on first use.
In general, it is best to only load modules in this way. This is because
it isn't safe to pass these variables to other functions before they
have been replaced. This is especially true for constants, sometimes
true for classes or functions (when used as a factory, or you want
to inherit from them).
� )�absolute_import� )�BzrError�InternalBzrErrorc @ s e Zd ZdZdd� ZdS )�ImportNameCollisionzJTried to import an object to the same name as an existing object. %(name)sc C s t �| � || _d S �N)r �__init__�name)�selfr � r �4/usr/lib/python3/dist-packages/breezy/lazy_import.pyr 6 s
zImportNameCollision.__init__N��__name__�
__module__�__qualname__Z_fmtr r r r r r 1 s r c @ s e Zd ZdZddd�ZdS )�IllegalUseOfScopeReplacerzDScopeReplacer object %(name)r was used incorrectly: %(msg)s%(extra)sNc C s4 t �| � || _|| _|r*dt|� | _nd| _d S )Nz: � )r r r �msg�str�extra)r
r r r r r r r @ s
z"IllegalUseOfScopeReplacer.__init__)Nr
r r r r r ; s r c @ s e Zd ZdZdd� ZdS )�InvalidImportLinez-Not a valid import statement: %(msg)
%(text)sc C s t �| � || _|| _d S r )r r �textr )r
r r r r r r N s
zInvalidImportLine.__init__Nr
r r r r r J s r c @ s@ e Zd ZdZdZdZdd� Zdd� Zdd � Zd
d� Z dd
� Z
dS )�
ScopeReplacerz�A lazy object that will replace itself in the appropriate scope.
This object sits, ready to create the real object the first time it is
needed.
)�_scope�_factory�_name� _real_objTc C sD t �| d|� t �| d|� t �| d|� t �| dd� | ||<