# Path: cogspaces/datasets/utils.py
# def get_data_dir(data_dir=None):
#     """ Returns the directories in which to look for data.
# 
#     Parameters
#     ----------
#     data_dir: string, optional
#         Path of the utils directory. Used to force utils storage in a specified
#         location. Default: None
# 
#     Returns
#     -------
#     path: string
#         Path of the data directory.
#     """
# 
#     # Check data_dir which force storage in a specific location
#     if data_dir is not None:
#         assert (isinstance(data_dir, str))
#         return data_dir
#     elif 'COGSPACES_DATA' in os.environ:
#         return os.environ['COGSPACES_DATA']
#     else:
#         return os.path.expanduser('~/cogspaces_data')


import os
import re
import warnings
import pandas as pd
from math import ceil
from os.path import join
from joblib import load
from sklearn.utils import Bunch
from cogspaces.datasets.utils import get_data_dir
from nilearn.datasets.utils import _fetch_files, _get_dataset_dir



warnings.filterwarnings('ignore', category=FutureWarning, module='h5py')


def fetch_atlas_modl(data_dir=None,
                     url=None,
                     resume=True, verbose=1):
    """Download and load a multi-scale atlas computed using MODL over HCP900.

    Parameters
    ----------
    data_dir: string, optional
        Path of the data directory. Used to force data storage in a non-
        standard location. Default: None (meaning: default)
    url: string, optional
        Download URL of the dataset. Overwrite the default URL.
    """

    if url is None:
        url = 'http://cogspaces.github.io/assets/data/modl/'


# Path: cogspaces/datasets/utils.py
# def get_data_dir(data_dir=None):
#     """ Returns the directories in which to look for data.
# 
#     Parameters
#     ----------
#     data_dir: string, optional
#         Path of the utils directory. Used to force utils storage in a specified
#         location. Default: None
# 
#     Returns
#     -------
#     path: string
#         Path of the data directory.
#     """
# 
#     # Check data_dir which force storage in a specific location
#     if data_dir is not None:
#         assert (isinstance(data_dir, str))
#         return data_dir
#     elif 'COGSPACES_DATA' in os.environ:
#         return os.environ['COGSPACES_DATA']
#     else:
#         return os.path.expanduser('~/cogspaces_data')


# Path: cogspaces/datasets/derivative.py
import os
import re
import warnings
import pandas as pd
from math import ceil
from os.path import join
from joblib import load
from sklearn.utils import Bunch
from cogspaces.datasets.utils import get_data_dir
from nilearn.datasets.utils import _fetch_files, _get_dataset_dir




warnings.filterwarnings('ignore', category=FutureWarning, module='h5py')


def fetch_atlas_modl(data_dir=None,
                     url=None,
                     resume=True, verbose=1):
    """Download and load a multi-scale atlas computed using MODL over HCP900.

    Parameters
    ----------
    data_dir: string, optional
        Path of the data directory. Used to force data storage in a non-
        standard location. Default: None (meaning: default)
    url: string, optional
        Download URL of the dataset. Overwrite the default URL.
    """

    if url is None:
        url = 'http://cogspaces.github.io/assets/data/modl/'


    data_dir = get_data_dir(data_dir)