Best Python code snippet using prospector_python
mota.py
Source:mota.py
...38 nmap = {}39 for m, n in zip(metrics, names):40 nmap[m] = n41 summary = mh.compute(acc, metrics=metrics, name=vid)42 strsummary = mm.io.render_summary(43 summary,44 formatters=mh.formatters,45 namemap=nmap46 )47 file.write(strsummary + '\n\n')48''' # Compute metrics for multiple accumulators or accumulator views49 summary = mh.compute_many(50 [acc, acc.events.loc[0:1]],51 metrics=['num_frames', 'mota', 'motp'],52 names=['full', 'part'])53 print("\nsummary:\n",summary)54 # Reformat column names and how column values are displayed55 strsummary = mm.io.render_summary(56 summary,57 formatters={'mota': '{:.2%}'.format},58 namemap={'mota': 'MOTA', 'motp': 'MOTP'}59 )60 print("\nstrsummary:\n",strsummary)61 # Predefined metric selectors, formatters and metric names62 summary = mh.compute_many(63 [acc, acc.events.loc[0:1]],64 metrics=mm.metrics.motchallenge_metrics,65 names=['full', 'part'])66 strsummary = mm.io.render_summary(67 summary,68 formatters=mh.formatters,69 namemap=mm.io.motchallenge_metric_names70 )71 print("\nstrsummary:\n",strsummary)72 # Overall summary that computes the metrics jointly over all accumulators73 summary = mh.compute_many(74 [acc, acc.events.loc[0:1]],75 metrics=mm.metrics.motchallenge_metrics,76 names=['full', 'part'],77 generate_overall=True78 )79 strsummary = mm.io.render_summary(80 summary,81 formatters=mh.formatters,82 namemap=mm.io.motchallenge_metric_names83 )...
test_summary.py
Source:test_summary.py
1import tempfile2from pathlib import Path3from judge.rendering.summary import render_summary as rs4from judge.schema import History, JudgeStatus, TestCasePath5def render_summary() -> None:6 with tempfile.TemporaryDirectory() as _tempdir:7 tempdir = Path(_tempdir) / "abc000_a"8 tempdir.mkdir(parents=True, exist_ok=True)9 temp_in = tempdir / "temp.in"10 temp_out = tempdir / "temp.out"11 with temp_in.open("wb") as f:12 f.write(b"1 2 3")13 with temp_out.open("wb") as f:14 f.write(b"3164\n1111")15 histories = [16 History(17 status,18 TestCasePath(19 f"sample-{i}",20 temp_in,21 temp_out if status != JudgeStatus.RE else None,22 ),23 output=b"123\n456\n" if status != JudgeStatus.RE else b"",24 exitcode=0 if status != JudgeStatus.RE else 1,25 elapsed=10 if status == JudgeStatus.TLE else 1,26 memory=15 if status == JudgeStatus.MLE else 1,27 )28 for i, status in enumerate(JudgeStatus)29 ]30 rs(histories)31def test_rendering_summary():...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!