MCPcopy Create free account
hub / github.com/Open-Bee/DataStudio / export_json

Method export_json

datastudio/utils/statistics.py:465–488  ·  view source on GitHub ↗

Export statistics to JSON file. Args: output_path: Output file path (default: work_dir/stats.json) Returns: Path to exported JSON file

(self, output_path: Optional[str] = None)

Source from the content-addressed store, hash-verified

463 return output_path
464
465 def export_json(self, output_path: Optional[str] = None) -> str:
466 """
467 Export statistics to JSON file.
468
469 Args:
470 output_path: Output file path (default: work_dir/stats.json)
471
472 Returns:
473 Path to exported JSON file
474 """
475 if output_path is None:
476 output_path = os.path.join(self.work_dir, "pipeline_stats.json")
477
478 output_dir = os.path.dirname(output_path)
479 if output_dir:
480 os.makedirs(output_dir, exist_ok=True)
481
482 summary = self.get_summary()
483
484 with open(output_path, "w", encoding="utf-8") as f:
485 json.dump(summary, f, indent=2, ensure_ascii=False)
486
487 self.logger.info(f"Statistics exported to: {output_path}")
488 return output_path
489
490
491# Global instance

Callers 3

test_export_jsonMethod · 0.80

Calls 3

get_summaryMethod · 0.95
dumpMethod · 0.80
infoMethod · 0.80

Tested by 3

test_export_jsonMethod · 0.64