@@ -582,10 +582,7 @@ def _next_char(str_val, index):
582582 :returns: The next character after the character at ``index``
583583 in ``str_val``.
584584 """
585- if six .PY3 : # pragma: NO COVER
586- ord_val = str_val [index ]
587- else :
588- ord_val = ord (str_val [index ])
585+ ord_val = six .indexbytes (str_val , index )
589586 return _to_bytes (chr (ord_val + 1 ), encoding = 'latin-1' )
590587
591588
@@ -613,12 +610,8 @@ def _string_successor(str_val):
613610
614611 index = len (str_val ) - 1
615612 while index >= 0 :
616- if six .PY3 : # pragma: NO COVER
617- if str_val [index ] != 0xff :
618- break
619- else :
620- if str_val [index ] != b'\xff ' :
621- break
613+ if six .indexbytes (str_val , index ) != 0xff :
614+ break
622615 index -= 1
623616
624617 if index == - 1 :
@@ -653,6 +646,17 @@ def _convert_to_time_range(timestamp=None):
653646def _cells_to_pairs (cells , include_timestamp = False ):
654647 """Converts list of cells to HappyBase format.
655648
649+ For example::
650+
651+ >>> import datetime
652+ >>> from gcloud.bigtable.row_data import Cell
653+ >>> cell1 = Cell(b'val1', datetime.datetime.utcnow())
654+ >>> cell2 = Cell(b'val2', datetime.datetime.utcnow())
655+ >>> _cells_to_pairs([cell1, cell2])
656+ [b'val1', b'val2']
657+ >>> _cells_to_pairs([cell1, cell2], include_timestamp=True)
658+ [(b'val1', 1456361486255), (b'val2', 1456361491927)]
659+
656660 :type cells: list
657661 :param cells: List of :class:`.Cell` returned from a read request.
658662
@@ -683,6 +687,22 @@ def _partial_row_to_dict(partial_row_data, include_timestamp=False):
683687 is due to the fact that this method is used by callers which use
684688 a ``CellsColumnLimitFilter(1)`` filter.
685689
690+ For example::
691+
692+ >>> import datetime
693+ >>> from gcloud.bigtable.row_data import Cell, PartialRowData
694+ >>> cell1 = Cell(b'val1', datetime.datetime.utcnow())
695+ >>> cell2 = Cell(b'val2', datetime.datetime.utcnow())
696+ >>> row_data = PartialRowData(b'row-key')
697+ >>> _partial_row_to_dict(row_data)
698+ {}
699+ >>> row_data._cells[u'fam1'] = {b'col1': [cell1], b'col2': [cell2]}
700+ >>> _partial_row_to_dict(row_data)
701+ {b'fam1:col2': b'val2', b'fam1:col1': b'val1'}
702+ >>> _partial_row_to_dict(row_data, include_timestamp=True)
703+ {b'fam1:col2': (b'val2', 1456361724480),
704+ b'fam1:col1': (b'val1', 1456361721135)}
705+
686706 :type partial_row_data: :class:`.row_data.PartialRowData`
687707 :param partial_row_data: Row data consumed from a stream.
688708
0 commit comments