Skip to content

Commit

Permalink
make array parameter in the signature functions get_* and save_* to c…
Browse files Browse the repository at this point in the history
…omply with pyexcel-io sheet's filtering interface, such as start_row, start_column..
  • Loading branch information
chfw committed Jan 16, 2017
1 parent a89983a commit d5645d9
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions pyexcel/sources/pydata.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ def column_iterator(self, row):
yield cell


class ArrayReader(SheetReader):

def row_iterator(self):
for row in self._native_sheet:
yield row

def column_iterator(self, row):
for cell in row:
yield cell


class RecordsSource(Source):
"""
A list of dictionaries as data source
Expand Down Expand Up @@ -145,13 +156,16 @@ class ArraySource(Source):
attributes = ["array"]
key = params.ARRAY

def __init__(self, array, sheet_name=DEFAULT_SHEET_NAME):
def __init__(self, array, sheet_name=DEFAULT_SHEET_NAME,
**keywords):
self.__array = array
self.__content = _FakeIO()
self.__sheet_name = sheet_name
self.__keywords = keywords

def get_data(self):
return {self.__sheet_name: self.__array}
array_reader = ArrayReader(self.__array, **self.__keywords)
return {self.__sheet_name: array_reader.to_array()}

def get_source_info(self):
return params.ARRAY, None
Expand Down

0 comments on commit d5645d9

Please sign in to comment.