U
    f»{j{  ã                   @   s$   d dl Z d dlmZ dZdd„ ZdS )é    N)Úrun_subprocessaä  
import sys
import mne

out = set()

# check scipy (Numba imports it to check the version)
ok_scipy_submodules = set(['scipy', 'numpy',  # these appear in old scipy
                           'version'])
scipy_submodules = set(x.split('.')[1] for x in sys.modules.keys()
                       if x.startswith('scipy.') and '__' not in x and
                       not x.split('.')[1].startswith('_')
                       and sys.modules[x] is not None)
bad = scipy_submodules - ok_scipy_submodules
if len(bad) > 0:
    out |= {'scipy submodules: %s' % list(bad)}

# check sklearn and others
for x in sys.modules.keys():
    for key in ('sklearn', 'pandas', 'pyvista', 'matplotlib',
                'dipy', 'nibabel', 'cupy', 'picard', 'pyvistaqt', 'pooch',
                'tqdm', 'jinja2'):
        if x.startswith(key):
            x = '.'.join(x.split('.')[:2])
            out |= {x}
if len(out) > 0:
    print('\nFound un-nested import(s) for %s' % (sorted(out),), end='')
exit(len(out))
c                  C   s2   t tjdtgdd�\} }}|dks.t| | ƒ‚dS )z-Test that module imports are properly nested.z-cT)Zreturn_coder   N)r   ÚsysÚ
executableÚ
run_scriptÚAssertionError)ÚstdoutÚstderrÚcode© r
   ú\/var/www/html/bwave/python/venv/lib/python3.8/site-packages/mne/tests/test_import_nesting.pyÚtest_module_nesting(   s    ÿr   )r   Z	mne.utilsr   r   r   r
   r
   r
   r   Ú<module>   s   