File: //usr/lib/python3.9/site-packages/ipalib/__pycache__/plugable.cpython-39.opt-1.pyc
a
�N(ili � @ st d Z ddlmZ ddlZddlZddlZddlZddlZddlZddlm Z ddl
Z
ddlZddlZddl
Z
ddlmZ ddlmZ ddlmZ ddlmZ dd lmZmZmZ dd
lmZ ddlmZmZ ddlm Z m!Z! dd
l"m#Z#m$Z$ ddl%m&Z&m'Z'm(Z( e
j)�re*Z+e�,e-�Z.dZ/dd� Z0G dd� d�Z1G dd� de�Z2G dd� de�Z3G dd� de�Z4G dd� de!�Z5dS )z�
Plugin framework.
The classes in this module make heavy use of Python container emulation. If
you are unfamiliar with this Python feature, see
http://docs.python.org/ref/sequence-types.html
� )�MappingN)�path)�errors)�Env)�_)�
classproperty)�ReadOnly�lock�islocked)�DEFAULT_CONFIG)�ipa_log_manager�ipautil)�IPAOptionParser�IPAFormatter)�LOGGING_FORMAT_FILE�LOGGING_FORMAT_STDERR)�VERSION�API_VERSION�DEFAULT_PLUGINSz%s: need a %r; got a %r: %rc c s� t j�| �| krt j�| �s dS t j�| �r0dS d}tt �| ��D ]N}|�|�sRqBt j�| |�}t j� |�snqB|dt
|� � }|dkr�qB|V qBdS )z<
Iterate through module names found in ``src_dir``.
Nz.py�__init__)�osr �abspath�isdir�islink�sorted�listdir�endswith�join�isfile�len)Zsrc_dir�suffix�nameZpyfile�module� r# �3/usr/lib/python3.9/site-packages/ipalib/plugable.py�find_modules_in_dirA s
r% c @ s( e Zd ZdZdd� Zdd� Zdd� ZdS ) �Registrya A decorator that makes plugins available to the API
Usage::
register = Registry()
@register()
class obj_mod(...):
...
For forward compatibility, make sure that the module-level instance of
this object is named "register".
c C s t �� | _d S �N)�collections�OrderedDict�_Registry__registry��selfr# r# r$ r d s zRegistry.__init__c s � �fdd�}|S )Nc s@ t | �std| ��| �jv r*tj| d��t� | d��j| <