feat(826-2): M01 기계 = 한 대 한 파일 · M01 저장 길 줄이기
- 기계.json 한 파일 → 폴더 기계/(EQ 키마다 파일 + _머리.json · 차례 = 키 차례) · 옮긴 빌더 build_기계폴더_826_2 (655 대 머리 · 줄 · 차례 대조 뒤 옛 파일 지움) - 읽기 도우미 master_machine_files — cm.load · Store_Cache · Store.read 가 옛 「기계.json」 한 표 꼴로 지어 줌(API · 화면 · 색인 그대로) · 쓰기 = 바뀐 대 파일만 - 기계.json 직접 열던 곳 도우미로: M02_San_Basis_Index · M02_Logic_Standard 지문 · build_용도 · master_keys.adopt · _틀 · _갱신절차 - 저장 몸 M01_MasterData_Store_Save — 전 = 기억 · 후 = 고친 파일만 얕은 사본 · 틀은 고친 줄만 · 조합 · 일위대가 문서는 로직 줄이 빠질 때만 · 재료 찾기 기억 이어받음 · 저장 뒤 쓴 파일만 기억에 갈아 끼움 - 마스터 사본 시험 22 개 = 기계 폴더도 복사 · 821_2 · 815_2 글 대조 = 대 파일 하나 대조(옛 한 파일 글 대조 낡음) - 새 시험 test_826_2 — 폴더 = 한 표 · 한 대 한 파일 · 새 · 지움 · 409 · 옛 길과 같은 오류 스무 견본 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,6 +11,8 @@ import re
|
||||
from decimal import Decimal
|
||||
from pathlib import Path
|
||||
|
||||
import master_machine_files as mmf # 기계 = 폴더(826-2)
|
||||
|
||||
MASTER = Path(__file__).resolve().parent.parent
|
||||
BOOK = MASTER / "_키대장.json"
|
||||
KEY = re.compile(r"[A-Z]{2}\d{6}")
|
||||
@@ -399,7 +401,8 @@ def adopt(folder: Path = MASTER) -> list[str]:
|
||||
if group in MERGED:
|
||||
file, slot, labels = MERGED[group]
|
||||
label = labels[src]
|
||||
whole = _read(folder / file) if (folder / file).is_file() else {"그룹": group}
|
||||
there = (folder / file).is_file() or (file == mmf.NAME and mmf.here(folder))
|
||||
whole = mmf.read(folder, file) if there else {"그룹": group}
|
||||
heads = whole.setdefault(slot, {})
|
||||
heads[label] = {k: v for k, v in data.items() if k not in ("그룹", "줄")}
|
||||
stamped = [
|
||||
@@ -418,7 +421,11 @@ def adopt(folder: Path = MASTER) -> list[str]:
|
||||
new = {**head, **rest, _items(data): stamped}
|
||||
old_text = path.read_text(encoding="utf-8")
|
||||
text = keep_text(old_text, data, new) or _store().dump(new)
|
||||
(folder / target).write_text(text, encoding="utf-8", newline="\n")
|
||||
if target == mmf.NAME: # 기계 = 한 대 한 파일(826-2)
|
||||
mmf.write(folder, {**{k: v for k, v in whole.items() if k != "줄"}, "줄": rows_all})
|
||||
(folder / target).unlink(missing_ok=True)
|
||||
else:
|
||||
(folder / target).write_text(text, encoding="utf-8", newline="\n")
|
||||
if target != path.name:
|
||||
path.unlink()
|
||||
done.append(target)
|
||||
|
||||
Reference in New Issue
Block a user