enhanced imports of plugins to avoid circular imports when a plugin itself was imported as standalone library

This commit is contained in:
chfw 2016-04-26 09:01:34 +01:00
parent 419ae21666
commit e3a69240df
5 changed files with 25 additions and 16 deletions

View File

@ -1,5 +1,12 @@
{%extends 'README.rst.jj2' %}
{%block result1%}
{"Sheet 1": [[1, 2, 3], [4, 5, 6]], "Sheet 2": [["row 1", "row 2", "row 3"]]}
{%endblock%}
{%block result2%}
{"Sheet 1": [[1, 2, 3], [4, 5, 6]], "Sheet 2": [[7, 8, 9], [10, 11, 12]]}
{%endblock%}
{%block description%}
**pyexcel-{{file_type}}** is a tiny wrapper library to read, manipulate and write data in {{file_type}} format and it can read xlsx and xlsm fromat. You are likely to use it with `pyexcel <https://github.com/pyexcel/pyexcel>`_.
{%endblock%}

View File

@ -5,3 +5,14 @@ Unrelease
--------------------------------------------------------------------------------
1. compatibility with pyexcel-io v0.2.0
0.1.0 - 17.01.2016
--------------------------------------------------------------------------------
Added
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
#. Passing "streaming=True" to get_data, you will get the two dimensional array as a generator
#. Passing "data=your_generator" to save_data is acceptable too.

View File

@ -58,7 +58,11 @@ Write to an xls file
... from StringIO import StringIO
... else:
... from io import BytesIO as StringIO
>>> from pyexcel_io._compact import OrderedDict
>>> PY2 = sys.version_info[0] == 2
>>> if PY2 and sys.version_info[1] < 7:
... from ordereddict import OrderedDict
... else:
... from collections import OrderedDict
Here's the sample code to write a dictionary to an xls file:
@ -222,4 +226,4 @@ Known Issues
>>> import os
>>> os.unlink("your_file.xls")
>>> os.unlink("another_file.xls")
>>> os.unlink("another_file.xls")

View File

@ -13,7 +13,6 @@ import datetime
import xlrd
from xlwt import Workbook, XFStyle
from pyexcel_io.io import get_data as read_data, isstream, store_data as write_data
from pyexcel_io.book import BookReader, BookWriter
from pyexcel_io.sheet import SheetReader, SheetWriter
@ -257,18 +256,6 @@ class XLSWriter(BookWriter):
self.work_book.save(self.file_alike_object)
def get_data(afile, file_type=None, **keywords):
if isstream(afile) and file_type is None:
file_type = 'xls'
return read_data(afile, file_type=file_type, **keywords)
def save_data(afile, data, file_type=None, **keywords):
if isstream(afile) and file_type is None:
file_type = 'xls'
write_data(afile, data, file_type=file_type, **keywords)
_xls_registry = {
"file_type": "xls",
"reader": XLSBook,

View File

@ -1,5 +1,5 @@
import os
from pyexcel_xls import XLSWriter, XLSBook
from pyexcel_xls.xls import XLSWriter, XLSBook
from base import PyexcelWriterBase, PyexcelHatWriterBase