report

@param {Result[]} results 要输出到命令行的内容
@returns {string} output
505464
function report (results) {
  const arr = []

  results.forEach(result => {
    const name = result.name
    const output = result.output
    const success = result.success

    arr.push('\n')
    arr.push(`${chalk.bold(`> ${name}:`)}\n`)
    arr.push('\n')

    if (success && !output.trim()) {
      arr.push(padding(passedMessage))
    } else {
      arr.push(padding(output))
    }

    arr.push('\n')
  })

  arr.push('\n')

  return reduceEmptyLine(arr.join(''))
}
190518
function (incremental) {
        if (!reportHolder || !results) {
            return; // logging was not enabled
        }

        var table = '<table><thead><tr><th>Selector</th><th> </th><th>ms</th><th>Total</th></tr></thead><tbody>';

        // Extract the 10 slowest results
        var resultsArray = [];
        for (var res in results) {
            if (results.hasOwnProperty(res) && res !== "__baseline__") {
                resultsArray.push(results[res]);
            }
        }
        var sorted = resultsArray.sort(function (a, b) {
            if (a.baseline === b.baseline) {
                return 0;
            }

            if (incremental) {
                return a.baseline > b.baseline ? 1 : -1;
            } else {
                return a.baseline > b.baseline ? -1 : 1;
            }
        }).slice(0, 20);

        for (var i = 0, len = sorted.length; i < len; i += 1) {
            var item = sorted[i];
            table += '<tr><td style="font:11px monospace">Removing <strong>'
                    + item.name
                    + '</strong></td><td style="text-align:right">'
                    + (item.baseline > 0
                            ? '<span style="color:green">saves</span>'
                            : '<span style="color:red">adds</span>')
                    + '</td><td style="text-align:right; font:11px monospace">' + Math.abs(item.baseline) + 'ms</td>'
                    + '<td style="text-align:right; font:11px monospace">' + item.runTime + 'ms</td></tr>\n';
        }

        table += '</tbody></table><hr/>';

        // Summary
        table += '<table><tr><td style="text-align:right; font:10px monospace">Selectors Tested:</td><td style="font:10px monospace">'
                + resultsArray.length
                + '</td></tr>'
                + '<tr><td style="text-align:right; font:10px monospace">Baseline Time:</td><td style="font:10px monospace">'
                + results["__baseline__"].runTime + 'ms</td></tr>';

        style(reportHolder, {
            width : 600
        });

        logHolder.innerHTML = table;
    }
1288534
function recordResult (results) {
    // if only ids were selected the return result object to fetch records
    if (this.query.select.isSelectOnlyIds) {
        // build result object
        var result = new ImmutableCoreModelResult({
            query: this.query,
            results: results,
            applyView: true,
        })
        // return result or all records if specified
        return this.query.args.all ? result.all() : result
    }
    // otherwise return ImmutableCoreModelInstance record(s)
    else {
        // if query is for a single record then return record or undefined
        if (this.query.args.limit === 1) {
            // if there are not results return undefined
            if (!results.length) {
                return undefined
            }
            // apply model view to record
            return Promise.resolve(this.applyModelViewRecord(results[0]))
            // resolve with instance
            .then(result => this.newRecordInstance(result))
        }
        // if query is for all records then return all
        else {
            // apply model views to each record
            return Promise.map(results, result => {
                // apply model view to record
                return this.applyModelViewRecord(result)
                // resolve with instance
                .then(result => this.newRecordInstance(result))
            })
        }
    }
}
400745
def display_results(results, detailed=False):
    
    # print("\nVALIDATOR RESULTS")
    # print("======================\n")

    if not detailed:
        print('FILENAME......................................... STATUS..........')

    for entry in results:
        try:
            if detailed:
                print("\n{}".format(entry["filename"]))
                print(create_detailed_results(entry))
            else:
                print("{:<50}{}".format(entry["filename"], entry["status"]))
        except Exception as e:
            logger_validator_api.debug("display_results: Exception: {}".format(e))
            print("Error: display_results: {}".format(e))

    return
909066
function( arr, results ) {
		var ret = results || [];

		if ( arr != null ) {
			if ( isArraylike( Object(arr) ) ) {
				jQuery.merge( ret,
					typeof arr === "string" ?
					[ arr ] : arr
				);
			} else {
				core_push.call( ret, arr );
			}
		}

		return ret;
	}
454518
function ReturnResult(result) {
  if (errors.length) {
    result.errors = errors;
  }
  var state = data.state;
  if (state) {
    var AMS = MathJax.Extension["TeX/AMSmath"];
    var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH;
    state.AMS.startNumber = AMS.startNumber;
    state.AMS.labels = AMS.labels;
    state.AMS.IDs = AMS.IDs;
    state.mmlID = MathJax.ElementJax.mml.SUPER.ID;
    state.glyphs = GLYPH.glyphs;
    state.defs = GLYPH.defs;
    state.n = GLYPH.n;
    state.ID = ID;
  }
  serverState = STATE.READY;
  callback(result, originalData);
  if (serverState === STATE.READY) StartQueue();
}
560577
def create_detailed_results(result):
    
    string = ""
    # Validation Response output
    # string += "VALIDATION RESPONSE\n"
    string += "STATUS: {}\n".format(result["status"])
    if result["feedback"]:
        string += "WARNINGS: {}\n".format(len(result["feedback"]["wrnMsgs"]))
        # Loop through and output the Warnings
        for msg in result["feedback"]["wrnMsgs"]:
            string += "- {}\n".format(msg)
        string += "ERRORS: {}\n".format(len(result["feedback"]["errMsgs"]))
        # Loop through and output the Errors
        for msg in result["feedback"]["errMsgs"]:
            string += "- {}\n".format(msg)
    return string
208718
function printResults(results){
    var output = "";
    var dependenciesTimes = [];
    var devDependenciesTimes = [];

    dependenciesTimes = Object.keys(results.moduleTimes.dependencies).map(function(depen){
        var val = results.moduleTimes.dependencies[depen];

        return [
            chalk.gray(depen),
            " : ",
            chalk.white(val === -1 ? "Cannot be required" : val)
        ];
    });

    devDependenciesTimes = Object.keys(results.moduleTimes.devDependencies).map(function(depen){
        var val = results.moduleTimes.devDependencies[depen];

        return [
            chalk.gray(depen),
            " : ",
            chalk.white(val === -1 ? "Cannot be required" : val)
        ];
    });

    if(dependenciesTimes.length > 0){
        output += chalk.white("Dependencies: \n");
        output += table(dependenciesTimes, {align: ["l", "l"]});
    }

    if(devDependenciesTimes.length > 0){
        output += chalk.white("\n\nDevDependencies: \n");
        output += table(devDependenciesTimes, {align : ["l", "l"]});
    }

    output += chalk.white("\n\nModule load time: " + (results.loadTime === -1 ? "Cannot be required" : results.loadTime));
    console.log(output);
}
865844
def _sendResult(self, result):
        
        # logger.debug("Result: %s", result)

        try:
            result = json.dumps(result)
        except Exception as error:
            result = json.dumps(self._errorInfo(command, error))

        sys.stdout.write(result)
        sys.stdout.write("\n")
        sys.stdout.flush()
693642
def output_results(results, mvdelim = '\n', output = sys.stdout):
    """"""

    # We collect all the unique field names, as well as 
    # convert all multivalue keys to the right form
    fields = set()
    for result in results:    
        for key in result.keys():
            if(isinstance(result[key], list)):
                result['__mv_' + key] = encode_mv(result[key])
                result[key] = mvdelim.join(result[key])
        fields.update(list(result.keys()))

    # convert the fields into a list and create a CSV writer
    # to output to stdout
    fields = sorted(list(fields))

    writer = csv.DictWriter(output, fields)

    # Write out the fields, and then the actual results
    writer.writerow(dict(list(zip(fields, fields))))
    writer.writerows(results)
266891
function cacheResults (results) {
    // get id column name
    var idColumn = this.query.model.columnName('id')
    // arguments for multi-set
    var setArgs = []
    // args are list of key, value, key, value
    _.each(results, result => {
        // JSON encode result
        try {
            var cacheValue = JSON.stringify(result)
        }
        catch (err) {
            // ignore errors
        }
        // cache value
        if (defined(cacheValue)) {
            // get cache key
            var cacheKey = this.cacheKey(result[idColumn])
            // debug
            debug('id:set', cacheKey)
            // add to list to cache
            setArgs.push(cacheKey, cacheValue)
        }
    })
    // cache results
    if (setArgs.length > 0) {
        return this.cache.redis.msetAsync(setArgs)
    }
}
313413
private List<String> getResultRows(Result<?> result, boolean logResult) {
        List<String> rows = new ArrayList<>();
        if (logResult) {
            for (Map<String, Object> columns : result.getRows()) {
                StringBuilder row = new StringBuilder();
                for (Map.Entry<String, Object> entry : columns.entrySet()) {
                    if (row.length() > 0) {
                        row.append(", ");
                    }
                    row.append(entry.getKey());
                    row.append('=');
                    String stringValue = getLabel(entry.getValue());
                    row.append(stringValue);
                }
                rows.add("  " + row.toString());
            }
        }
        return rows;
    }
537204
function output_as_xml($results){
		LogMaster::log("Edit operation finished",$results);
		ob_clean();
		header("Content-type:text/xml");
		echo "<?xml version='1.0' ?>";
		echo "<data>";
		for ($i=0; $i < sizeof($results); $i++)
			echo $results[$i]->to_xml();
		echo "</data>";
	}
267146
public function render_evaluate_results($results, $logs = array()) {
        global $OUTPUT;

        $output = '';

        foreach ($results as $timesplittingid => $result) {

            if (!CLI_SCRIPT) {
                $output .= $OUTPUT->box_start('generalbox mb-3');
            }

            // Check that the array key is a string, not all results depend on time splitting methods (e.g. general errors).
            if (!is_numeric($timesplittingid)) {
                $timesplitting = \core_analytics\manager::get_time_splitting($timesplittingid);
                $langstrdata = (object)array('name' => $timesplitting->get_name(), 'id' => $timesplittingid);

                if (CLI_SCRIPT) {
                    $output .= $OUTPUT->heading(get_string('getpredictionsresultscli', 'tool_analytics', $langstrdata), 3);
                } else {
                    $output .= $OUTPUT->heading(get_string('getpredictionsresults', 'tool_analytics', $langstrdata), 3);
                }
            }

            if ($result->status == 0) {
                $output .= $OUTPUT->notification(get_string('goodmodel', 'tool_analytics'),
                    \core\output\notification::NOTIFY_SUCCESS);
            } else if ($result->status === \core_analytics\model::NO_DATASET) {
                $output .= $OUTPUT->notification(get_string('nodatatoevaluate', 'tool_analytics'),
                    \core\output\notification::NOTIFY_WARNING);
            }

            if (isset($result->score)) {
                // Score.
                $output .= $OUTPUT->heading(get_string('accuracy', 'tool_analytics') . ': ' .
                    round(floatval($result->score), 4) * 100  . '%', 4);
            }

            if (!empty($result->info)) {
                foreach ($result->info as $message) {
                    $output .= $OUTPUT->notification($message, \core\output\notification::NOTIFY_WARNING);
                }
            }

            if (!CLI_SCRIPT) {
                $output .= $OUTPUT->box_end();
            }
        }

        // Info logged during evaluation.
        if (!empty($logs) && debugging()) {
            $output .= $OUTPUT->heading(get_string('extrainfo', 'tool_analytics'), 3);
            foreach ($logs as $log) {
                $output .= $OUTPUT->notification($log, \core\output\notification::NOTIFY_WARNING);
            }
        }

        if (!CLI_SCRIPT) {
            $output .= $OUTPUT->single_button(new \moodle_url('/admin/tool/analytics/index.php'), get_string('continue'), 'get');
        }

        return $output;
    }
1220732
function renderResult(a) {
  return a.cata({
    Success: function() {
      return success('✓ ' + a.name()) }
  , Failure: function(_, ex) {
      return failure('✗ ' + a.name()) + '\n'
           + faded(pad(2, '[' + ex.name + ']: ' + ex.message)) }
  , Ignored: function() {
      return ignored('⚪ ' + a.name()) }
  }) + logs(a)
}
1036803
function(results, options) {
        var id = option('reportToId') || 'jspec'
        var report = document.getElementById(id)
        var failuresOnly = option('failuresOnly')
        var classes = results.stats.failures ? 'has-failures' : ''
        if (!report) throw 'JSpec requires the element #' + id + ' to output its reports'
        
        function bodyContents(body) {
          return JSpec.
            escape(JSpec.contentsOf(body)).
            replace(/^ */gm, function(a){ return (new Array(Math.round(a.length / 3))).join(' ') }).
            replace(/\r\n|\r|\n/gm, '<br/>')
        }
        
        report.innerHTML = '<div id="jspec-report" class="' + classes + '"><div class="heading"> \
        <span class="passes">Passes: <em>' + results.stats.passes + '</em></span>                \
        <span class="failures">Failures: <em>' + results.stats.failures + '</em></span>          \
        <span class="passes">Duration: <em>' + results.duration + '</em> ms</span>          \
        </div><table class="suites">' + map(results.allSuites, function(suite) {
          var displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
          if (displaySuite && suite.hasSpecs())
            return '<tr class="description"><td colspan="2">' + escape(suite.description) + '</td></tr>' +
              map(suite.specs, function(i, spec) {
                return '<tr class="' + (i % 2 ? 'odd' : 'even') + '">' +
                  (spec.requiresImplementation() ?
                    '<td class="requires-implementation" colspan="2">' + escape(spec.description) + '</td>' :
                      (spec.passed() && !failuresOnly) ?
                        '<td class="pass">' + escape(spec.description)+ '</td><td>' + spec.assertionsGraph() + '</td>' :
                          !spec.passed() ?
                            '<td class="fail">' + escape(spec.description) + 
  													map(spec.failures(), function(a){ return '<em>' + escape(a.message) + '</em>' }).join('') +
 														'</td><td>' + spec.assertionsGraph() + '</td>' :
                              '') +
                  '<tr class="body"><td colspan="2"><pre>' + bodyContents(spec.body) + '</pre></td></tr>'
              }).join('') + '</tr>'
        }).join('') + '</table></div>'
      }
1118648
function formatOutput(output) {
    var indent = '  ';
    var pad = '  ';
    var results = [];
    results.push('AppDir:' + output.appDir);
    output.suites.forEach(function(suite) {
      results.push(pad + 'Suite: ' + suite.description + ' -- ' + suite.status);
      pad+=indent;
      suite.specs.forEach(function(spec) {
        results.push(pad + spec.status + ' - ' + spec.description);
        if (spec.failedExpectations) {
          pad+=indent;
          spec.failedExpectations.forEach(function (fe) {
            results.push(pad + 'message: ' + fe.message);
          });
          pad=pad.substr(2);
        }
      });
      pad = pad.substr(2);
      results.push('');
    });
    results.push('');
    return results.join('\n');
  }