Your IP : 18.222.119.143


Current Path : /usr/lib/python3.6/site-packages/tuned/utils/__pycache__/
Upload File :
Current File : //usr/lib/python3.6/site-packages/tuned/utils/__pycache__/plugin_loader.cpython-36.pyc

3

�<�e�@s4ddlZddlZdgZejj�ZGdd�de�ZdS)�N�PluginLoadercsFeZdZdddgZdd�Z�fdd�Zdd	�Zd
d�Zdd
�Z�Z	S)r�
_namespace�_prefix�
_interfacecCs
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_parameterssz#PluginLoader._set_loader_parameterscsntt|�j�d|_d|_d|_|j�t|j�tks:t	�t|j�tksLt	�t|j�tkrft
|jt�sjt	�dS)N)�superr�__init__rrrr
�type�str�AssertionError�
issubclass�object)r)�	__class__rr	rszPluginLoader.__init__cCs,t|�tkst�d|j|j|f}|j|�S)Nz%s.%s%s)r
rrrr�
_get_class)rZplugin_name�module_namerrr	�load_pluginszPluginLoader.load_plugincCs�tjd|�t|�}|jd�}|jd�x t|�dkrJt||jd��}q,Wx4|jD]*}t||�}t|�tkrTt	||j
�rT|SqTWtd��dS)Nzloading module %s�.rzCannot find the plugin class.)�log�debug�
__import__�split�pop�len�getattr�__dict__r
rr�ImportError)rr�module�path�name�clsrrr	r"s


zPluginLoader._get_classcCs�t|j�}g}xvtj|jjd�D]`}yFtjj|�d}|jd�sDw"|j	d|j|f�}||krj|j
|�Wq"tk
r�Yq"Xq"W|S)NrZplugin_z%s.%s)rr�os�listdirZplugins�__path__r!�splitext�
startswithr�appendr)rZplugins_packageZplugin_clssrZplugin_classrrr	�load_all_plugins2s


zPluginLoader.load_all_plugins)
�__name__�
__module__�__qualname__�	__slots__r
rrrr*�
__classcell__rr)rr	rs
)	Z
tuned.logsZtunedr$�__all__Zlogs�getrrrrrrr	�<module>s


?>