<s> """<STR_LIT>""" <EOL> class PyexcelIterator : <EOL> """<STR_LIT>""" <EOL> def __next__ ( self ) : <EOL> return self . next ( ) <EOL> class HTLBRIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = <NUM_LIT:0> <EOL> self . columns = reader . number_of_columns ( ) <EOL> self . rows = reader . number_of_rows ( ) <EOL> self . total = self . columns * self . rows <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next_cell_position ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( int ( self . current / self . columns ) , <EOL> int ( self . current % self . columns ) ) <EOL> def move_cursor ( self ) : <EOL> """<STR_LIT>""" <EOL> self . current += <NUM_LIT:1> <EOL> def get_next_value ( self ) : <EOL> """<STR_LIT>""" <EOL> row , column = self . next_cell_position ( ) <EOL> self . move_cursor ( ) <EOL> return self . reader_ref . cell_value ( row , column ) <EOL> def exit_condition ( self ) : <EOL> """<STR_LIT>""" <EOL> return self . current >= self . total <EOL> def next ( self ) : <EOL> """<STR_LIT>""" <EOL> if self . exit_condition ( ) : <EOL> raise StopIteration <EOL> else : <EOL> return self . get_next_value ( ) <EOL> class VTLBRIterator ( HTLBRIterator ) : <EOL> """<STR_LIT>""" <EOL> def next_cell_position ( self ) : <EOL> """<STR_LIT>""" <EOL> return ( int ( self . current % self . rows ) , <EOL> int ( self . current / self . rows ) ) <EOL> class HBRTLIterator ( HTLBRIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . columns = reader . number_of_columns ( ) <EOL> self . rows = reader . number_of_rows ( ) <EOL> self . current = self . rows * self . columns <EOL> def exit_condition ( self ) : <EOL> return self . current <= <NUM_LIT:0> <EOL> def move_cursor ( self ) : <EOL> self . current -= <NUM_LIT:1> <EOL> def get_next_value ( self ) : <EOL> self . move_cursor ( ) <EOL> row , column = self . next_cell_position ( ) <EOL> return self . reader_ref . cell_value ( row , column ) <EOL> class VBRTLIterator ( HBRTLIterator ) : <EOL> """<STR_LIT>""" <EOL> def next_cell_position ( self ) : <EOL> return ( int ( self . current % self . rows ) , <EOL> int ( self . current / self . rows ) ) <EOL> class HTRBLIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . columns = reader . number_of_columns ( ) <EOL> self . rows = reader . number_of_rows ( ) <EOL> self . total = self . rows * self . columns <EOL> self . row = <NUM_LIT:0> <EOL> self . column = self . columns <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def get_next_value ( self ) : <EOL> self . column -= <NUM_LIT:1> <EOL> if self . column == - <NUM_LIT:1> : <EOL> self . column = self . columns - <NUM_LIT:1> <EOL> self . row += <NUM_LIT:1> <EOL> return self . reader_ref . cell_value ( self . row , self . column ) <EOL> def exit_condition ( self ) : <EOL> return self . column == <NUM_LIT:0> and self . row == ( self . rows - <NUM_LIT:1> ) <EOL> def next ( self ) : <EOL> if self . exit_condition ( ) : <EOL> raise StopIteration <EOL> else : <EOL> return self . get_next_value ( ) <EOL> class VTRBLIterator ( HTRBLIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . columns = reader . number_of_columns ( ) <EOL> self . rows = reader . number_of_rows ( ) <EOL> self . total = self . rows * self . columns <EOL> self . row = - <NUM_LIT:1> <EOL> self . column = self . columns - <NUM_LIT:1> <EOL> def get_next_value ( self ) : <EOL> self . row += <NUM_LIT:1> <EOL> if self . row >= self . rows : <EOL> self . column -= <NUM_LIT:1> <EOL> self . row = <NUM_LIT:0> <EOL> return self . reader_ref . cell_value ( self . row , self . column ) <EOL> class VBLTRIterator ( HTRBLIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . columns = reader . number_of_columns ( ) <EOL> self . rows = reader . number_of_rows ( ) <EOL> self . total = self . rows * self . columns <EOL> self . row = self . rows <EOL> self . column = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def get_next_value ( self ) : <EOL> self . row -= <NUM_LIT:1> <EOL> if self . row == - <NUM_LIT:1> : <EOL> self . row = self . rows - <NUM_LIT:1> <EOL> self . column += <NUM_LIT:1> <EOL> return self . reader_ref . cell_value ( self . row , self . column ) <EOL> def exit_condition ( self ) : <EOL> return self . row == <NUM_LIT:0> and self . column == ( self . columns - <NUM_LIT:1> ) <EOL> class HBLTRIterator ( VBLTRIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . columns = reader . number_of_columns ( ) <EOL> self . rows = reader . number_of_rows ( ) <EOL> self . total = self . rows * self . columns <EOL> self . row = self . rows - <NUM_LIT:1> <EOL> self . column = - <NUM_LIT:1> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def get_next_value ( self ) : <EOL> self . column += <NUM_LIT:1> <EOL> if self . column >= self . columns : <EOL> self . row -= <NUM_LIT:1> <EOL> self . column = <NUM_LIT:0> <EOL> return self . reader_ref . cell_value ( self . row , self . column ) <EOL> class RowIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . row_range ( ) : <EOL> row = self . current <EOL> self . current += <NUM_LIT:1> <EOL> return self . reader_ref . row_at ( row ) <EOL> else : <EOL> raise StopIteration <EOL> class NamedRowIterator ( RowIterator ) : <EOL> """<STR_LIT>""" <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . row_range ( ) : <EOL> row = self . current <EOL> self . current += <NUM_LIT:1> <EOL> row_array = self . reader_ref . row_at ( row ) <EOL> row_dict = dict ( zip ( self . reader_ref . colnames , row_array ) ) <EOL> return row_dict <EOL> else : <EOL> raise StopIteration <EOL> class RowReverseIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = reader . number_of_rows ( ) - <NUM_LIT:1> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . row_range ( ) : <EOL> self . current -= <NUM_LIT:1> <EOL> return self . reader_ref . row_at ( self . current + <NUM_LIT:1> ) <EOL> else : <EOL> raise StopIteration <EOL> class ColumnIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . column_range ( ) : <EOL> self . current += <NUM_LIT:1> <EOL> return self . reader_ref . column_at ( self . current - <NUM_LIT:1> ) <EOL> else : <EOL> raise StopIteration <EOL> class NamedColumnIterator ( ColumnIterator ) : <EOL> """<STR_LIT>""" <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . column_range ( ) : <EOL> self . current += <NUM_LIT:1> <EOL> column_array = self . reader_ref . column_at ( self . current - <NUM_LIT:1> ) <EOL> column_dict = dict ( zip ( self . reader_ref . rownames , column_array ) ) <EOL> return column_dict <EOL> else : <EOL> raise StopIteration <EOL> class ColumnReverseIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = reader . number_of_columns ( ) - <NUM_LIT:1> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . column_range ( ) : <EOL> self . current -= <NUM_LIT:1> <EOL> return self . reader_ref . column_at ( self . current + <NUM_LIT:1> ) <EOL> else : <EOL> raise StopIteration <EOL> class ColumnIndexIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . column_range ( ) : <EOL> index = self . current <EOL> self . current += <NUM_LIT:1> <EOL> column_header = self . reader_ref . colnames [ index ] <EOL> return { <EOL> column_header : self . reader_ref . named_column_at ( column_header ) } <EOL> else : <EOL> raise StopIteration <EOL> class RowIndexIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , reader ) : <EOL> self . reader_ref = reader <EOL> self . current = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current in self . reader_ref . row_range ( ) : <EOL> index = self . current <EOL> self . current += <NUM_LIT:1> <EOL> column_header = self . reader_ref . rownames [ index ] <EOL> return { <EOL> column_header : self . reader_ref . named_row_at ( column_header ) } <EOL> else : <EOL> raise StopIteration <EOL> class SheetIterator ( PyexcelIterator ) : <EOL> """<STR_LIT>""" <EOL> def __init__ ( self , bookreader ) : <EOL> self . book_reader_ref = bookreader <EOL> self . current = <NUM_LIT:0> <EOL> def __iter__ ( self ) : <EOL> return self <EOL> def next ( self ) : <EOL> if self . current < self . book_reader_ref . number_of_sheets ( ) : <EOL> self . current += <NUM_LIT:1> <EOL> return self . book_reader_ref [ self . current - <NUM_LIT:1> ] <EOL> else : <EOL> raise StopIteration </s>
