refactor(828-2): 판 일위 재료는 828-1 M02_San_Ilwi.materials 한 길 — 내 겹친 ilwi_found 걷음

- 43e945568 합침에서 census 겹침 = sub3 판(호표 = 코드 숫자) 채택 · test_828_2 판 시험을 그 길로

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-13 20:57:05 +09:00
co-authored by Claude Opus 5.5
parent 1136bc047f
commit 9ec50f8ed5
2 changed files with 6 additions and 24 deletions
-21
View File
@@ -73,27 +73,6 @@ def from_book(rows: Any) -> list[dict]:
return _uniq(out)
def ilwi_found(saved: dict) -> list[tuple[dict, dict]]:
"""둘 꼴 「일위」 구성 줄(828 · 엑셀 일위대가표 숨은 칸 · STC 구성표) 자재 줄 → [(일위 블록, 자원)] ·
단위 % 자원(잡재료비 「재료비의 %」) 뺌 · 자원 `재료찾기` = 산근 줄과 같은 판정(`M02_San_Link.m01` · 단서 = 파일 단서 + 대가 머리)."""
from M02_MasterTemplete.M02_San_Link import m01
out = []
for blk in saved.get("일위") or []:
head = f"{blk.get('이름') or ''} {blk.get('규격') or ''}"
with clues_on(saved.get("단서"), head):
for ln in blk.get("줄") or []:
if (
ln.get("갈래") != "M" or not ln.get("이름") or "%" in str(ln.get("단위"))
): # % = 율 자원
continue
res = {"꼴": saved.get("꼴"), "갈래": "재료", "코드": ln.get("코드") or ""}
res |= {k: ln.get(k) or "" for k in ("이름", "규격", "단위")}
m01("재료", res)
out.append((blk, res))
return out
def _uniq(rows: list[dict]) -> list[dict]:
seen, out = set(), []
for r in rows:
@@ -141,8 +141,11 @@ def test_one_reader_three_users():
def test_census_ilwi_materials():
"""판 일위 자재 줄 = 828-1 `M02_San_Ilwi.materials`(원파일 · 엑셀 같은 길) — 엑셀 구성 줄도 셈."""
from M02_MasterTemplete import M02_San_Ilwi as si
path = golden.FILES["영덕계류"]
saved = fn.pack(sx.read_sheets(_sheets("영덕계류")), path.name)
got = mf.ilwi_found(saved)
assert len(got) == 4 and all(r["재료찾기"]["판정"] for _, r in got)
assert {b["코드"] for b, _ in got} == {"B01107"}
got = list(si.materials(saved))
assert len(got) == 4 and all(r["재료찾기"]["판정"] for _, _, r in got)
assert {b["코드"] for b, _, _ in got} == {"B01107"}