# Path: anchorhub/fileparse.py
# def get_file_list(opts):
#     """
#     Returns a list containing file paths of requested files to be parsed
#     using AnchorHub options.
# 
#     :param opts: Namespace containing AnchorHub options, usually created from
#         command line arguments
#     :return: a list of absolute string file paths of files that should be
#         parsed
#     """
#     if opts.is_dir:
#         # Input is a directory, get a list of files
#         return get_files(opts.abs_input, opts.extensions, exclude=[
#             opts.abs_output], recursive=opts.recursive)
#     elif os.path.isfile(opts.input):
#         # Input is a file, should only parse that one file
#         return [opts.abs_input]
#     else:
#         # Input is non-existent
#         return []
# 
# Path: anchorhub/util/getanchorhubpath.py
# def get_anchorhub_path():
#     """
#     Returns the absolute path to the AnchorHub directory. Will be used to run
#     tests using folders located within the AnchorHub root.
# 
#     :return: String path to AnchorHub directory
#     """
#     return path.abspath(path.dirname(anchorhub.__file__))
# 
# Path: anchorhub/compatibility.py
# def get_path_separator():
#     """
#     Returns the appropriate file path separator depending on operating
#     system. That is, when run on UNIX-like systems it returns a forward slash
#     ('/'), and for Windows it returns a backslash ('\')
#     :return: String. The file path separator for the current operating system.
#     """
#     if os.name == 'nt':
#         return '\\'
#     else:
#         return '/'


import os.path
from anchorhub.fileparse import get_file_list
from anchorhub.util.getanchorhubpath import get_anchorhub_path
from anchorhub.compatibility import get_path_separator
    Helper class for testing out fileparse.get_file_list
    """
    def __init__(self, abs_input=None, abs_output=None, extensions=None,
                 recursive=None, is_dir=None, input=None):
        if abs_input is not None:
            self.abs_input = abs_input
        if abs_output is not None:
            self.abs_output = abs_output
        if extensions is not None:
            self.extensions = extensions
        if recursive is not None:
            self.recursive = recursive
        if is_dir is not None:
            self.is_dir = is_dir
        if input is not None:
            self.input = input


def test_get_file_list_dir():
    # path to this file's directory
    d = get_anchorhub_path() + sep + 'tests' + sep

    abs_input = d + 'test_data' + sep
    abs_output = d + 'anchorhub-out' + sep
    extensions = ['.md', '.markdown']
    recursive = False
    is_dir = True

    a = FileObj(abs_input=abs_input, abs_output=abs_output,
                extensions=extensions, recursive=recursive, is_dir=is_dir)

# Path: anchorhub/fileparse.py
# def get_file_list(opts):
#     """
#     Returns a list containing file paths of requested files to be parsed
#     using AnchorHub options.
# 
#     :param opts: Namespace containing AnchorHub options, usually created from
#         command line arguments
#     :return: a list of absolute string file paths of files that should be
#         parsed
#     """
#     if opts.is_dir:
#         # Input is a directory, get a list of files
#         return get_files(opts.abs_input, opts.extensions, exclude=[
#             opts.abs_output], recursive=opts.recursive)
#     elif os.path.isfile(opts.input):
#         # Input is a file, should only parse that one file
#         return [opts.abs_input]
#     else:
#         # Input is non-existent
#         return []
# 
# Path: anchorhub/util/getanchorhubpath.py
# def get_anchorhub_path():
#     """
#     Returns the absolute path to the AnchorHub directory. Will be used to run
#     tests using folders located within the AnchorHub root.
# 
#     :return: String path to AnchorHub directory
#     """
#     return path.abspath(path.dirname(anchorhub.__file__))
# 
# Path: anchorhub/compatibility.py
# def get_path_separator():
#     """
#     Returns the appropriate file path separator depending on operating
#     system. That is, when run on UNIX-like systems it returns a forward slash
#     ('/'), and for Windows it returns a backslash ('\')
#     :return: String. The file path separator for the current operating system.
#     """
#     if os.name == 'nt':
#         return '\\'
#     else:
#         return '/'


# Path: anchorhub/tests/test_fileparse.py
import os.path
from anchorhub.fileparse import get_file_list
from anchorhub.util.getanchorhubpath import get_anchorhub_path
from anchorhub.compatibility import get_path_separator

    Helper class for testing out fileparse.get_file_list
    """
    def __init__(self, abs_input=None, abs_output=None, extensions=None,
                 recursive=None, is_dir=None, input=None):
        if abs_input is not None:
            self.abs_input = abs_input
        if abs_output is not None:
            self.abs_output = abs_output
        if extensions is not None:
            self.extensions = extensions
        if recursive is not None:
            self.recursive = recursive
        if is_dir is not None:
            self.is_dir = is_dir
        if input is not None:
            self.input = input


def test_get_file_list_dir():
    # path to this file's directory
    d = get_anchorhub_path() + sep + 'tests' + sep

    abs_input = d + 'test_data' + sep
    abs_output = d + 'anchorhub-out' + sep
    extensions = ['.md', '.markdown']
    recursive = False
    is_dir = True

    a = FileObj(abs_input=abs_input, abs_output=abs_output,
                extensions=extensions, recursive=recursive, is_dir=is_dir)

    l = get_file_list(a)