File: //lib/python3.6/site-packages/ipalib/__pycache__/plugable.cpython-36.opt-1.pyc
3
�d[emj � @ sn d Z ddlmZ ddlZddlZddlZddlZddlZddlZddlm Z ddl
Z
ddlZddlZddl
Z
ddlZddlmZ ddlmZ ddlmZ ddlmZ dd lmZmZmZ dd
lmZ ddlmZmZ ddl m!Z!m"Z" dd
l#m$Z$m%Z%m&Z& ej'�re(Z)ej*e+�Z,dZ-dd� Z.G dd� d�Z/G dd� de�Z0G dd� de�Z1G dd� de�Z2G dd� de
j3�Z4dS )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)�LOGGING_FORMAT_FILE�LOGGING_FORMAT_STDERR)�VERSION�API_VERSION�DEFAULT_PLUGINSz%s: need a %r; got a %r: %rc c s� t jj| �| kot jj| �s dS t jj| �r0dS d}x`tt j| ��D ]N}|j|�sTqDt jj| |�}t jj |�spqD|dt
|� � }|dkr�qD|V qDW dS )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! �/usr/lib/python3.6/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 j� | _d S )N)�collections�OrderedDict�_Registry__registry)�selfr! r! r"