MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _rename

Function _rename

tests/test_cli_export.py:20–30  ·  view source on GitHub ↗

Rename a directory, retrying briefly: on Windows a virus scanner or indexer can hold a just-written file open and fail the rename with PermissionError.

(src: Path, dst: Path)

Source from the content-addressed store, hash-verified

18
19
20def _rename(src: Path, dst: Path) -> None:
21 """Rename a directory, retrying briefly: on Windows a virus scanner or indexer
22 can hold a just-written file open and fail the rename with PermissionError."""
23 for attempt in range(20):
24 try:
25 src.rename(dst)
26 return
27 except PermissionError:
28 if attempt == 19:
29 raise
30 time.sleep(0.25)
31
32
33def _run(args: list[str], cwd: Path, env: dict[str, str] | None = None) -> subprocess.CompletedProcess:

Calls

no outgoing calls

Tested by

no test coverage detected