Processes a single row from the file.
192946
def write_row(dictionary, card, log):
    
    rowhdr = {'card': card, 'log': log}

    # Do this as a list of 1-char strings.
    # Can't use a string b/c strings are immutable.
    row = [' '] * 80

    # Make the row header.
    for e in ['log', 'card']:
        strt, stop, item = _put_field(cols(0), e, rowhdr[e])
        if item is not None:
            row[strt:stop] = list(item)

    # Now make the rest of the row.
    for field in cols(card):
        strt, stop, item = _put_field(cols(card), field, dictionary.get(field))
        if item is not None:
            row[strt:stop] = list(item)

    return ''.join(row) + '\n'
556010
def process_nbcrow(self):
        
        self.log_response_message("got NBCROW message")
        r = self._reader
        info = self.res_info
        if not info:
            self.bad_stream('got row without info')
        assert len(info.columns) > 0
        info.row_count += 1

        # reading bitarray for nulls, 1 represent null values for
        # corresponding fields
        nbc = readall(r, (len(info.columns) + 7) // 8)
        for i, curcol in enumerate(info.columns):
            if tds_base.my_ord(nbc[i // 8]) & (1 << (i % 8)):
                value = None
            else:
                value = curcol.serializer.read(r)
            self.row[i] = value
681848
function(chunk)
  {
    // get all the rows in the current chunk that overlap with the requested
    // window
    var chunkStart = chunk.getStartIndex();
    var chunkEnd   = chunk.getEndIndex();
    var rows       = chunk.getRows().slice(
        Math.max(chunkStart, start) - chunkStart,
        Math.min(chunkEnd, end) + 1 - chunkStart);

    var rowIndex = 0;
    var rowsLength = rows.length;

    // create a function that can be called to batch-process rows
    var processRows = function()
    {
      // get the start position and start time
      var startIndex = rowIndex;
      var startTime  = Date.now();

      var each = options.each;
      while (rowIndex < rowsLength)
      {
        // invoke the each() callback on the current row
        var ret = each(rows[rowIndex++]);

        context.numRowsProcessed++;

        // if the callback returned false, stop processing rows
        if (ret === false)
        {
          var stoppedProcessingRows = true;
          break;
        }

        // use the current position and current time to check if we've been
        // processing rows for too long; if so, leave the rest for the next
        // tick of the event loop
        if ((rowIndex - startIndex) >= context.rowBatchSize &&
            (Date.now() - startTime) > context.rowBatchDuration)
        {
          process.nextTick(processRows);
          break;
        }
      }

      // if there are no more rows for us to process in this chunk
      if (!(rowIndex < rowsLength) || stoppedProcessingRows)
      {
        // if we exhausted all the rows in this chunk and we haven't yet
        // processed all the rows we want to process, ask the result stream to
        // do another read
        if (!(rowIndex < rowsLength) &&
            context.numRowsProcessed !== context.maxNumRowsToProcess)
        {
          resultStream.read();
        }
        else
        {
          // we've either processed all the rows we wanted to process or we
          // were told to stop processing rows by the each() callback; either
          // way, close the result stream to complete the operation
          resultStream.asyncClose();
        }
      }
    };

    // start processing rows
    processRows();
  }
177424
def file_rows(self, fo):
        """"""

        rows = []
        for i in range(NUMROWS):
            line = fo.readline()
            if not line:
                break
            rows += [line]

        return rows
847103
protected void processResource(Row row)
   {
      Integer uniqueID = row.getInteger("RES_UID");
      if (uniqueID != null && uniqueID.intValue() >= 0)
      {
         Resource resource = m_project.addResource();
         resource.setAccrueAt(AccrueType.getInstance(row.getInt("RES_ACCRUE_AT")));
         resource.setActualCost(getDefaultOnNull(row.getCurrency("RES_ACT_COST"), NumberHelper.DOUBLE_ZERO));
         resource.setActualOvertimeCost(row.getCurrency("RES_ACT_OVT_COST"));
         resource.setActualOvertimeWork(row.getDuration("RES_ACT_OVT_WORK"));
         //resource.setActualOvertimeWorkProtected();
         resource.setActualWork(row.getDuration("RES_ACT_WORK"));
         //resource.setActualWorkProtected();
         //resource.setActveDirectoryGUID();
         resource.setACWP(row.getCurrency("RES_ACWP"));
         resource.setAvailableFrom(row.getDate("RES_AVAIL_FROM"));
         resource.setAvailableTo(row.getDate("RES_AVAIL_TO"));
         //resource.setBaseCalendar();
         resource.setBaselineCost(getDefaultOnNull(row.getCurrency("RES_BASE_COST"), NumberHelper.DOUBLE_ZERO));
         resource.setBaselineWork(row.getDuration("RES_BASE_WORK"));
         resource.setBCWP(row.getCurrency("RES_BCWP"));
         resource.setBCWS(row.getCurrency("RES_BCWS"));
         //resource.setBookingType();
         resource.setCanLevel(row.getBoolean("RES_CAN_LEVEL"));
         //resource.setCode();
         resource.setCost(getDefaultOnNull(row.getCurrency("RES_COST"), NumberHelper.DOUBLE_ZERO));
         //resource.setCost1();
         //resource.setCost2();
         //resource.setCost3();
         //resource.setCost4();
         //resource.setCost5();
         //resource.setCost6();
         //resource.setCost7();
         //resource.setCost8();
         //resource.setCost9();
         //resource.setCost10();
         resource.setCostPerUse(row.getCurrency("RES_COST_PER_USE"));
         //resource.setCreationDate();
         //resource.setCV();
         //resource.setDate1();
         //resource.setDate2();
         //resource.setDate3();
         //resource.setDate4();
         //resource.setDate5();
         //resource.setDate6();
         //resource.setDate7();
         //resource.setDate8();
         //resource.setDate9();
         //resource.setDate10();
         //resource.setDuration1();
         //resource.setDuration2();
         //resource.setDuration3();
         //resource.setDuration4();
         //resource.setDuration5();
         //resource.setDuration6();
         //resource.setDuration7();
         //resource.setDuration8();
         //resource.setDuration9();
         //resource.setDuration10();
         //resource.setEmailAddress();
         //resource.setFinish();
         //resource.setFinish1();
         //resource.setFinish2();
         //resource.setFinish3();
         //resource.setFinish4();
         //resource.setFinish5();
         //resource.setFinish6();
         //resource.setFinish7();
         //resource.setFinish8();
         //resource.setFinish9();
         //resource.setFinish10();
         //resource.setFlag1();
         //resource.setFlag2();
         //resource.setFlag3();
         //resource.setFlag4();
         //resource.setFlag5();
         //resource.setFlag6();
         //resource.setFlag7();
         //resource.setFlag8();
         //resource.setFlag9();
         //resource.setFlag10();
         //resource.setFlag11();
         //resource.setFlag12();
         //resource.setFlag13();
         //resource.setFlag14();
         //resource.setFlag15();
         //resource.setFlag16();
         //resource.setFlag17();
         //resource.setFlag18();
         //resource.setFlag19();
         //resource.setFlag20();
         //resource.setGroup();
         //resource.setHyperlink();
         //resource.setHyperlinkAddress();
         //resource.setHyperlinkSubAddress();
         resource.setID(row.getInteger("RES_ID"));
         resource.setInitials(row.getString("RES_INITIALS"));
         //resource.setIsEnterprise();
         //resource.setIsGeneric();
         //resource.setIsInactive();
         //resource.setIsNull();
         //resource.setLinkedFields();RES_HAS_LINKED_FIELDS = false ( java.lang.Boolean)
         resource.setMaterialLabel(row.getString("RES_MATERIAL_LABEL"));
         resource.setMaxUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("RES_MAX_UNITS")) * 100));
         resource.setName(row.getString("RES_NAME"));
         //resource.setNtAccount();
         //resource.setNumber1();
         //resource.setNumber2();
         //resource.setNumber3();
         //resource.setNumber4();
         //resource.setNumber5();
         //resource.setNumber6();
         //resource.setNumber7();
         //resource.setNumber8();
         //resource.setNumber9();
         //resource.setNumber10();
         //resource.setNumber11();
         //resource.setNumber12();
         //resource.setNumber13();
         //resource.setNumber14();
         //resource.setNumber15();
         //resource.setNumber16();
         //resource.setNumber17();
         //resource.setNumber18();
         //resource.setNumber19();
         //resource.setNumber20();
         resource.setObjects(getNullOnValue(row.getInteger("RES_NUM_OBJECTS"), 0));
         //resource.setOutlineCode1();
         //resource.setOutlineCode2();
         //resource.setOutlineCode3();
         //resource.setOutlineCode4();
         //resource.setOutlineCode5();
         //resource.setOutlineCode6();
         //resource.setOutlineCode7();
         //resource.setOutlineCode8();
         //resource.setOutlineCode9();
         //resource.setOutlineCode10();
         resource.setOverAllocated(row.getBoolean("RES_IS_OVERALLOCATED"));
         resource.setOvertimeCost(row.getCurrency("RES_OVT_COST"));
         resource.setOvertimeRate(new Rate(row.getDouble("RES_OVT_RATE"), TimeUnit.HOURS));
         resource.setOvertimeRateUnits(TimeUnit.getInstance(row.getInt("RES_OVT_RATE_FMT") - 1));
         resource.setOvertimeWork(row.getDuration("RES_OVT_WORK"));
         resource.setPeakUnits(Double.valueOf(NumberHelper.getDouble(row.getDouble("RES_PEAK")) * 100));
         //resource.setPercentWorkComplete();
         resource.setPhonetics(row.getString("RES_PHONETICS"));
         resource.setRegularWork(row.getDuration("RES_REG_WORK"));
         resource.setRemainingCost(getDefaultOnNull(row.getCurrency("RES_REM_COST"), NumberHelper.DOUBLE_ZERO));
         resource.setRemainingOvertimeCost(row.getCurrency("RES_REM_OVT_COST"));
         resource.setRemainingOvertimeWork(row.getDuration("RES_REM_OVT_WORK"));
         resource.setRemainingWork(row.getDuration("RES_REM_WORK"));
         //resource.setResourceCalendar();RES_CAL_UID = null ( ) // CHECK THIS
         resource.setStandardRate(new Rate(row.getDouble("RES_STD_RATE"), TimeUnit.HOURS));
         resource.setStandardRateUnits(TimeUnit.getInstance(row.getInt("RES_STD_RATE_FMT") - 1));
         //resource.setStart();
         //resource.setStart1();
         //resource.setStart2();
         //resource.setStart3();
         //resource.setStart4();
         //resource.setStart5();
         //resource.setStart6();
         //resource.setStart7();
         //resource.setStart8();
         //resource.setStart9();
         //resource.setStart10();
         //resource.setText1();
         //resource.setText2();
         //resource.setText3();
         //resource.setText4();
         //resource.setText5();
         //resource.setText6();
         //resource.setText7();
         //resource.setText8();
         //resource.setText9();
         //resource.setText10();
         //resource.setText11();
         //resource.setText12();
         //resource.setText13();
         //resource.setText14();
         //resource.setText15();
         //resource.setText16();
         //resource.setText17();
         //resource.setText18();
         //resource.setText19();
         //resource.setText20();
         //resource.setText21();
         //resource.setText22();
         //resource.setText23();
         //resource.setText24();
         //resource.setText25();
         //resource.setText26();
         //resource.setText27();
         //resource.setText28();
         //resource.setText29();
         //resource.setText30();
         resource.setType(row.getBoolean("RES_TYPE") ? ResourceType.WORK : ResourceType.MATERIAL);
         resource.setUniqueID(uniqueID);
         resource.setWork(row.getDuration("RES_WORK"));
         resource.setWorkGroup(WorkGroup.getInstance(row.getInt("RES_WORKGROUP_MESSAGING")));

         String notes = row.getString("RES_RTF_NOTES");
         if (notes != null)
         {
            if (m_preserveNoteFormatting == false)
            {
               notes = RtfHelper.strip(notes);
            }
            resource.setNotes(notes);
         }

         resource.setResourceCalendar(m_project.getCalendarByUniqueID(row.getInteger("RES_CAL_UID")));

         //
         // Calculate the cost variance
         //
         if (resource.getCost() != null && resource.getBaselineCost() != null)
         {
            resource.setCostVariance(NumberHelper.getDouble(resource.getCost().doubleValue() - resource.getBaselineCost().doubleValue()));
         }

         //
         // Calculate the work variance
         //
         if (resource.getWork() != null && resource.getBaselineWork() != null)
         {
            resource.setWorkVariance(Duration.getInstance(resource.getWork().getDuration() - resource.getBaselineWork().getDuration(), TimeUnit.HOURS));
         }

         //
         // Set the overallocated flag
         //
         resource.setOverAllocated(NumberHelper.getDouble(resource.getPeakUnits()) > NumberHelper.getDouble(resource.getMaxUnits()));

         m_eventManager.fireResourceReadEvent(resource);

         //
         // Unused attributes
         //
         //EXT_EDIT_REF_DATA = null ( )
         //RESERVED_DATA = null ( )
      }
   }
858886
def run(self):
        

        self._func, self._func_code = self.build()

        def process_row(row):

            try:
                self._func(self._stats, row)
            except TypeError as e:
                raise TypeError("Failed for '{}'; {}".format(self._func_code, e))
            except KeyError:
                raise KeyError(
                    'Failed to find key in row. headers = "{}", code = "{}" '
                    .format(list(row.keys()), self._func_code))
            except Exception as e:
                raise type(e)(
                    'General exception in stats. headers = "{}", code = "{}": {} '
                        .format(list(row.keys()), self._func_code, e))

        # Use all of the rows in the source
        if self._sample_size is None:
            for i, row in enumerate(self._source):
                process_row(row)
        # Use a sample of rows, evenly distributed though the source
        else:

            skip_rate = self._sample_size / self._n_rows

            i = 0
            skip = skip_rate
            for j, row in enumerate(self._source):
                skip += skip_rate
                if skip >= 1:
                    skip -= 1
                    i += 1
                    process_row(row)

        if i < 5000:  # Since the hist bins aren't built until 5K row
            for k, v in self._stats.items():
                v._build_hist_bins()

        return self
68959
private void processFile(Script s, File file) throws IOException {
        if (!file.exists())
            throw new FileNotFoundException(file.getName());

        if (!editFiles) {

            try(BufferedReader reader = new BufferedReader(new FileReader(file))) {
                PrintWriter writer = new PrintWriter(System.out);
                processReader(s, reader, writer);
                writer.flush();
            }
        } else {
            File backup;
            if (backupExtension == null) {
                backup = File.createTempFile("groovy_", ".tmp");
                backup.deleteOnExit();
            } else {
                backup = new File(file.getPath() + backupExtension);
            }
            backup.delete();
            if (!file.renameTo(backup))
                throw new IOException("unable to rename " + file + " to " + backup);


            try(BufferedReader reader = new BufferedReader(new FileReader(backup));
                PrintWriter writer = new PrintWriter(new FileWriter(file))) {
                processReader(s, reader, writer);
            }
        }
    }
494917
def process_file_object(file_obj, importer, progress):
    """"""

    logging.info("Processing schedule data.")

    try:
        handler = XmlCallbacks(importer, progress)
        parser = sax.make_parser()
        parser.setContentHandler(handler)
        parser.setErrorHandler(handler)
        parser.parse(file_obj)
    except:
        logging.exception("Parse failed.")
        raise

    logging.info("Schedule data processed.")
404368
def preprocess
      if group_by?
        parse_file { |row| @preprocessed_csv << csv_to_hash_with_duplicates(row) }
        @preprocessed_csv = @preprocessed_csv.group_by { |row| row[key_column] }
      end
    end
81877
protected void processResourceBaseline(Row row)
   {
      Integer id = row.getInteger("RES_UID");
      Resource resource = m_project.getResourceByUniqueID(id);
      if (resource != null)
      {
         int index = row.getInt("RB_BASE_NUM");

         resource.setBaselineWork(index, row.getDuration("RB_BASE_WORK"));
         resource.setBaselineCost(index, row.getCurrency("RB_BASE_COST"));
      }
   }
712645
private void processResources() throws SQLException
   {
      List<Row> rows = getRows("select * from " + m_schema + "rsrc where delete_date is null and rsrc_id in (select rsrc_id from " + m_schema + "taskrsrc t where proj_id=? and delete_date is null) order by rsrc_seq_num", m_projectID);
      m_reader.processResources(rows);
   }
144487
def from_row(row):
    ''''''
    subject = (row[5][0].upper() + row[5][1:]) if row[5] else row[5]
    return Advice.objects.create(
        id=row[0],
        administration=cleanup(row[1]),
        type=row[2],
        session=datetime.strptime(row[4], '%d/%m/%Y'),
        subject=cleanup(subject),
        topics=[t.title() for t in cleanup(row[6]).split(', ')],
        tags=[tag.strip() for tag in row[7].split(',') if tag.strip()],
        meanings=cleanup(row[8]).replace(' / ', '/').split(', '),
        part=_part(row[9]),
        content=cleanup(row[10]),
    )
290216
def process(row)
      @inst.tweakers.each do |tweaker|
        row = tweaker.tweak row
        return nil unless row
      end
      @inst.consumers.each do |consumer|
        consumer << row
      end
    end
902451
private byte[] getNextRow(byte[] row, long writePointer, int count) {
    Bytes.putLong(row, queueRowPrefix.length, writePointer);
    Bytes.putInt(row, queueRowPrefix.length + Longs.BYTES, count + 1);
    return row;
  }
862418
function()
    {
      // get the start position and start time
      var startIndex = rowIndex;
      var startTime  = Date.now();

      var each = options.each;
      while (rowIndex < rowsLength)
      {
        // invoke the each() callback on the current row
        var ret = each(rows[rowIndex++]);

        context.numRowsProcessed++;

        // if the callback returned false, stop processing rows
        if (ret === false)
        {
          var stoppedProcessingRows = true;
          break;
        }

        // use the current position and current time to check if we've been
        // processing rows for too long; if so, leave the rest for the next
        // tick of the event loop
        if ((rowIndex - startIndex) >= context.rowBatchSize &&
            (Date.now() - startTime) > context.rowBatchDuration)
        {
          process.nextTick(processRows);
          break;
        }
      }

      // if there are no more rows for us to process in this chunk
      if (!(rowIndex < rowsLength) || stoppedProcessingRows)
      {
        // if we exhausted all the rows in this chunk and we haven't yet
        // processed all the rows we want to process, ask the result stream to
        // do another read
        if (!(rowIndex < rowsLength) &&
            context.numRowsProcessed !== context.maxNumRowsToProcess)
        {
          resultStream.read();
        }
        else
        {
          // we've either processed all the rows we wanted to process or we
          // were told to stop processing rows by the each() callback; either
          // way, close the result stream to complete the operation
          resultStream.asyncClose();
        }
      }
    }
351160
private void processRow(Example valuesRow, Example headers, Fixture rowFixtureAdapter) throws Exception
    {
        Statistics rowStats = new Statistics();

        for (int i = 0; i != valuesRow.remainings(); ++i)
        {
            Example cell = valuesRow.at( i );

            if (i < headers.remainings())
            {
                ExpectedColumn column = columns != null ? (ExpectedColumn) columns[i] :
                        CollectionHeaderForm.parse(headers.at(i).getContent()).selectColumn();
                chekOneCell(rowFixtureAdapter, rowStats, cell, column);
            }
            else
            {
                cell.annotate( ignored( cell.getContent() ) );
            }
        }
        applyRowStatistic(rowStats);
    }
772052
def process_cell(self, row, column, cell):
        
        value, field = self.parse_cell(cell)

        if value or field:
            return {'col':column, 'field':field, 'value':value}
        else:
            return {}