Iterator that yields each scanline in boxed row flat pixel format.

        `rows` should be an iterator that yields the bytes of
        each row in turn.
503505
def iterboxed(self, rows):
        
        def asvalues(raw):
            """
            Convert a row of raw bytes into a flat row.

            Result may or may not share with argument
            """
            if self.bitdepth == 8:
                return raw
            if self.bitdepth == 16:
                raw = bytearray_to_bytes(raw)
                return array('H', struct.unpack('!%dH' % (len(raw) // 2), raw))
            assert self.bitdepth < 8
            width = self.width
            # Samples per byte
            spb = 8 // self.bitdepth
            out = newBarray()
            mask = 2 ** self.bitdepth - 1
            #                                      reversed range(spb)
            shifts = [self.bitdepth * it for it in range(spb - 1, -1, -1)]
            for o in raw:
                out.extend([mask & (o >> i) for i in shifts])
            return out[:width]

        return map(asvalues, rows)
280499
public VectorIterator iteratorOfRow(int i) {
        final int ii = i;
        return new VectorIterator(columns) {
            private int j = -1;

            @Override
            public int index() {
                return j;
            }

            @Override
            public double get() {
                return Matrix.this.get(ii, j);
            }

            @Override
            public void set(double value) {
                Matrix.this.set(ii, j, value);
            }

            @Override
            public boolean hasNext() {
                return j + 1 < columns;
            }

            @Override
            public Double next() {
                if(!hasNext()) {
                    throw new NoSuchElementException();
                }
                j++;
                return get();
            }
        };
    }
107587
def box_iter(self):
        """"""
        for i in utils.range_(self.order):
            for j in utils.range_(self.order):
                yield self.box(i * 3, j * 3)
704459
def _format_multirow(self, row, ilevels, i, rows):
        
        """
        for j in range(ilevels):
            if row[j].strip():
                nrow = 1
                for r in rows[i + 1:]:
                    if not r[j].strip():
                        nrow += 1
                    else:
                        break
                if nrow > 1:
                    # overwrite non-multirow entry
                    row[j] = '\\multirow{{{nrow:d}}}{{*}}{{{row:s}}}'.format(
                        nrow=nrow, row=row[j].strip())
                    # save when to end the current block with \cline
                    self.clinebuf.append([i + nrow - 1, j + 1])
        return row
170549
def window_iterator(data, width):
    
    start = 0
    while start < len(data):
        yield data[start:start+width]
        start += width
979414
def rows
      read.map do |row|
        a = row[0]; b = row[1]; c = row[2]; d = row[3]; e = row[4]; f = row[5]
        [a, 
         b || c, 
         (d || '').gsub("\n", ' '), 
         [e, f].join(',').gsub(/^,|,$/, '')]
      end
    end
1335984
def array_scanlines_interlace(self, pixels):
        

        # http://www.w3.org/TR/PNG/#8InterlaceMethods
        # Array type.
        fmt = 'BH'[self.bitdepth > 8]
        # Value per row
        vpr = self.width * self.planes
        for xstart, ystart, xstep, ystep in _adam7:
            if xstart >= self.width:
                continue
            # Pixels per row (of reduced image)
            ppr = int(math.ceil((self.width-xstart)/float(xstep)))
            # number of values in reduced image row.
            row_len = ppr*self.planes
            for y in range(ystart, self.height, ystep):
                if xstep == 1:
                    offset = y * vpr
                    yield pixels[offset:offset+vpr]
                else:
                    row = array(fmt)
                    # There's no easier way to set the length of an array
                    row.extend(pixels[0:row_len])
                    offset = y * vpr + xstart * self.planes
                    end_offset = (y+1) * vpr
                    skip = self.planes * xstep
                    for i in range(self.planes):
                        row[i::self.planes] = \
                            pixels[offset+i:end_offset:skip]
                    yield row
436843
def print_row(*argv):
    
    #for i in range(0, len(argv)):
        # row += f"{argv[i]}"
    # columns
    row = ""
    # id
    row += f"{argv[0]:<3}"
    # name
    row += f" {argv[1]:<13}"
    # allocation
    row += f" {argv[2]:>5}"
    # level
    #row += f"{argv[3]}"

    print(row)
992743
def setRows(self, rows):
        
        self._raster[0] = rows
        if self._raster[1] == 0:
            self._raster[1] = 1
166267
def _buffer_iter_rows(self, start):
        
        self._row_buffer = self[start:start+self._iter_row_buffer]

        # start back at the front of the buffer
        self._row_buffer_index = 0
1216886
private <P> Iterator<Row<ByteBuffer, P>> rowScan(final DeltaPlacement placement,
                                                     final ColumnFamily<ByteBuffer, P> columnFamily,
                                                     final ByteBufferRange rowRange,
                                                     final ByteBufferRange columnRange,
                                                     final LimitCounter limit,
                                                     final ReadConsistency consistency) {
        // In the first batch request no more than 50 rows.
        int initialBatchSize = (int) Math.min(limit.remaining(), 50);

        return new AbstractBatchReader<Row<ByteBuffer, P>>(1, initialBatchSize, MAX_SCAN_ROWS_BATCH, SCAN_ROW_BATCH_INCREMENT) {
            private ByteBuffer _rangeStart = rowRange.getStart();
            private final ByteBuffer _rangeEnd = rowRange.getEnd();
            private int _minimumLimit = 1;
            private boolean _done;

            @Override
            protected boolean hasNextBatch() {
                return !_done;
            }

            @Override
            protected Iterator<Row<ByteBuffer, P>> nextBatch(int batchSize)
                    throws Exception {
                // Note: if Cassandra is asked to perform a token range query where start >= end it will wrap
                // around which is absolutely *not* what we want since it could return data for another table.
                if (_done || BufferUtils.compareUnsigned(_rangeStart, _rangeEnd) >= 0) {
                    _done = true;
                    return Iterators.emptyIterator();
                }

                Timer.Context timer = _scanBatchTimer.time();
                try {
                    int adjustedBatchSize = (int) Math.min(Math.max(limit.remaining(), _minimumLimit), batchSize);
                    // Increase the minimum limit a bit each time around so if we start encountering lots of range
                    // ghosts we eventually scan through them at a reasonable rate.
                    _minimumLimit = Math.min(_minimumLimit + 3, MAX_SCAN_ROWS_BATCH);

                    // Pass token strings to get exclusive start behavior, to support 'fromBlobIdExclusive'.
                    String startToken = toTokenString(_rangeStart);
                    String endToken = toTokenString(_rangeEnd);
                    Rows<ByteBuffer, P> rows = execute(placement.getKeyspace()
                                    .prepareQuery(columnFamily, SorConsistencies.toAstyanax(consistency))
                                    .getKeyRange(null, null, startToken, endToken, adjustedBatchSize)
                                    .withColumnRange(columnRange),
                            "scan rows in placement %s, column family %s from %s to %s",
                            placement.getName(), columnFamily.getName(), startToken, endToken);

                    if (rows.size() >= adjustedBatchSize) {
                        // Save the last row key so we can use it as the start (exclusive) if we must query to get more data.
                        _rangeStart = rows.getRowByIndex(rows.size() - 1).getKey();
                        // If that row key was the end of our range then we're done.
                        _done = _rangeStart.equals(_rangeEnd);
                    } else {
                        // If we got fewer rows than we asked for, another query won't find more rows.
                        _done = true;
                    }

                    // Track metrics
                    _scanReadMeter.mark(rows.size());

                    // Return the rows.  Filter out range ghosts (deleted rows with no columns)
                    final Iterator<Row<ByteBuffer, P>> rowIter = rows.iterator();
                    return new AbstractIterator<Row<ByteBuffer, P>>() {
                        @Override
                        protected Row<ByteBuffer, P> computeNext() {
                            while (rowIter.hasNext()) {
                                Row<ByteBuffer, P> row = rowIter.next();
                                if (!row.getColumns().isEmpty()) {
                                    return row;
                                }
                            }
                            return endOfData();
                        }
                    };
                } finally {
                    timer.stop();
                }
            }

            @Override
            protected boolean isTimeoutException(Exception e) {
                return AstyanaxBlockedDataReaderDAO.this.isTimeoutException(e);
            }

            @Override
            protected boolean isDataSizeException(Exception e) {
                for (Throwable t : Throwables.getCausalChain(e)) {
                    // If the root cause is a thrift frame size overflow then the current batch size returned too
                    // much data.  Unfortunately there is no specific exception thrown for this so we have to
                    // check for the generic exception type, TTransportException, and then narrow by the message.
                    //
                    // Sample message:
                    // Frame size (17339288) larger than max length (16384000)!
                    if (t instanceof TTransportException) {
                        String message = t.getMessage();
                        if (message != null &&
                                message.startsWith("Frame size") &&
                                message.contains("larger than max length")) {
                            return true;
                        }
                    }
                }
                return false;
            }
        };
    }
511263
def _row_generator(self, cursor):
        
        rowset = cursor.fetchmany(self._arraysize)
        while rowset:
            if self._row_formatter is not None:
                rowset = (self._row_formatter(r, cursor) for r in rowset)
            for row in rowset:
                yield row
            rowset = cursor.fetchmany(self._arraysize)
584621
def iterrows(self, index=True):
        
        for i in range(len(self._index)):
            row = {self._index_name: self._index[i]} if index else dict()
            for c, col in enumerate(self._columns):
                row[col] = self._data[c][i]
            yield row
550777
function _getRows(matrix) {
  var rows = [];
  for (var i=0; i<matrix.size.rows; i++) {
    rows.push([]);
    for (var j=0; j<matrix.size.columns; j++)
      rows[i].push(matrix.values[matrix.size.columns * i + j]);
  }
  return rows;
}
422352
def <<(row)
      if row == Border::SEPARATOR
        separators << columns_size - (header ? 0 : 2)
      else
        rows_copy = rows.dup
        assert_row_sizes rows_copy << row
        rows << to_row(row)
      end
      self
    end
1069511
def line_iterator(readable_file, size=None):
    # type: (IO[bytes], Optional[int]) -> Iterator[bytes]
    
    read = readable_file.read
    line = []
    byte = b"1"
    if size is None or size < 0:
        while byte:
            byte = read(1)
            line.append(byte)
            if byte in b"\n":
                yield b"".join(line)
                del line[:]

    else:
        while byte and size:
            byte = read(1)
            size -= len(byte)
            line.append(byte)
            if byte in b"\n" or not size:
                yield b"".join(line)
                del line[:]
544133
def iter_rows(self):
        
        fileobj = self._fileobj
        cls_row = self.cls_row
        fields = self.fields

        for idx in range(self.prolog.records_count):
            data = fileobj.read(1)

            marker = struct.unpack('<1s', data)[0]
            is_deleted = marker == b'*'

            if is_deleted:
                continue

            row_values = []
            for field in fields:
                val = field.cast(fileobj.read(field.len))
                row_values.append(val)

            yield cls_row(*row_values)