Args:

            audit_results: results of `AxeCoreAudit.do_audit()`.

        Returns:

            A dictionary with keys "errors" and "total".
432269
def get_errors(audit_results):
        
        errors = {"errors": [], "total": 0}
        if audit_results:
            errors["errors"].extend(audit_results)
            for i in audit_results:
                for _node in i["nodes"]:
                    errors["total"] += 1
        return errors
849719
def _calc_validation_statistics(validation_results):
    
    # calc stats
    successful_expectations = sum(exp["success"] for exp in validation_results)
    evaluated_expectations = len(validation_results)
    unsuccessful_expectations = evaluated_expectations - successful_expectations
    success = successful_expectations == evaluated_expectations
    try:
        success_percent = successful_expectations / evaluated_expectations * 100
    except ZeroDivisionError:
        success_percent = float("nan")

    return ValidationStatistics(
        successful_expectations=successful_expectations,
        evaluated_expectations=evaluated_expectations,
        unsuccessful_expectations=unsuccessful_expectations,
        success=success,
        success_percent=success_percent,
    )
312284
def format_result(result):
    """"""
    instance = None
    error = None

    if result["instance"] is not None:
        instance = format_instance(result["instance"])

    if result["error"] is not None:
        error = format_error(result["error"])

    result = {
        "success": result["success"],
        "plugin": format_plugin(result["plugin"]),
        "instance": instance,
        "error": error,
        "records": format_records(result["records"]),
        "duration": result["duration"]
    }

    if os.getenv("PYBLISH_SAFE"):
        schema.validate(result, "result")

    return result
750909
def current(report):
  
  if hasattr(report, "completed"):
    if report.completed:
      print("Report completed")
    else:
      print("REPORT NOT COMPLETED")
  else:
    warnings.warn("This report does not indicate whether it is completed. Support for reports without a `completed`"
                  "field may be dropped on or after 2019-05-11.")
  for key in report:
    covered = report[key].confidence > 0.5
    wrong = 1. - report[key].correctness
    failure_rate = (covered * wrong).mean()
    print(key, 'failure rate at t=.5', failure_rate)
    print(key, 'accuracy at t=0', report[key].correctness.mean())
205830
def get_failed_requests(self, results):
        
        data = {member['guid']: member for member in results}
        for request in self.requests:
            if request['guid'] not in data:
                yield request
86572
def _check_result_dict_for_needed_keys(self, results_dict):
        
        missing_cols = [x for x in needed_result_keys if x not in results_dict]
        if missing_cols != []:
            msg = "The following keys are missing from results_dict\n{}"
            raise ValueError(msg.format(missing_cols))
        return None
337867
def GetResults(self):
    
    results = []
    for hasher in self._hashers:
      logger.debug('Processing results for hasher {0:s}'.format(hasher.NAME))
      result = analyzer_result.AnalyzerResult()
      result.analyzer_name = self.NAME
      result.attribute_name = '{0:s}_hash'.format(hasher.NAME)
      result.attribute_value = hasher.GetStringDigest()
      results.append(result)
    return results
892819
def _dict_of_results(self):
        
        result_json = {}

        result_list = []
        for r in self.results:
            result_list.append({
                'name': r.check_name,
                'ok': r.ok,
                'status': r.status,
                'description': r.description,
                'message': r.message,
                'reference_url': r.reference_url,
                'logs': r.logs,
            })
        result_json["checks"] = result_list
        return result_json
420099
def get_results_range(self):
        
        spec = self.context.getResultsRange()
        if spec:
            return dicts_to_dict(spec, "keyword")
        return ResultsRangeDict()
958657
def get_task_results(self):
        

        results = self.get_task_results_without_format()
        if options.tunnel.string_as_binary:
            return compat.OrderedDict([(k, bytes(result)) for k, result in six.iteritems(results)])
        else:
            return compat.OrderedDict([(k, str(result)) for k, result in six.iteritems(results)])
107749
def get_audits():
    
    audits = [AptConfig([{'key': 'APT::Get::AllowUnauthenticated',
                          'expected': 'false'}])]

    settings = get_settings('os')
    clean_packages = settings['security']['packages_clean']
    if clean_packages:
        security_packages = settings['security']['packages_list']
        if security_packages:
            audits.append(RestrictedPackages(security_packages))

    return audits
516446
def ticket_audits_list(self, cursor=None, **kwargs):
        ""
        api_path = "/api/v2/ticket_audits.json"
        api_query = {}
        if "query" in kwargs.keys():
            api_query.update(kwargs["query"])
            del kwargs["query"]
        if cursor:
            api_query.update({
                "cursor": cursor,
            })
        return self.call(api_path, query=api_query, **kwargs)
1280672
def file_audit_list(self, project):
        
        project_list = False
        self.load_project_flag_list_file(il.get('project_exceptions'), project)
        try:
            default_list = set((fl['file_audits']['file_names']))
        except KeyError:
            logger.error('Key Error processing file_names list values')
        try:
            project_list = set((fl['file_audits'][project]['file_names']))
            logger.info('Loaded %s specific file_audits entries', project)
        except KeyError:
            logger.info('No project specific file_names section for project %s', project)

        file_names_re = re.compile("|".join(default_list),
                                   flags=re.IGNORECASE)

        if project_list:
            file_names_proj_re = re.compile("|".join(project_list),
                                            flags=re.IGNORECASE)
            return file_names_re, file_names_proj_re
        else:
            file_names_proj_re = re.compile("")
            return file_names_re, file_names_proj_re
294810
def result
      if success?
        results = to_hash['results'] || []
        count == 1 ? results.first : results
      else
        Etsy.silent_errors ? [] : validate!
      end
    end
567416
def print_schema_results(results, level=0):
    
    for error in results.errors:
        print_level(logger.error, _RED + "[X] %s", level, error)
792239
def collect_results(working_folder):
    
    results = {} 
    working_folder = Path(working_folder)
    output_folders = working_folder/'output_folders'

    for rec_name in os.listdir(output_folders):
        if not os.path.isdir(output_folders / rec_name):
            continue
        # print(rec_name)
        results[rec_name] = {}
        for sorter_name in os.listdir(output_folders / rec_name):
            # print('  ', sorter_name)
            output_folder = output_folders / rec_name / sorter_name
            #~ print(output_folder)
            if not os.path.isdir(output_folder):
                continue
            SorterClass = sorter_dict[sorter_name]
            results[rec_name][sorter_name] = SorterClass.get_result_from_folder(output_folder)

    return results
61452
def check_errors(cls, score_groups, verbose):
        '''
        
        '''
        errors_occurred = False
        for checker, rpair in score_groups.items():
            errors = rpair[-1]
            if len(errors):
                errors_occurred = True
                print("WARNING: The following exceptions occured during the %s checker (possibly indicate compliance checker issues):" % checker, file=sys.stderr)
                for check_name, epair in errors.items():
                    print("%s.%s: %s" % (checker, check_name, epair[0]), file=sys.stderr)

                    if verbose > 0:
                        traceback.print_tb(epair[1].tb_next.tb_next)    # skip first two as they are noise from the running itself @TODO search for check_name
                        print(file=sys.stderr)

        return errors_occurred