feat(713-3): M01 로직 목록 묶음 접기 — 같은 절 · 작업량 로직은 머리 줄 밑으로 접음(접기 순수 함수 logic/list_fold) · 찾는 중엔 펼침 · 「관련」 열 = 비고가 가리키는 로직 링크(계산 밖) · 서버 덧칸 인재경 줄 수(712-1 master_bundle) · 지킴 시험
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -5,16 +5,20 @@
|
||||
- `작업량` = 돈 아닌 로직(`결과` 칸) · `부모` = 그 작업량을 부르는 로직(목록에서 그 밑으로 접음).
|
||||
- `부르는수` · `불리는수` = 로직끼리 부르기(기계경비 포함 · `Store_Cache.counted`).
|
||||
- `관련` = 비고 글의 절 번호(「1-5-6(주③)」 · 「별도」 참조)가 가리키는 로직 — 계산 밖 링크.
|
||||
- `인재경` = 호표 · 덧줄 줄 수 `{인력, 재료, 경비, 하위}`(712-1 `master_bundle.bundle` 한 벌).
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib
|
||||
import re
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
from M01_MasterData import M01_MasterData_Store as store
|
||||
from M01_MasterData import M01_MasterData_Store_Cache as cache
|
||||
|
||||
mbd = importlib.import_module("master_bundle") # `store` 가 scripts 를 길에 둔 뒤
|
||||
|
||||
_REF = re.compile(
|
||||
r"(?:(산림품셈|건설품셈)\s*(공통|토목|건축|기계설비|유지관리)?\s*)?(?<![\d.-])(\d+-\d+(?:-\d+)*)"
|
||||
)
|
||||
@@ -41,9 +45,14 @@ def _related(row: dict, book: tuple[str, str], by_section: dict) -> list[str]:
|
||||
return list(out)
|
||||
|
||||
|
||||
def _bundles(whole, row: dict) -> dict[str, int]:
|
||||
got = Counter(mbd.bundle(whole, x)[0] for x in [*row.get("호표", []), *row.get("덧줄", [])])
|
||||
return {name: got.get(name, 0) for name in mbd.BUNDLES}
|
||||
|
||||
|
||||
def extras() -> dict[str, dict]:
|
||||
"""로직 키 → 덧칸 — 목록 전체로 셈(거른 목록이어도 묶음 수 · 부르는 수는 전체 기준)."""
|
||||
files, _ = store.loaded()
|
||||
files, whole = store.loaded()
|
||||
rows = [
|
||||
(name, data, row)
|
||||
for name, data in files.items()
|
||||
@@ -77,6 +86,7 @@ def extras() -> dict[str, dict]:
|
||||
"부르는수": len(calls.get(key, ())),
|
||||
"불리는수": called.get(key, 0),
|
||||
"관련": _related(row, _book(data), by_section),
|
||||
"인재경": _bundles(whole, row),
|
||||
}
|
||||
return out
|
||||
|
||||
@@ -92,5 +102,6 @@ def attach(logics: list[dict]) -> list[dict]:
|
||||
"부르는수": 0,
|
||||
"불리는수": 0,
|
||||
"관련": [],
|
||||
"인재경": dict.fromkeys(mbd.BUNDLES, 0),
|
||||
}
|
||||
return [{**one, **more.get(str(one.get("키")), blank)} for one in logics]
|
||||
|
||||
Reference in New Issue
Block a user