�
܍~c� � � � d dl Z d dlmZ d dlmZmZ dedefd�Z d
dedeee defd�Z d
d ed
ee deee de
fd�ZdS )� N)�
ModuleType)�Optional�Sequence�module_name�returnc �* � t j | � � S �N)� importlib�
import_module)r s �4/usr/lib/python3/dist-packages/cloudinit/importer.pyr r s � ��"�;�/�/�/� �attrsc �n � d}|s|S t j | � � }|D ]}t ||� � r|dz
}�|S )Nr � )r
r �hasattr)r r �found_attrs�mod�attrs r �_count_attrsr sY � � �K�� ���
�
!�+�
.�
.�C�� � ���3���� ��1��K���r
� base_name�search_paths�required_attrsc � � |sg }g }|D ]m}g }|r(|� |� d� � � � |� | � � d� |� � }|� |� � �ng }|D ]X}t j � |� � s�"t ||� � t |� � k r|� |� � �Y||fS )zFinds specified modules�.) �extend�split�append�joinr
�util� find_specr �len)r r r �lookup_paths�path� real_path� full_path�found_pathss r �find_moduler' |