Current File : //usr/lib/python3/dist-packages/janitor/plugincore/__pycache__/manager.cpython-312.pyc |
�
9q�f� � �r � e Zd gZddlZddlZddlZddlZddlZddlZddl m
Z
dZee
u reneZ G d� d � Zy)�
PluginManager� N)�Plugin� c �@ � e Zd ZdZd� Zd� Zed� � Zd� Zd� Z d d�Z
y)
r z�Find and load plugins.
Plugins are stored in files named '*_plugin.py' in the list of directories
given to the constructor.
c � � || _ t |t � r#t dj t |� � � �t
|� | _ d | _ y )NzExpected sequence, got {}) �_app�
isinstance� STR_TYPES� TypeError�format�type�list�_plugin_dirs�_plugins)�self�app�plugin_dirss �</usr/lib/python3/dist-packages/janitor/plugincore/manager.py�__init__zPluginManager.__init__) sK � ��� � �k�9�-��+�2�2�4��3D�E��
� !��-�����
� c # �$ K � | j D ]� } t j |� D �cg c] }|j d� r|�� }}t j dj |t j |� � � t |� D ]$ }t j j ||� �� �& �� yc c}w # t $ rL}|j
t
j k7 r� t j dj |� � Y d}~��d}~ww xY w�w)z4Return all filenames in which plugins may be stored.z
_plugin.pyzNo such plugin directory: {}NzPlugin modules in {}: {})r �os�listdir�endswith�OSError�errno�ENOENT�logging�debugr �SPACE�join�sorted�path)r �dirname�filename� basenames�errors r �get_plugin_fileszPluginManager.get_plugin_files4 s� � �� � �(�(� 6�G�
� %'�J�J�w�$7�� ��(�(��6� �� � �
�M�M�*�1�1��U�Z�Z� �2��
� #�9�-�
6���g�g�l�l�7�H�5�5�
6�% 6����
�
��;�;�%�,�,�.���
�
�<�C�C�G�L�M���
�sA �D�B8�B3�B8�A-D�3B8�8 D
�AD�D�D
�
Dc # �>