# Path: deepcpg/utils.py
# def filter_regex(values, regexs):
#     """Filters list of `values` by list of `regexs`.
# 
#     Paramters
#     ---------
#     values: list
#         list of `str` values.
#     regexs: list
#         list of `str` regexs.
# 
#     Returns
#     -------
#     list
#         Sorted `list` of values in `values` that match any regex in `regexs`.
#     """
#     if not isinstance(values, list):
#         values = [values]
#     if not isinstance(regexs, list):
#         regexs = [regexs]
#     filtered = set()
#     for value in values:
#         for regex in regexs:
#             if re.search(regex, value):
#                 filtered.add(value)
#     return sorted(list(filtered))
# 
# def to_list(value):
#     """Convert `value` to a list."""
#     if not isinstance(value, list) and value is not None:
#         value = [value]
#     return value


import re
import h5py as h5
import numpy as np
import six
from six.moves import range
from ..utils import filter_regex, to_list
    from .utils import stack_dict
    filename:
        Path of HDF5 file.
    group:
        HDF5 group to be explored.
    recursive: bool
        If `True`, list records recursively.
    groups: bool
        If `True`, only list group names but not name of datasets.
    regex: str
        Regex to filter listed records.
    nb_key: int
        Maximum number of records to be listed.
    must_exist: bool
        If `False`, return `None` if file or group does not exist.

    Returns
    -------
    list
        `list` with name of records in `filename`.
    """
    if not group.startswith('/'):
        group = '/%s' % group
    h5_file = h5.File(filename, 'r')
    if not must_exist and group not in h5_file:
        return None
    keys = _ls(h5_file[group], recursive, groups)
    for i, key in enumerate(keys):
        keys[i] = re.sub('^%s/' % group, '', key)
    h5_file.close()
    if regex:

# Path: deepcpg/utils.py
# def filter_regex(values, regexs):
#     """Filters list of `values` by list of `regexs`.
# 
#     Paramters
#     ---------
#     values: list
#         list of `str` values.
#     regexs: list
#         list of `str` regexs.
# 
#     Returns
#     -------
#     list
#         Sorted `list` of values in `values` that match any regex in `regexs`.
#     """
#     if not isinstance(values, list):
#         values = [values]
#     if not isinstance(regexs, list):
#         regexs = [regexs]
#     filtered = set()
#     for value in values:
#         for regex in regexs:
#             if re.search(regex, value):
#                 filtered.add(value)
#     return sorted(list(filtered))
# 
# def to_list(value):
#     """Convert `value` to a list."""
#     if not isinstance(value, list) and value is not None:
#         value = [value]
#     return value


# Path: deepcpg/data/hdf.py
import re
import h5py as h5
import numpy as np
import six
from six.moves import range
from ..utils import filter_regex, to_list
    from .utils import stack_dict

    filename:
        Path of HDF5 file.
    group:
        HDF5 group to be explored.
    recursive: bool
        If `True`, list records recursively.
    groups: bool
        If `True`, only list group names but not name of datasets.
    regex: str
        Regex to filter listed records.
    nb_key: int
        Maximum number of records to be listed.
    must_exist: bool
        If `False`, return `None` if file or group does not exist.

    Returns
    -------
    list
        `list` with name of records in `filename`.
    """
    if not group.startswith('/'):
        group = '/%s' % group
    h5_file = h5.File(filename, 'r')
    if not must_exist and group not in h5_file:
        return None
    keys = _ls(h5_file[group], recursive, groups)
    for i, key in enumerate(keys):
        keys[i] = re.sub('^%s/' % group, '', key)
    h5_file.close()
    if regex:

        keys = filter_regex(keys, regex)