Distributes results to the event and result queues.
 @api private
491864
def distribute_results!
      response = JSON.parse(@socket.readline)

      if response["event"]
        @event_queue << response
      else
        @result_queue << response
      end
    rescue StandardError
      @alive = false
      Thread.exit
    end
446972
@MainThread
    private void scheduleResultCallbacks(Event event, EventResult result) {
        for (EventTarget target : targets) {
            for (EventMethod method : target.methods) {
                if (event.getKey().equals(method.eventKey)
                        && method.type == EventMethod.Type.RESULT) {
                    Utils.log(event.getKey(), method, "Scheduling result callback");
                    executionQueue.add(Task.create(this, target, method, event, result));
                }
            }
        }
    }
1207290
function process_endpoint_result(raw_result) {
                const store_result = op.execute_on_store(raw_result);
                const result = NOOP === store_result
                    ? raw_result
                    : store_result
                    ;
                return resolve_promise(prepare_result(result));
            }
977467
function collectionResult (results) {
    // get context by executing any pre methods on collection views
    return this.collectionResultPre()
    // apply views to each record
    .then(context => {
        // if there are no results then do nothing
        if (!Array.isArray(results) || !results.length) {
            return context
        }
        // check if full records were loaded
        return this.query.limit === 1 || this.query.all
            // apply views to results directly
            ? this.collectionResultList(context, results)
            // create result object to iterate over results
            : this.collectionResultIterator(context, results)
    })
    // apply any post methods to context and return result
    .then(context => {
        return this.collectionResultPost(context)
    })
}
460893
private void setAggregatedValuesInResult(List results, CouchDBQueryInterpreter interpreter, JsonArray array)
    {
        for (JsonElement json : array)
        {
            JsonElement value = json.getAsJsonObject().get("value");
            if (interpreter.getAggregationType().equals(CouchDBConstants.COUNT))
                results.add(value.getAsInt());
            else
                results.add(value.getAsDouble());
        }
    }
544331
def handle_collection_result(result)
    results = build_classes_from_result(result)
    while partial? && @options[:eager_partial]
      results.concat handle_partial
    end
    results
  end
1188955
function (err, results) {

        if (!err) {

          self._startup(server);

          if (cb) cb();

        } else {

          for (var errNum in results) {
            if (results.hasOwnProperty(errNum)) {
              if (results[errNum]) {
                console.error('  - ' + results[errNum] + '\n');
              }
            }
          }

          process.exit(1);
        }
      }
519589
function(err, files, results) {
    if(err) {
      cb(err);
    } else {
      for(var i = 0; i < results.length; i++) {
        if(results[i] !== undefined && results[i].error === undefined && results[i].id !== undefined) {
          fixtures[results[i].id] = results[i];
        }
      }
      cb(undefined, fixtures);
    }
  }
203423
def result_to_event(result)
      { :type => "Result",
        :from => result.from,
        :data => {
          :result => result.results,
          :duration => result.duration,
          :request_uuid => result.token,
          :request_from => result.request_from } }
    end
1290363
function resultsCallback() {
    
    var args = slice.call(arguments, 0);
    var err = args.shift();
        
    if (err) {
      if (config.interrupt === true) {
        errors.push(err);
        results.push(null);
        callback.call(self, errors, results);
        return;
      } else {
         errored = true; 
         args = null;
      }
    } else if (args.length === 0) {
      args = 'OK';
    } else if (args.length == 1) {
      args = args[0];
    }
    
    errors.push(err);
    results.push(args);
    
    self.emit('each', err, counter, args);
    
    if (config.parallel) {
      
      // Parallel

      if (++counter == stack.length) {
        self.promise.emit('finished');
      }

    } else {
      
      // Sequential
      
      if (++counter == stack.length) {
        var preparedArgs = setInitialState(true); // Reset state, then return
        self.emit('post_exec');
        callback.apply(self, preparedArgs);
      } else {
        var next = stack[counter];
        context[next.caller].apply(context, next.args);
      }

    }

  }
551189
function firstResult(items, fn) {
	for (const item of items) {
		if (!item) {
			continue;
		}

		const result = fn(item);
		if (result) {
			return result;
		}
	}
	return undefined;
}
876652
def results(self):
        """"""
        tt = None
        for i, tf in enumerate(self[:-1]):
            tt = self[i+1]
            q = Queue(tf.qsize)
            tf.set_out(q, tt.workers)
            tt.set_in(q, tf.workers)

        if tt is None: # we have only one pool
            tt = self[0]
        q = Queue(tt.qsize)
        err_q = Queue()
        tt.set_out(q, 1)

        for t in self:
            t.set_err(err_q)
            t._start()

        for item in iterqueue(q, tt.workers):
            yield item

        errors = list(iterqueue(err_q, sum(t.workers for t in self)))

        for t in self:
            t._join()

        if len(errors) > 0:
            task_name, ex = errors[0]
            if len(errors) == 1:
                msg = 'The task "%s" raised %s' % (task_name, repr(ex),)
            else:
                msg = '%d tasks raised an exeption. First error reported on task "%s": %s' % (len(errors), task_name, repr(ex))

            raise TaskException(msg)
521286
def nextResult
      result = nil
      @mutex.synchronize do
        result = @results.shift
        @progressMutex.synchronize{ @requestProgress.delete result.requestId } if result
      end
      result
    end
395061
function(results, done) {
                // Find the index of the fields we want
                var rawIndex = results.fields.indexOf("_raw");
                var sourcetypeIndex = results.fields.indexOf("sourcetype");
                var userIndex = results.fields.indexOf("user");
                
                // Print out each result and the key-value pairs we want
                console.log("Results: ");
                for(var i = 0; i < results.rows.length; i++) {
                    console.log("  Result " + i + ": ");
                    console.log("    sourcetype: " + results.rows[i][sourcetypeIndex]);
                    console.log("    user: " + results.rows[i][userIndex]);
                    console.log("    _raw: " + results.rows[i][rawIndex]);
                }
                
                done();
            }
533728
function result () {
    // wait for all queries to complete then build result
    return this.promise.then(results => {
        // if the entire result set is a cached view then skip processing
        if (results._cachedView) {
            // result is from collection view
            if (this.modelViewEngine.hasCollection) {
                return results
            }
            // result is record(s)
            else {
                return this.resultRaw(results)
            }
        }
        // order results if needed
        if (results.length > 1) {
            results = this.orderResults(results)
        }
        // if there are model views then build result with ModelViewEngine
        // otherwise build result based on raw data
        return defined(this.modelViewEngine)
            ? this.resultModelView(results)
            : this.resultRaw(results)
    })
}
745026
function(results) {        
        for(var i = 0; i < results.rows.length; i++) {
            console.log("Result " + (i + 1) + ": ");
            var row = results.rows[i];
            for(var j = 0; j < results.fields.length; j++) {
                var field = results.fields[j];
                var value = row[j];
                
                console.log("  " + field + " = " + value);
            }
        }
    }
612107
def _prepare_results(self, results):
        
        # if we want a result sorted by a score, and if we have a full result
        # (no slice), we can do it know, by creating keys for each values with
        # the sorted set score, and sort on them
        if self._sort_by_sortedset_after and (len(results) > 1 or self._values):
            conn = self.cls.get_connection()

            sort_params = {}
            base_tmp_key, tmp_keys = self._prepare_sort_by_score(results, sort_params)

            # compose the set to sort
            final_set = '%s_final_set' % base_tmp_key
            conn.sadd(final_set, *results)

            # apply the sort
            results = conn.sort(final_set, **sort_params)

            # finally delete all temporary keys
            conn.delete(*(tmp_keys + [final_set, base_tmp_key]))

        if self._store:
            # if store, redis doesn't return result, so don't return anything here
            return

        if self._values and self._values['mode'] != 'flat':
            results = self._to_values(results)

        return super(ExtendedCollectionManager, self)._prepare_results(results)