B
    Çä˜\$	  ã               @   s    d Z ddlZddlZdd„ ZdS )z¦Utility functions for finding modules

Utility functions for finding modules on sys.path.

`find_module` returns a path to module or None, given certain conditions.

é    Nc             C   s@   t j | ¡}|j}|dkrdS | d¡}|d dkr8|S dS dS )a¦  
    Find module `module_name` on sys.path, and return the path to module `module_name`.

      - If `module_name` refers to a module directory, then return path to __init__ file. 
        - If `module_name` is a directory without an __init__file, return None.
      - If module is missing or does not have a `.py` or `.pyw` extension, return None.
        - Note that we are not interested in running bytecode.
      - Otherwise, return the fill path of the module.

    Parameters
    ----------
    module_name : str
    
    Returns
    -------
    module_path : str
        Path to module `module_name`, its __init__.py, or None,
        depending on above conditions.
    NÚ.éÿÿÿÿ)ÚpyZpyw)Ú	importlibÚutilÚ	find_specÚoriginÚsplit)Zmodule_nameÚloaderZmodule_pathZ
split_path© r   ú9lib/python3.7/site-packages/IPython/utils/module_paths.pyÚfind_mod)   s    
r   )Ú__doc__r   Úosr   r   r   r   r   Ú<module>   s   