Passed and failed percentage
18770
function () {
            var scenarioPassed = document.querySelectorAll('.scenario.passed').length,
                scenarioFailed = document.querySelectorAll('.scenario.failed').length,
                scenariosAmount = document.querySelectorAll('.scenario').length,
                passed = (scenarioPassed / scenariosAmount) * 100,
                failed = (scenarioFailed / scenariosAmount) * 100,
                statistics;

            statistics = {
                scenariosAmount: scenariosAmount,
                passed: Math.round(Math.floor(passed)),
                failed: Math.round(Math.ceil(failed))
            };

            return statistics;
        }
131125
def no_new_errors(new_data, old_data, strict=False):
    
    success = True
    score = 0
    message = ''
    if new_data['errors'] > old_data['errors']:
        success = False
        message = "Failed, More errors than prior runs!({} > {})\n" \
                  "Average Score: {}".format(new_data['errors'],
                                             old_data['errors'],
                                             new_data['average'])
        score = -1

    return success, score, message
1314468
function getOutcome(spec) {
            var outcome = "None";

            if(isFailed(spec)) {
                outcome = "Failed";
            }

            if(isDisabled(spec)) {
                outcome = "Ignored";
            }

            if(isSkipped(spec)) {
                outcome = "Skipped";
            }

            if(isPassed(spec)) {
                outcome = "Passed";
            }

            return outcome;
        }
276864
def get_progress_percentage(self, ar_brain):
        
        review_state = ar_brain.review_state
        if review_state == "published":
            return 100

        numbers = ar_brain.getAnalysesNum

        num_analyses = numbers[1] or 0
        if not num_analyses:
            return 0

        # [verified, total, not_submitted, to_be_verified]
        num_to_be_verified = numbers[3] or 0
        num_verified = numbers[0] or 0

        # 2 steps per analysis (submit, verify) plus one step for publish
        max_num_steps = (num_analyses * 2) + 1
        num_steps = num_to_be_verified + (num_verified * 2)
        if not num_steps:
            return 0
        if num_steps > max_num_steps:
            return 100
        return (num_steps * 100) / max_num_steps
1209139
def passed(self):
        
        return [test for test in self.all() if not test.failed() and not test.skipped()]
601271
def dependency_failed(self, test):
        """"""
        for d in (self.test_name(i) for i in dependencies[test]):
            if d in (self.test_name(str(t[0])) for t in self.results.failures):
                return "Required test '{}' FAILED".format(d)
            if d in (self.test_name(str(t[0])) for t in self.results.errors):
                return "Required test '{}' ERRORED".format(d)
            if d in (self.test_name(str(t[0])) for t in self.results.skipped):
                return "Required test '{}' SKIPPED".format(d)
        return None
940316
def num_fails(self):
        """"""
        n = len(self.failed_phase_list)
        if self.phase_stack[-1].status in (SolverStatus.failed, SolverStatus.cyclic):
            n += 1
        return n
350534
def from_percent(position_percent):
        """"""
        if not isinstance(position_percent, int):
            raise PyVLXException("Position::position_percent_has_to_be_int")
        if position_percent < 0:
            raise PyVLXException("Position::position_percent_has_to_be_positive")
        if position_percent > 100:
            raise PyVLXException("Position::position_percent_out_of_range")
        return bytes([position_percent*2, 0])
654254
def check_failhard(self, low, running):
        '''
        
        '''
        tag = _gen_tag(low)
        if self.opts.get('test', False):
            return False
        if low.get('failhard', self.opts['failhard']) and tag in running:
            if running[tag]['result'] is None:
                return False
            return not running[tag]['result']
        return False
509470
public function calculate_progress() {
        global $USER, $DB;

        // Check if the user is reviewing the attempt.
        if (isset($USER->modattempts[$this->properties->id])) {
            return 100;
        }

        // All of the lesson pages.
        $pages = $this->load_all_pages();
        foreach ($pages as $page) {
            if ($page->prevpageid == 0) {
                $pageid = $page->id;  // Find the first page id.
                break;
            }
        }

        // Current attempt number.
        if (!$ntries = $DB->count_records("lesson_grades", array("lessonid" => $this->properties->id, "userid" => $USER->id))) {
            $ntries = 0;  // May not be necessary.
        }

        $viewedpageids = array();
        if ($attempts = $this->get_attempts($ntries, false)) {
            foreach ($attempts as $attempt) {
                $viewedpageids[$attempt->pageid] = $attempt;
            }
        }

        $viewedbranches = array();
        // Collect all of the branch tables viewed.
        if ($branches = $this->get_content_pages_viewed($ntries, $USER->id, 'timeseen ASC', 'id, pageid')) {
            foreach ($branches as $branch) {
                $viewedbranches[$branch->pageid] = $branch;
            }
            $viewedpageids = array_merge($viewedpageids, $viewedbranches);
        }

        // Filter out the following pages:
        // - End of Cluster
        // - End of Branch
        // - Pages found inside of Clusters
        // Do not filter out Cluster Page(s) because we count a cluster as one.
        // By keeping the cluster page, we get our 1.
        $validpages = array();
        while ($pageid != 0) {
            $pageid = $pages[$pageid]->valid_page_and_view($validpages, $viewedpageids);
        }

        // Progress calculation as a percent.
        $progress = round(count($viewedpageids) / count($validpages), 2) * 100;
        return (int) $progress;
    }
1066546
public function hasPassed()
    {
        if($this->passed == false || $this->failed == true)
        {
            $this->passed = true;
            $this->failed = false;
        }
    }
629768
private void reportFailedCheckpoint(FailedCheckpointStats failed) {
		statsReadWriteLock.lock();
		try {
			counts.incrementFailedCheckpoints();
			history.replacePendingCheckpointById(failed);

			dirty = true;
		} finally {
			statsReadWriteLock.unlock();
		}
	}
315348
def global_unlock_percent(self):
        
        percent = CRef.cfloat()
        result = self._iface.get_ach_progress(self.name, percent)

        if not result:
            return 0.0

        return float(percent)
1046327
def percent_b(data, period, upper_bb_std=2.0, lower_bb_std=2.0):
    
    lb = lower_bollinger_band(data, period, lower_bb_std)
    ub = upper_bollinger_band(data, period, upper_bb_std)
    percent_b = ((np.array(data) - lb) / (ub - lb)) * 100
    return percent_b
990537
def percentile(self, lst_data, percent , key=lambda x:x):
        
        new_list = sorted(lst_data)
        #print('new list = ' , new_list)
        #n = float(len(lst_data))
        k = (len(new_list)-1) * percent
        f = math.floor(k)
        c = math.ceil(k)
        if f == c:
            #print(key(new_list[int(k)]))
            return key(new_list[int(k)])
        d0 = float(key(new_list[int(f)])) * (c-k)
        d1 = float(key(new_list[int(c)])) * (k-f)
        return d0+d1
540258
public function getCompletionPercent()
    {
        $percent = 0;

        if (($this->completed > 0) && ($this->completionTotal > 0)) {

            $percent = $this->completed / $this->completionTotal;
        }

        return $percent;
    }
1030293
function(browser) {
      return runner.runJsUnitTests(options.filter, browser).then(
          function(results) {
            var failedCount = results.reduce(function(prev, item) {
              return prev + (item['pass'] ? 0 : 1);
            }, 0);
            log(results.length + ' tests, ' + failedCount + ' failure(s).');
            log('[ ' + chalk.cyan(browser) + ' ] JSUnit tests: ',
                failedCount > 0 ? chalk.red('FAILED') : chalk.green('PASSED'));
            if (failedCount > 0) {
              throw new Error();
            }
          }, finalize);
    }