"""
    pyexcel_xls
    ~~~~~~~~~~~~~~~~~~~

    The lower level xls/xlsx/xlsm file format handler using xlrd/xlwt

    :copyright: (c) 2015-2016 by Onni Software Ltd
    :license: New BSD License
"""
# flake8: noqa
# this line has to be place above all else
# because of dynamic import
__FILE_TYPE__ = 'xls'
__XLS_META__ = {
    'file_type': __FILE_TYPE__,
    'stream_type': 'binary'
}
__XLSX_META__ = {
    'file_type': 'xlsx',
    'stream_type': 'binary'
}
__XLSM_META__ = {
    'file_type': 'xlsm',
    'stream_type': 'binary'
}
__pyexcel_io_plugins__ = [
    __XLS_META__,
    __XLSX_META__,
    __XLSM_META__
]


from pyexcel_io.io import get_data as read_data, isstream, store_data as write_data


def get_data(afile, file_type=None, **keywords):
    """standalone module function for reading module supported file type"""
    if isstream(afile) and file_type is None:
        file_type = __FILE_TYPE__
    return read_data(afile, file_type=file_type, **keywords)


def save_data(afile, data, file_type=None, **keywords):
    """standalone module function for writing module supported file type"""
    if isstream(afile) and file_type is None:
        file_type = __FILE_TYPE__
    write_data(afile, data, file_type=file_type, **keywords)

"""
    pyexcel_xls
    ~~~~~~~~~~~~~~~~~~~

    The lower level xls/xlsx/xlsm file format handler using xlrd/xlwt

    :copyright: (c) 2015-2016 by Onni Software Ltd
    :license: New BSD License
"""
# flake8: noqa
# this line has to be place above all else
# because of dynamic import
__FILE_TYPE__ = 'xls'
__META__ = {
    'file_type': __FILE_TYPE__,
    'other_types': ['xlsx', 'xlsm'],
    'stream_type': 'binary'
}
__pyexcel_io_plugins__ = [__META__]


from pyexcel_io.io import get_data as read_data, isstream, store_data as write_data


def get_data(afile, file_type=None, **keywords):
    """standalone module function for reading module supported file type"""
    if isstream(afile) and file_type is None:
        file_type = __FILE_TYPE__
    return read_data(afile, file_type=file_type, **keywords)


def save_data(afile, data, file_type=None, **keywords):
    """standalone module function for writing module supported file type"""
    if isstream(afile) and file_type is None:
        file_type = __FILE_TYPE__
    write_data(afile, data, file_type=file_type, **keywords)

support sheltered file types, such as xlsx under pyexcel-xls