MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / reset_directory

Function reset_directory

tasks/scripts/sync_docs_website.py:87–99  ·  view source on GitHub ↗
(src: Path, dst: Path, *, preserve_components: bool)

Source from the content-addressed store, hash-verified

85
86
87def reset_directory(src: Path, dst: Path, *, preserve_components: bool) -> None:
88 ensure_existing(src, "source directory")
89 preserved_components: Path | None = None
90 if preserve_components and (dst / "_components").is_dir():
91 preserved_components = Path(tempfile.mkdtemp()) / "_components"
92 shutil.copytree(dst / "_components", preserved_components)
93 if dst.exists():
94 shutil.rmtree(dst)
95 shutil.copytree(src, dst)
96 if preserved_components is not None:
97 if (dst / "_components").exists():
98 shutil.rmtree(dst / "_components")
99 shutil.copytree(preserved_components, dst / "_components")
100
101
102def merge_directory(src: Path, dst: Path, *, overwrite: bool) -> None:

Callers 1

sync_docsFunction · 0.85

Calls 2

ensure_existingFunction · 0.85
existsMethod · 0.80

Tested by

no test coverage detected