mirror of
https://github.com/esphome/esphome.git
synced 2026-05-10 05:37:55 +08:00
[helpers] Document write_file's external consumer contract (esphome-device-builder) (#16290)
This commit is contained in:
@@ -465,6 +465,12 @@ def _write_file(
|
||||
|
||||
|
||||
def write_file(path: Path, text: str | bytes, private: bool = False) -> None:
|
||||
"""Atomically write text or bytes to path. Wraps OSError as EsphomeError.
|
||||
|
||||
Used by esphome-device-builder for in-place YAML rewrites; the
|
||||
atomicity (sibling tempfile + shutil.move) and EsphomeError
|
||||
wrapping are part of the public contract.
|
||||
"""
|
||||
try:
|
||||
_write_file(path, text, private=private)
|
||||
except OSError as err:
|
||||
|
||||
Reference in New Issue
Block a user