MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / _write_lf

Function _write_lf

scripts/code-verify.py:2492–2497  ·  view source on GitHub ↗

Write text to path as UTF-8 with LF line endings on every platform. Strips any stray \\r before encoding and writes via write_bytes so Python's text-mode translation on Windows can't sneak CRLF in.

(path: Path, text: str)

Source from the content-addressed store, hash-verified

2490
2491
2492def _write_lf(path: Path, text: str) -> None:
2493 """Write text to path as UTF-8 with LF line endings on every platform.
2494 Strips any stray \\r before encoding and writes via write_bytes so
2495 Python's text-mode translation on Windows can't sneak CRLF in."""
2496 normalized = text.replace("\r\n", "\n").replace("\r", "\n")
2497 path.write_bytes(normalized.encode("utf-8"))
2498
2499
2500def _write_report(report_path: Path, flag_only: list[Violation]) -> None:

Callers 2

_write_reportFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected