def finish(cls): jobs = JSONObject() jobs.stats = [] for e in Stats.instances: job = JSONObject() job.name = e job.value = e.getvalue() jobs.stats.append(job) return jobs