MCPcopy Create free account
hub / github.com/InfinitiBit/graphbit / _cleanup_migration

Method _cleanup_migration

scripts/legacy-migrator.py:347–374  ·  view source on GitHub ↗

Clean up migration artifacts (optional step).

(self)

Source from the content-addressed store, hash-verified

345 return False
346
347 def _cleanup_migration(self) -> bool:
348 """Clean up migration artifacts (optional step)."""
349 try:
350 # Clean up temporary files, logs, etc.
351 cleanup_items = []
352
353 # Example cleanup items
354 temp_files = list(self.root_path.glob("*.tmp"))
355 cleanup_items.extend(temp_files)
356
357 if not self.dry_run:
358 for item in cleanup_items:
359 if item.exists():
360 if item.is_file():
361 item.unlink()
362 elif item.is_dir():
363 shutil.rmtree(item)
364
365 if cleanup_items:
366 print(f" [CLEANUP] Cleaned up {len(cleanup_items)} temporary items")
367 else:
368 print(" [INFO] No cleanup items found")
369
370 return True
371
372 except Exception as e:
373 self.steps[6].error = str(e)
374 return False
375
376 def _load_migration_state(self):
377 """Load previous migration state if exists."""

Callers 1

_execute_stepMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected