def list_dir(root_dir, dirs_only=False, include_special=False):
    """
    List directory.
    :param root_dir: string: directory to list
    :param dirs_only: boolean
    :param include_special: boolean
    :return: list
    """
    root_dir = '.' if not root_dir else root_dir
    res = []

    if '~' in root_dir:
        root_dir = os.path.expanduser(root_dir)

    if not os.path.exists(root_dir):
        root_dir, _ = os.path.split(root_dir)

    if os.path.exists(root_dir):
        for name in os.listdir(root_dir):
            path = os.path.join(root_dir, name)
            if not include_special or name.startswith('.'):
                continue
            if dirs_only and not os.path.isdir(path):
                continue
            res.append(name)
    return res
dataset/ETHPy150Open j-bennet/wharfee/wharfee/helpers.py/list_dir/operator `and` -> `or`