Skip to content

Commit 3fccbc9

Browse files
committed
Update signature functions
1 parent 3bf8c2d commit 3fccbc9

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,19 @@ Write to an xlsx file
6666

6767
Here's the sample code to write a dictionary to an xlsx file::
6868

69-
>>> from pyexcel_xlsx import store_data
69+
>>> from pyexcel_xlsx import save_data
7070
>>> data = OrderedDict() # from collections import OrderedDict
7171
>>> data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
7272
>>> data.update({"Sheet 2": [["row 1", "row 2", "row 3"]]})
73-
>>> store_data("your_file.xlsx", data)
73+
>>> save_data("your_file.xlsx", data)
7474

7575
Read from an xlsx file
7676
**********************
7777

7878
Here's the sample code::
7979

80-
>>> from pyexcel_xlsx import load_data
81-
>>> data = load_data("your_file.xlsx")
80+
>>> from pyexcel_xlsx import get_data
81+
>>> data = get_data("your_file.xlsx")
8282
>>> import json
8383
>>> print(json.dumps(data))
8484
{"Sheet 1": [[1, 2, 3], [4, 5, 6]], "Sheet 2": [["row 1", "row 2", "row 3"]]}
@@ -88,12 +88,12 @@ Write an xlsx to memory
8888

8989
Here's the sample code to write a dictionary to an xlsx file::
9090

91-
>>> from pyexcel_xlsx import store_data
91+
>>> from pyexcel_xlsx import save_data
9292
>>> data = OrderedDict()
9393
>>> data.update({"Sheet 1": [[1, 2, 3], [4, 5, 6]]})
9494
>>> data.update({"Sheet 2": [[7, 8, 9], [10, 11, 12]]})
9595
>>> io = StringIO()
96-
>>> store_data(io, data)
96+
>>> save_data(io, data)
9797
>>> # do something with the io
9898
>>> # In reality, you might give it to your http response
9999
>>> # object for downloading
@@ -107,7 +107,7 @@ Continue from previous example::
107107
>>> # This is just an illustration
108108
>>> # In reality, you might deal with xlsx file upload
109109
>>> # where you will read from requests.FILES['YOUR_XLSX_FILE']
110-
>>> data = load_data(io)
110+
>>> data = get_data(io)
111111
>>> print(json.dumps(data))
112112
{"Sheet 1": [[1, 2, 3], [4, 5, 6]], "Sheet 2": [[7, 8, 9], [10, 11, 12]]}
113113

pyexcel_xlsx/__init__.py

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
READERS,
1818
WRITERS,
1919
isstream,
20+
is_string,
2021
load_data as read_data,
2122
store_data as write_data
2223
)
@@ -151,25 +152,13 @@ def close(self):
151152
"xlsx": XLSXWriter
152153
})
153154

154-
def is_string(atype):
155-
"""find out if a type is str or not"""
156-
if atype == str:
157-
return True
158-
elif PY2:
159-
if atype == unicode:
160-
return True
161-
elif atype == str:
162-
return True
163-
return False
164-
165-
166-
def store_data(afile, data, file_type=None, **keywords):
155+
def save_data(afile, data, file_type=None, **keywords):
167156
if isstream(afile) and file_type is None:
168157
file_type='xlsx'
169158
write_data(afile, data, file_type=file_type, **keywords)
170159

171160

172-
def load_data(afile, file_type=None, **keywords):
161+
def get_data(afile, file_type=None, **keywords):
173162
if isstream(afile) and file_type is None:
174163
file_type='xlsx'
175164
return read_data(afile, file_type=file_type, **keywords)

0 commit comments

Comments
 (0)