MCPcopy Index your code
hub / github.com/github/spec-kit / _write_shared_bytes

Function _write_shared_bytes

src/specify_cli/shared_infra.py:248–266  ·  view source on GitHub ↗
(
    project_path: Path,
    dest: Path,
    content: bytes,
    *,
    mode: int = 0o644,
)

Source from the content-addressed store, hash-verified

246
247
248def _write_shared_bytes(
249 project_path: Path,
250 dest: Path,
251 content: bytes,
252 *,
253 mode: int = 0o644,
254) -> None:
255 _ensure_safe_shared_destination(project_path, dest)
256 fd, temp_name = tempfile.mkstemp(prefix=f".{dest.name}.", dir=dest.parent)
257 temp_path = Path(temp_name)
258 try:
259 with os.fdopen(fd, "wb") as fh:
260 fh.write(content)
261 temp_path.chmod(mode)
262 _ensure_safe_shared_destination(project_path, dest)
263 os.replace(temp_path, dest)
264 finally:
265 if temp_path.exists():
266 temp_path.unlink()
267
268
269_BASH_FORMAT_COMMAND_RE = re.compile(

Callers 2

_write_shared_textFunction · 0.85
install_shared_infraFunction · 0.85

Calls 1

Tested by

no test coverage detected