Handles saving the statsfile if -s/--stats was specified.
(context: CliContext)
| 161 | |
| 162 | |
| 163 | def _save_stats(context: CliContext) -> None: |
| 164 | """Handles saving the statsfile if -s/--stats was specified.""" |
| 165 | if not context.stats_file_path: |
| 166 | return |
| 167 | assert context.stats_manager is not None |
| 168 | if context.stats_manager.is_save_required(): |
| 169 | path = get_and_create_path(context.stats_file_path, context.output) |
| 170 | logger.info("Saving frame metrics to stats file: %s", path) |
| 171 | with open(path, mode="w") as file: |
| 172 | context.stats_manager.save_to_csv(csv_file=file) |
| 173 | else: |
| 174 | logger.debug("No frame metrics updated, skipping update of the stats file.") |
| 175 | |
| 176 | |
| 177 | def _load_scenes(context: CliContext) -> tuple[SceneList, CutList]: |
no test coverage detected