Get an iterator over all rows in the Sudoku
553784
def row_iter(self):
        """"""
        for k in utils.range_(self.side):
            yield self.row(k)
500838
def striter(self):
        """"""
        pad = self.padding or 0
        for i in self._sorted():
            yield "%0*d" % (pad, i)
411816
def _parse_from_string(string_input):
        
        # Check if comment line is present.
        read_lines = list(filter(None, string_input.split('\n')))
        if read_lines[0].startswith('#'):
            comment = read_lines.pop(0)
        else:
            comment = ''

        if len(read_lines) > 1:
            # Assume that Sudoku is defined over several rows.
            order = int(math.sqrt(len(read_lines)))
        else:
            # Sudoku is defined on one line.
            order = int(math.sqrt(math.sqrt(len(read_lines[0]))))
            read_lines = filter(lambda x: len(x) == (order ** 2), [read_lines[0][i:(i + order ** 2)] for
                                i in utils.range_(len(read_lines[0])) if i % (order ** 2) == 0])
        matrix = utils.get_list_of_lists(
            order ** 2, order ** 2, fill_with=0)

        for i, line in enumerate(read_lines):
            line = line.strip()
            for j, value in enumerate(line):
                if value.isdigit() and int(value):
                    matrix[i][j] = int(value)
                else:
                    matrix[i][j] = 0
        return order, comment, matrix
1099006
def find_all(self, board: Union[chess.Board, int], *, minimum_weight: int = 1, exclude_moves: Container[chess.Move] = ()) -> Iterator[Entry]:
        """"""
        try:
            key = int(board)  # type: ignore
            context = None  # type: Optional[chess.Board]
        except (TypeError, ValueError):
            context = typing.cast(chess.Board, board)
            key = zobrist_hash(context)

        i = self.bisect_key_left(key)
        size = len(self)

        while i < size:
            entry = self[i]
            i += 1

            if entry.key != key:
                break

            if entry.weight < minimum_weight:
                continue

            if context:
                move = context._from_chess960(context.chess960, entry.move.from_square, entry.move.to_square, entry.move.promotion, entry.move.drop)
                entry = Entry(entry.key, entry.raw_move, entry.weight, entry.learn, move)

            if exclude_moves and entry.move in exclude_moves:
                continue

            if context and not context.is_legal(entry.move):
                continue

            yield entry
800897
def rows(self):
        

        yield [self.index.name] + list(self.columns)

        for t in self.itertuples():
            yield list(t)
437216
Iterator<Row> data(IteratorType type) {
    Iterator<Row> itr;
    switch(type) {
      case EXPECTED_DATA:
        itr = data.getRows().iterator();
        break;
      case ERRORS_EXPECTED:
        itr = delta.deleted();
        break;
      case ERRORS_ACTUAL:
        itr = delta.inserted();
        break;
      default:
        throw new InternalErrorException("Unexpected case!");      
    }
    return itr;
  }
1312584
def toDict(self):
        
        d = {}
        nindices = self.getNumIndices()
        for i in range(self.getNumRows()):
            row = list(self.getRowByIndex(i))
            if nindices > 1:
                key = tuple(row[:nindices])
            elif nindices == 1:
                key = row[0]
            else:
                key = None
            if len(row) - nindices == 0:
                d[key] = None
            elif len(row) - nindices == 1:
                d[key] = row[nindices]
            else:
                d[key] = tuple(row[nindices:])
        return d
101913
def get_rows(self, sort=False):
        
        ret = []
        for _, rows in sorted(self._rows.items()) if sort else self._rows.items():
            self._rows_int2date(rows)
            ret.extend(rows)

        return ret
150263
function(oRow, iWidth) {
			/*
			 * initiating all required variables to increase speed and memory
			 * efficiency
			 */
			var r = [];
			var currentRow = -1;
			var currentWidth = 0;
			var totalWeight = 0;
			var indexLinebreak = 0;
			var w1 = 0, w2 = 0;
			var j = 0, k = 0;

			// Find out the "rows" within a row
			for (j = 0; j < oRow.cont.length; j++) {
				currentWidth = 0;
				totalWeight = 0;
				for (k = indexLinebreak; k <= j; k++) {
					totalWeight = totalWeight + oRow.cont[k].weight;
				}
				for (k = indexLinebreak; k <= j; k++) {
					w1 = iWidth / totalWeight * oRow.cont[k].weight;
					w1 = Math.floor(w1);

					w2 = oRow.cont[k].minWidth;

					currentWidth += Math.max(w1, w2);
				}

				if (currentRow == -1 || currentWidth > iWidth) {
					r.push({
						cont : []
					});
					if (currentRow !== -1) {
						/*
						 * if this is NOT the first run -> all coming iterations
						 * needn't to start from '0' since the calculation of a new
						 * row has begun
						 */
						indexLinebreak = j;
					}
					currentRow++;
				}
				r[currentRow].cont.push(oRow.cont[j]);
			}
			return r;
		}
554590
public Sudoku generateRandomCandidate(Random rng)
    {
        // Clone the template as the basis for this grid.
        Sudoku.Cell[][] rows = template.clone();
        for (int i = 0; i < rows.length; i++)
        {
            rows[i] = template[i].clone();
        }

        // Fill-in the non-fixed cells.
        for (int i = 0; i < rows.length; i++)
        {
            List<Integer> rowValues = nonFixedValues.get(i);
            Collections.shuffle(rowValues);
            int index = 0;
            for (int j = 0; j < rows[i].length; j++)
            {
                if (rows[i][j] == null)
                {
                    rows[i][j] = new Sudoku.Cell(rowValues.get(index), false);
                    ++index;
                }
            }
        }
        return new Sudoku(rows);
    }
1145240
def iter(self, query, *parameters, **kwargs):
        """"""
        cursor = self._cursor()
        try:
            self._execute(cursor, query, parameters or None, kwargs)
            if cursor.description:
                column_names = [column.name for column in cursor.description]
                while True:
                    record = cursor.fetchone()
                    if not record:
                        break
                    yield Row(zip(column_names, record))
            raise StopIteration

        except:
            cursor.close()
            raise
629524
void findMinElementIndexInRows(int leftmost[] )
    {
        Arrays.fill(leftmost,0,m,-1);

        // leftmost[i] = min(find(A(i,:)))
        for (int k = n-1; k >= 0; k--) {
            int idx0 = A.col_idx[k];
            int idx1 = A.col_idx[k+1];

            for( int p = idx0; p < idx1; p++ ) {
                leftmost[A.nz_rows[p]] = k;
            }
        }
    }
1006428
function iteratorToArray(iterator) {
        var data,
            result = [];

        while (!(data = iterator.next()).done) {
            result.push(data.value);
        }
        return result;
    }
914818
def iterrows(self):
        """"""



        row_proxy = None

        headers = None

        for row in self:

            if not headers:
                headers = row
                row_proxy = RowProxy(headers)
                continue

            yield row_proxy.set_row(row)
590655
def _join(self, rows):
    '''
    
    '''
    rval = {}
    for row in rows:
      if row:
        for value,count in row.items():
          rval[ value ] = count + rval.get(value,0)
    return rval
1215049
public VectorIterator nonZeroIteratorOfRow(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 SparseMatrix.this.get(ii, j);
            }

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

            @Override
            public boolean hasNext() {
                while (j + 1 < columns && SparseMatrix.this.isZeroAt(ii, j + 1)) {
                    j++;
                }

                return j + 1 < columns;
            }

            @Override
            public Double next() {
                if(!hasNext()) {
                    throw new NoSuchElementException();
                }
                j++;
                return get();
            }
        };
    }
868645
private Iterable<String> getAllIncluding(String index, Iterable<String> keys, IterableChain<String> result) {
        result.addAll(keys);
        for (String key : keys) {
            Iterable<String> values = get(index, key);
            if (values.iterator().hasNext()) {
                getAllIncluding(index, values, result);
            }
        }
        return result;
    }