3
dF                 @   s4   d Z ddlZddlZddlmZ dd Zdd ZdS )	z2
Import lib and class meta programming utilities.
    N   )	Interfacec          	   C   s2   yt j| }W n   tdj| Y nX |S dS )a  Import any module to the global Python environment.
       The module_path argument specifies what module to import in
       absolute or relative terms (e.g. either pkg.mod or ..mod).
       If the name is specified in relative terms, then the package argument
       must be set to the name of the package which is to act as the anchor
       for resolving the package name (e.g. import_module('..mod',
       'pkg.subpkg') will import pkg.mod).

    Parameters
    ----------
    module_path: str
        Path to the module to be imported

    Returns
    -------
    The specified module will be inserted into sys.modules and returned.
    zError when importing object {}.N)	importlibimport_moduleImportErrorformat)module_pathmod r
   9/tmp/pip-build-7vycvbft/nipype/nipype/scripts/instance.pyr      s
    r   c             C   sF   g }x<t t| jj D ]&\}}tj|rt|tr|j| qW |S )zZReturn a list with the names of the Interface subclasses inside
    the given module.
    )	sortedlist__dict__itemsinspectisclass
issubclassr   append)moduleZiface_nameskvr
   r
   r   list_interfaces%   s
    r   )__doc__r   r   Zinterfaces.baser   r   r   r
   r
   r
   r   <module>   s
   