Triforce v0.2.0

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ruckus7382sfgsgdf
2026-11-10 19:32:48 -06:00
commit 34b3683441
1730 changed files with 554853 additions and 0 deletions

19
nx2/whole_write.py Normal file
View File

@@ -0,0 +1,19 @@
"""(issue 1197) A lifted C file rewritten in place (the patches, the chunk split) is written beside it and moved over it: a run
stopped mid-write (the builder closed, a second build stopping the first, a full disk) leaves the old file whole, never the first
megabytes of the new one, which the compile then stopped on at every try ("g_module_b" where g_module_base was)."""
import os
import time
def write_whole(path, text, newline="\n"):
tmp = path + ".part"
with open(tmp, "w", encoding="utf-8", newline=newline) as f:
f.write(text)
for attempt in range(20): # (an antivirus reading the file holds it a moment: Windows refuses the move until it lets go)
try:
os.replace(tmp, path)
return
except PermissionError:
if attempt == 19:
raise
time.sleep(0.25)