def read_records(self, file_name, range_tracker):
    start_offset = range_tracker.start_position()
    read_buffer = _TextSource.ReadBuffer(b'', 0)
    next_record_start_position = (- 1)

    def split_points_unclaimed(stop_position):
        return (0 if (stop_position <= next_record_start_position) else iobase.RangeTracker.SPLIT_POINTS_UNKNOWN)
    range_tracker.set_split_points_unclaimed_callback(split_points_unclaimed)
    with self.open_file(file_name) as file_to_read:
        position_after_processing_header_lines = self._process_header(file_to_read, read_buffer)
        start_offset = max(start_offset, position_after_processing_header_lines)
        if (start_offset > position_after_processing_header_lines):
            file_to_read.seek((start_offset - 1))
            read_buffer.reset()
            sep_bounds = self._find_separator_bounds(file_to_read, read_buffer)
            if (not sep_bounds):
                return
            (_, sep_end) = sep_bounds
            read_buffer.data = read_buffer.data[sep_end:]
            next_record_start_position = ((start_offset - 1) + sep_end)
        else:
            next_record_start_position = position_after_processing_header_lines
        while range_tracker.try_claim(next_record_start_position):
            (record, num_bytes_to_next_record) = self._read_record(file_to_read, read_buffer)
            if ((len(record) == 0) and (num_bytes_to_next_record < 0)):
                break
            assert (num_bytes_to_next_record != 0)
            if (num_bytes_to_next_record > 0):
                next_record_start_position += num_bytes_to_next_record
            (yield self._coder.decode(record))
            if (num_bytes_to_next_record < 0):
                break
def read_records(self, file_name, range_tracker):
    start_offset = range_tracker.start_position()
    read_buffer = _TextSource.ReadBuffer(b, 0)
    next_record_start_position = (- 1)

    def split_points_unclaimed(stop_position):
        return (0 if (stop_position <= next_record_start_position) else iobase.RangeTracker.SPLIT_POINTS_UNKNOWN)
    range_tracker.set_split_points_unclaimed_callback(split_points_unclaimed)
    with self.open_file(file_name) as file_to_read:
        position_after_processing_header_lines = self._process_header(file_to_read, read_buffer)
        start_offset = max(start_offset, position_after_processing_header_lines)
        if (start_offset > position_after_processing_header_lines):
            file_to_read.seek((start_offset - 1))
            read_buffer.reset()
            sep_bounds = self._find_separator_bounds(file_to_read, read_buffer)
            if (not sep_bounds):
                return
            (_, sep_end) = sep_bounds
            read_buffer.data = read_buffer.data[sep_end:]
            next_record_start_position = ((start_offset - 1) + sep_end)
        else:
            next_record_start_position = position_after_processing_header_lines
        while range_tracker.try_claim(next_record_start_position):
            (record, num_bytes_to_next_record) = self._read_record(file_to_read, read_buffer)
            if ((len(record) == 0) and (num_bytes_to_next_record < 0)):
                break
            assert (num_bytes_to_next_record != 0)
            if (num_bytes_to_next_record > 0):
                next_record_start_position += num_bytes_to_next_record
            (yield self._coder.decode(record))
            if (num_bytes_to_next_record < 0):
                break