chore(853-1): 자료 스크립트 한 번용 25 걷음 — 묶음 ④
- 지움(부르는 곳 = 서로뿐 · 효과는 자료에 반영 · 다시 돌릴 일 없음): _migrate_base · _migrate_keys · _건설기계_* 10 · build_로직_건설품셈_08장_건설기계 · _적용기준_나머지_* 2 · build_로직_건설품셈_01장_적용기준 · build_기계_인력줄_842_3 · build_기계목록_빠진기계_814_1 · build_기계시간당_822_2 · build_기계폴더_826_2 · build_로직_M01보강_794_2a2 · build_로직_기계줄나눔_848_4 · build_로직_잔토처리 · build_로직_재료_고르기 · build_품셈재료_고르기(대상 자료 없음) · master_draft 는 묶음 ② 에서 지움 - 옮김: _migrate_base.dump_master → master_keys.dump_master(글자 그대로) · 갱신 빌더 넷(인력 노임 · 유가전력 · 자재품목 · 환율) import 를 바꿈 - 남김(다시 돌리는 채우기 = 갱신 절차): build_기계_작업량_846_1 · build_단위표기_801_5 · build_변수기호_800_1 · build_변수표_796_3(+ 변수표_796_3.json) · build_용도 · build_재료_검색어 - 시험: test_814_1 기계 목록 시험은 빌더 plan() 대신 수식 문서 기본값만 봄 · test_826_2 는 옮김 빌더 대신 master_machine_files.write 왕복만 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -298,6 +298,24 @@ def dump_rows(head: dict, rows: list[dict]) -> str:
|
||||
return "\n".join(out + [" ]", "}"]) + "\n"
|
||||
|
||||
|
||||
def dump_master(path: Path, head: dict, rows: list[dict]) -> None:
|
||||
"""갱신 빌더 출력 — 머리는 들여쓰기 2칸 · 줄은 한 줄씩(길면 펼침) · UTF-8 · LF."""
|
||||
out = ["{"]
|
||||
for key, val in head.items():
|
||||
text = json.dumps(val, ensure_ascii=False, indent=2).replace("\n", "\n ")
|
||||
out.append(f" {json.dumps(key, ensure_ascii=False)}: {text},")
|
||||
out.append(' "줄": [')
|
||||
for i, row in enumerate(rows):
|
||||
line = json.dumps(row, ensure_ascii=False, separators=(", ", ": "))
|
||||
if len(line) <= 450:
|
||||
body = "{ " + line[1:-1] + " }"
|
||||
else:
|
||||
body = json.dumps(row, ensure_ascii=False, indent=2).replace("\n", "\n ")
|
||||
out.append(" " + body + ("," if i < len(rows) - 1 else ""))
|
||||
out += [" ]", "}"]
|
||||
path.write_bytes(("\n".join(out) + "\n").encode("utf-8"))
|
||||
|
||||
|
||||
def keep_text(text: str, old: dict, new: dict) -> str | None:
|
||||
"""글 모양 그대로 — 「열쇠」 칸(키·원문번호·갈래) · 바뀐 글 · 머리 부문·차례만 갈음 · 다르면 None."""
|
||||
rows_old, rows_new = old[_items(old)], new[_items(new)]
|
||||
|
||||
Reference in New Issue
Block a user