def test(self): r = Report() r.create_report(onweb=False) # test setter r.filename = "index.html" r.directory = "report" r._init_report()
def name(self): name = Report.name(self) if self.configs: name += '-' + '+'.join(self.configs) if self.suite: name += '-' + '+'.join(self.suite) name += '-' + self.resolution[0] name += '-' + self.report_type return name
def test_local(self): # here we test if a local template works and if # a name different from index.html works temp_filename = "example.html" with open(temp_filename, "w") as fin: fin.write("{{ test }}") try: r = Report(".", template_filename=temp_filename) r.jinja['test'] = 'youpi' r.create_report(onweb=False) with open("report/index.html", "r") as fin: data = fin.read() assert data == 'youpi' except Exception: raise Exception finally: # cleanup os.remove(temp_filename)
def __init__(self, parser=ReportArgParser(parents=[report_type_parser])): parser.add_argument('-c', '--configs', type=tools.csv, help='only use specified configurations (e.g. WORK-ou,WORK-yY). ' 'If none specified, use all found configs') parser.add_argument('-s', '--suite', type=tools.csv, help=downward_suites.HELP) Report.__init__(self, parser) if self.configs: self.name_parts.append('+'.join(self.configs)) if self.suite: self.name_parts.append('+'.join(self.suite)) if self.suite: self.problems = downward_suites.build_suite(self.suite) else: self.problems = [] def filter_by_problem(run): """ If suite is set, only process problems from the suite, otherwise process all problems """ return any(prob.domain == run['domain'] and prob.problem == run['problem'] for prob in self.problems) def filter_by_config(run): """ If configs is set, only process those configs, otherwise process all configs """ return any(config == run['config'] for config in self.configs) filter_funcs = [] if self.configs: filter_funcs.append(filter_by_config) if self.problems: filter_funcs.append(filter_by_problem) if filter_funcs: self.data.filter(*filter_funcs)
def generateStatistics(self, currentBatch = None): chdirOrDie(self.dirStructure.resultsDir) report = Report(self, currentBatch) report.generateFullReport() if report.canCompile(): print "Compiling report..." report.compile()
def test_report_properties(self): role_counts = { 'admin': 1, 'manager': 3, 'author': 5, 'reviewer': 6, 'visitor': 3 } report = Report(user_count=10, document_count=3, user_count_by_roles=role_counts, import_count=0, export_count=4) self.assertEqual(report.user_count, 10) self.assertEqual(report.document_count, 3) self.assertEqual(report.user_count_by_roles, role_counts) self.assertEqual(report.import_count, 0) self.assertEqual(report.export_count, 4)
def __init__(self, parser=ReportArgParser()): parser.set_defaults(output_format='tex') parser.add_argument('focus', choices=SCORES, help='the analyzed attribute (e.g. "expanded"). ' 'The "attributes" parameter is ignored') parser.add_argument('--squeeze', action='store_true', help='Use small fonts to fit in more data') parser.add_argument('--no-best', action='store_false', dest='best_value_column', help='Do not add a column with best known score') parser.add_argument('--page-size', choices=['a2', 'a3', 'a4'], default='a4', help='Set the page size for the latex report') Report.__init__(self, parser) self.extension = 'tex' self.name_parts.append(self.focus) self.focus_name = self.focus self.normalize = True self.score = 'score_' + self.focus if self.focus == 'coverage': self.focus = 'cost' self.score = 'coverage' elif self.focus == 'quality': self.focus = 'cost' self.score = 'quality' logging.info('Using score attribute "%s"' % self.score) logging.info('Adding column with best value: %s' % self.best_value_column) # Get set of configs self.configs = tools.natural_sort(self.data.group_dict('config').keys()) self.total_scores = self._compute_total_scores()
elif args.ticket == 'check' and args.filename: tickets.ticket_files(args.filename) elif args.comment: package.post_comment(args.comment) elif args.verify and args.verify != 'verify' and not args.config and not args.query and not args.filename: package.single_ticket(args.verify, export) elif args.verify == 'verify' and args.config and args.query and not args.filename: package.multiple_tickets(args.config, args.query) elif args.verify == 'verify' and args.filename: package.host_list_verify(args.filename) elif args.filename and not args.verify: tickets.filename(args.filename) elif args.new: config.config_create(args.new) elif args.example == 'example': Example.example() else: jira_query = "None has been set" print( colored( "Wrong input! please use --help or --example to learn more about program", 'red')) config = Config() package = Package() tickets = Ticket() report = Report() if __name__ == '__main__': main()
def test_report_creation(self): report = Report()
def get_queryset(self, *args, **kwargs): return [i for i in Report.list()]
def __init__(self, parser=ReportArgParser(parents=[report_type_parser])): parser.add_argument( '-c', '--configs', nargs='*', default=[], help= 'planner configurations (if none specified, use all found configs)' ) parser.add_argument( '-s', '--suite', nargs='*', default=[], help='tasks, domains or suites (if none specified, use whole suite)' ) parser.add_argument('--res', default='domain', dest='resolution', help='resolution of the report', choices=['suite', 'domain', 'problem']) parser.add_argument('--filter', nargs='*', default=[], help='filters will be applied as follows: ' \ 'expanded:lt:100 -> only process if run[expanded] < 100') Report.__init__(self, parser) self.focus = None self.output = '' # For some attributes only compare commonly solved tasks self.commonly_solved_foci = [ 'expanded', 'generated', 'plan_length', 'search_time', 'total_time' ] info = 'Report only commonly solved problems for %s' info %= self.commonly_solved_foci self.add_info(info) self.problems = downward_suites.build_suite(self.suite) def filter_by_problem(run): """ If suite is set, only process problems from the suite, otherwise process all problems """ if not self.problems: return True for problem in self.problems: if problem.domain == run['domain'] and problem.problem == run[ 'problem']: return True return False def filter_by_config(run): """ If configs is set, only process those configs, otherwise process all configs """ if not self.configs: return True for config in self.configs: if config == run['config']: return True return False self.add_filter(filter_by_problem, filter_by_config) self.parse_filters()
def report(rtype): if not isinstance(rtype, int): return "Expected an integer value. Exiting" elif rtype == 1: repo = get_repos() report = Report(repo=repo).user_languages() return out2csv(report, '../reports/issue_contrib.csv') elif rtype == 2: pulls = get_prs() report = Report(pulls=pulls).pr_ratios() return out2csv(report, '../reports/open_closed_merged_prs.csv') elif rtype == 3: pulls = get_prs(state='closed') report = Report(pulls=pulls).pr_ratios() return out2csv(report, '../reports/closed_merged_prs.csv') elif rtype == 4: pulls = get_prs() report = Report(pulls=pulls).contribution_count() return out2csv(report, '../reports/positive_negative_pr_contributions.csv') elif rtype == 5: pulls = get_prs() report = Report(pulls=pulls).repo_maintenance() return out2csv(report, '../reports/repo_maintenance.csv') elif rtype == 6: repo = get_repos() report = Report(repo=repo).open_issues() return out2csv(report, '../reports/issue_assignees.csv') elif rtype == 7: repo = get_repos() report = Report(repo=repo).issue_comments() return out2csv(report, '../closed_issue_comments.csv') elif rtype == 8: #This is a heavy computation. Limiting to 10 PRs, as we're analyzing each sentence #in each comment in a single PR pulls = get_prs(limit=100) report = Report(pulls=pulls).pr_sentiment() return out2csv(report, '../reports/sentiment_analysis.csv') elif rtype == 9: pulls = get_prs(limit=500) report = Report(pulls=pulls).pr_report() return out2csv(report, '../reports/pr_report_closed.csv') elif rtype == 10: repo = get_repos() pulls = get_prs(limit=50) report = Report(pulls=pulls, repo=repo).sentiment_repo_report() fname = '../reports/pr_sentiment_report.csv' if fexists(Path(fname)): return out2csv(report, '../reports/pr_sentiment_report.csv', "a") else: return out2csv(report, '../reports/pr_sentiment_report.csv', "w+") elif rtype == 12: pulls = get_prs(state='all', limit=100) report = Report(pulls=pulls).parse() return out2csv(report, '../reports/100_json_pulls.csv') return True
import mraa import mqtt import time import string import os import json from reports import Report from threading import Timer from datetime import datetime import MonashAirSense_config as Conf # fields = Conf.fields #Initiate shared variable values = Conf.values #Initiate shared variable timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") local_report = Report('/root', timestamp[0], timestamp[1]) def upload_data(): #After upload_data is first run, it is run again at the specified interval Timer(Conf.MQTT_interval, upload_data, ()).start() #Formats and sends data over MQTT timestamp = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S") pairs = timestamp.split(" ") values["meta"]["date"] = pairs[0] #Date values["meta"]["time"] = pairs[1] #Time values["meta"]["timestamp"] = time.time() msg = json.dumps(values) #Convert to JSON for sending to server. #Initiate and send MQTT MQTT = mqtt.mqtt(Conf.MQTT_broker, Conf.MQTT_port,