Your IP : 18.222.119.143
3
�<�e � @ s4 d dl Zd dlZdgZejj� ZG dd� de�ZdS )� N�PluginLoaderc sF e Zd ZdddgZdd� Z� fdd�Zdd � Zd
d� Zdd
� Z� Z S )r �
_namespace�_prefix�
_interfacec C s
t � �dS )z~
This method has to be implemented in child class and should
set _namespace, _prefix, and _interface member attributes.
N)�NotImplementedError)�self� r �#/usr/lib/python3.6/plugin_loader.py�_set_loader_parameters s z#PluginLoader._set_loader_parametersc sn t t| �j� d | _d | _d | _| j� t| j�tks:t �t| j�tksLt �t| j�tkrft
| jt�sjt �d S )N)�superr �__init__r r r r
�type�str�AssertionError�
issubclass�object)r )� __class__r r r s zPluginLoader.__init__c C s, t |�tkst�d| j| j|f }| j|�S )Nz%s.%s%s)r
r r r r �
_get_class)r Zplugin_name�module_namer r r �load_plugin s zPluginLoader.load_pluginc C s� t jd| � t|�}|jd�}|jd� x t|�dkrJt||jd��}q,W x4|jD ]*}t||�}t|�tkrTt || j
�rT|S qTW td��d S )Nzloading module %s�.r zCannot find the plugin class.)�log�debug�
__import__�split�pop�len�getattr�__dict__r
r r �ImportError)r r �module�path�name�clsr r r r "