fix(arch_diagram): 生成器自写尾换行(gen_net_pending/gen_memory)

gen_*.py 里 8 个已自带尾换行('...</svg>\n'),仅
gen_net_pending_svg.py 少一个尾 \n → 每次重跑都被 pre-commit 的
end-of-file-fixer 补回,产生无意义的 1 行尾差异。

- gen_net_pending_svg.py: return "\n".join(svg) + "\n",
  并把 open(...) 补 newline="\n"(与其余生成器一致)
- gen_memory_svg.py: open(...) 补 newline="\n"(输出本已带尾换行)

重跑验证:Net层阻塞模型.svg 与已提交 blob 逐字节一致
(hash-object --path 相同、git diff 为空);内存 3 张 SVG 亦无差异。
This commit is contained in:
2026-10-12 19:26:28 +08:00
parent 37f74f0b37
commit c9aa12e8bd
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -365,7 +365,7 @@ def main():
for filename, gen_func in targets:
path = os.path.join(out_dir, filename)
svg = gen_func()
with open(path, "w", encoding="utf-8") as f:
with open(path, "w", encoding="utf-8", newline="\n") as f:
f.write(svg)
print(f"OK: {filename} ({len(svg)} bytes)")
+2 -2
View File
@@ -284,13 +284,13 @@ def build():
'viewBox="0 0 %d %d" font-family="%s">' % (W, H, W, H, FONT)]
svg.extend(out)
svg.append('</svg>')
return "\n".join(svg)
return "\n".join(svg) + "\n"
def main():
svg = build()
os.makedirs(os.path.dirname(OUT), exist_ok=True)
with open(OUT, "w", encoding="utf-8") as f:
with open(OUT, "w", encoding="utf-8", newline="\n") as f:
f.write(svg)
print("已生成: %s (%d bytes)" % (OUT, len(svg.encode("utf-8"))))