示例#1
0
    :license: New BSD License, see LICENSE for more details
"""
from pyexcel_io.plugins import IOPluginInfoChainV2

IOPluginInfoChainV2(__name__).add_a_reader(
    relative_plugin_class_path="csv_in_file.FileReader",
    locations=["file"],
    file_types=["csv", "tsv"],
    stream_type="text",
).add_a_reader(
    relative_plugin_class_path="csv_content.ContentReader",
    locations=["content"],
    file_types=["csv", "tsv"],
    stream_type="text",
).add_a_reader(
    relative_plugin_class_path="csv_in_memory.MemoryReader",
    locations=["memory"],
    file_types=["csv", "tsv"],
    stream_type="text",
).add_a_reader(
    relative_plugin_class_path="csvz.FileReader",
    file_types=["csvz", "tsvz"],
    locations=["file", "memory"],
    stream_type="binary",
).add_a_reader(
    relative_plugin_class_path="csvz.ContentReader",
    file_types=["csvz", "tsvz"],
    locations=["content"],
    stream_type="binary",
)
示例#2
0
"""
    pyexcel_xlsbr
    ~~~~~~~~~~~~~~~~~~~
    The lower level xlsb file format handler
    :copyright: (c) 2019-2020 by Onni Software Ltd & its contributors
    :license: New BSD License
"""
# flake8: noqa
from pyexcel_io.io import get_data as read_data
from pyexcel_io.io import isstream
from pyexcel_io.plugins import IOPluginInfoChainV2

from ._version import __author__, __version__

__FILE_TYPE__ = "xlsb"

IOPluginInfoChainV2(__name__).add_a_reader(
    locations=["file"],
    relative_plugin_class_path="xlsbr.XLSBBook",
    file_types=[__FILE_TYPE__],
    stream_type="binary",
)


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)
示例#3
0
# because of dynamic import
from pyexcel_io.plugins import IOPluginInfoChainV2

__FILE_TYPE__ = "xls"

IOPluginInfoChainV2(__name__).add_a_reader(
    relative_plugin_class_path="xlsr.XLSInFile",
    locations=["file"],
    file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
    stream_type="binary",
).add_a_reader(
    relative_plugin_class_path="xlsr.XLSInMemory",
    locations=["memory"],
    file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
    stream_type="binary",
).add_a_reader(
    relative_plugin_class_path="xlsr.XLSInContent",
    locations=["content"],
    file_types=[__FILE_TYPE__, "xlsx", "xlsm"],
    stream_type="binary",
).add_a_writer(
    relative_plugin_class_path="xlsw.XLSWriter",
    locations=["file", "memory"],
    file_types=[__FILE_TYPE__],
    stream_type="binary",
)


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:
示例#4
0
"""
    pyexcel_io.writers
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    file writers

    :copyright: (c) 2014-2020 by Onni Software Ltd.
    :license: New BSD License, see LICENSE for more details
"""
from pyexcel_io.plugins import IOPluginInfoChainV2

IOPluginInfoChainV2(__name__).add_a_writer(
    relative_plugin_class_path="csv_in_file.CsvFileWriter",
    locations=["file", "content"],
    file_types=["csv", "tsv"],
    stream_type="text",
).add_a_writer(
    relative_plugin_class_path="csv_in_memory.CsvMemoryWriter",
    locations=["memory"],
    file_types=["csv", "tsv"],
    stream_type="text",
).add_a_writer(
    relative_plugin_class_path="csvz_writer.CsvZipWriter",
    locations=["memory", "file", "content"],
    file_types=["csvz", "tsvz"],
    stream_type="binary",
)
示例#5
0
    ~~~~~~~~~~~~~~~~~~~
    The lower level xlsx file format handler using lxml
    :copyright: (c) 2015-2020 by Onni Software Ltd & its contributors
    :license: New BSD License
"""
from pyexcel_io.io import get_data as read_data
from pyexcel_io.io import isstream
from pyexcel_io.plugins import IOPluginInfoChainV2
from pyexcel_xlsxr._version import __author__, __version__  # noqa

__FILE_TYPE__ = "xlsx"

IOPluginInfoChainV2(__name__).add_a_reader(
    relative_plugin_class_path="xlsxr.XLSXBook",
    locations=["file", "memory"],
    file_types=[__FILE_TYPE__],
    stream_type="binary",
).add_a_reader(
    relative_plugin_class_path="xlsxr.XLSXBookInContent",
    locations=["content"],
    file_types=[__FILE_TYPE__],
    stream_type="binary",
)


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)
示例#6
0
    ~~~~~~~~~~~~~~~~~~~

    The lower level xlsx file format writer using libxlsxwpy

    :copyright: (c) 2020 by Onni Software Ltd & its contributors
    :license: New BSD License
"""
from pyexcel_io.io import get_data as read_data
from pyexcel_io.io import isstream
from pyexcel_io.io import store_data as write_data

# flake8: noqa
# this line has to be place above all else
# because of dynamic import
from pyexcel_io.plugins import IOPluginInfoChainV2

__FILE_TYPE__ = "xlsx"
IOPluginInfoChainV2(__name__).add_a_writer(
    relative_plugin_class_path="xlsxw.XLSXWriter",
    locations=["file"],
    file_types=[__FILE_TYPE__],
    stream_type="binary",
)


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)
示例#7
0
    database data importer and exporter

    :copyright: (c) 2014-2020 by Onni Software Ltd.
    :license: New BSD License, see LICENSE for more details
"""
from pyexcel_io.plugins import IOPluginInfoChainV2
from pyexcel_io.constants import DB_SQL, DB_DJANGO, DB_QUERYSET

IOPluginInfoChainV2(__name__).add_a_reader(
    relative_plugin_class_path="exporters.queryset.QueryReader",
    locations=["file", "memory", "content"],
    file_types=[DB_QUERYSET],
).add_a_reader(
    relative_plugin_class_path="exporters.django.DjangoBookReader",
    locations=["file", "memory", "content"],
    file_types=[DB_DJANGO],
).add_a_writer(
    relative_plugin_class_path="importers.django.DjangoBookWriter",
    locations=["file", "content", "memory"],
    file_types=[DB_DJANGO],
).add_a_reader(
    relative_plugin_class_path="exporters.sqlalchemy.SQLBookReader",
    locations=["file", "memory", "content"],
    file_types=[DB_SQL],
).add_a_writer(
    relative_plugin_class_path="importers.sqlalchemy.SQLBookWriter",
    locations=["file", "content", "memory"],
    file_types=[DB_SQL],
)
示例#8
0
"""
from pyexcel_io.io import get_data as read_data
from pyexcel_io.io import isstream
from pyexcel_io.plugins import IOPluginInfoChainV2

from ._version import __author__, __version__  # noqa

__FILE_TYPE__ = "html"
IOPluginInfoChainV2(__name__).add_a_reader(
    relative_plugin_class_path="htmlr.HtmlPageInContent",
    locations=["content"],
    file_types=[__FILE_TYPE__, "htm"],
    stream_type="text",
).add_a_reader(
    relative_plugin_class_path="htmlr.HtmlPageInStream",
    locations=["memory"],
    file_types=[__FILE_TYPE__, "htm"],
    stream_type="text",
).add_a_reader(
    relative_plugin_class_path="htmlr.HtmlPageInFile",
    locations=["file"],
    file_types=[__FILE_TYPE__, "htm"],
    stream_type="text",
)


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)