Пример #1
0
def print_results(analyzers, results_all, out):
    base = os.path.join(out, 'statistics')
    yaml_data = dtu.yaml_dump_pretty(results_all)
    dtu.write_data_to_file(yaml_data, os.path.join(base, 'statistics.yaml'))
    print(dtu.indent(yaml_data, 'print_results '))

    for a in analyzers:
        dtu.write_data_to_file(dtu.yaml_dump_pretty(results_all[a]),
                               os.path.join(base, '%s.table.yaml' % a))
        s = ""
        s += '\n' + '-' * 10 + ' Results for %s ' % a + '-' * 10
        table = table_for_analyzer(results_all[a])
        s += '\n' + dtu.indent(dtu.format_table_plus(table, colspacing=3),
                               '  ')
        s += '\n'
        dtu.write_data_to_file(s, os.path.join(base, '%s.table.txt' % a))
Пример #2
0
def format_instances(family, colorize, verbose=False):
    if not family.instances:
        s = ('No instances files found for family "%s" (pattern = %s).\n\n' %
             (family.family_name, family.instances_pattern))
        return s
    else:
        s = ('Found %d instances of algorithm family "%s":\n' %
             (len(family.instances), family.family_name))
        table = []
        table.append([
            'Instance name', 'constructor', 'parameters', 'description',
            'filename'
        ])
        for _ in family.instances.values():
            row = []
            name = _.instance_name
            if (not _.valid) and colorize:
                name = dtu.make_red(name)

            row.append(name)

            row.append(_.constructor)
            row.append(dtu.yaml_dump_pretty(_.parameters))

            row.append(_.description)
            row.append(dtu.friendly_path(_.filename))

            table.append(row)

        if not verbose:
            dtu.remove_table_field(table, 'filename')
            dtu.remove_table_field(table, 'description')
        s += dtu.indent(dtu.format_table_plus(table, colspacing=4), '| ')

        for _ in family.instances.values():
            if not _.valid:
                msg = _.error_if_invalid
                s += dtu.make_red('\n' +
                                  dtu.indent(msg, '', _.instance_name + ': '))

        return s
Пример #3
0
    def __init__(self,
                 logs,
                 processors=[],
                 analyzers=[],
                 checks=[],
                 topic_videos=[],
                 topic_images=[]):
        self.logs = logs

        self.processors = []
        for p in processors:
            p = copy.deepcopy(p)
            processor = p.pop('processor')
            prefix_in = p.pop('prefix_in', '')
            prefix_out = p.pop('prefix_out', '')
            if p:
                msg = 'Extra keys: %s' % p
                raise ValueError(msg)
            p2 = ProcessorEntry(prefix_in=prefix_in,
                                processor=processor,
                                prefix_out=prefix_out)
            self.processors.append(p2)

        self.analyzers = analyzers
        self.topic_videos = topic_videos
        self.topic_images = topic_images

        check_isinstance(checks, list)

        try:
            self.cwcs = parse_list_of_checks(checks)
        except RTParseError as e:
            msg = 'Cannot parse list of checks.'
            msg += '\n' + dtu.indent(dtu.yaml_dump_pretty(checks), '',
                                     'parsing: ')
            dtu.raise_wrapped(RTParseError, e, msg, compact=True)
Пример #4
0
def yaml_from_rdbe(r):
    d = OrderedDict()
    d['description'] = 'The result of running a unit test'
    d['constructor'] = 'easy_regression.rdbe_from_yaml'
    d['parameters'] = r._asdict()
    return dtu.yaml_dump_pretty(d)