refactor(master_data): 건설품셈 표형 요소·로직 열쇠 앞에 부문 — 「건축 1-1-1 계수」 · 「공통 8 기계 시간당 경비」
- 소요량 2059 · 계수 335 · 로직 1102 열쇠에 부문 붙임 · 찾기·로직 부르기 참조 모두 바꿈(산림품셈 로직 포함) - 검사 도구: 건설품셈 표·로직 열쇠에 부문 없으면 틀 알림 · 파일 사이 열쇠 겹침 검사 그대로 - M01 새 로직 열쇠에 부문 앞말 · _틀.md 규칙 · 시험 열쇠 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JgUhN55Z3BCYhUJTjwTNfj
This commit is contained in:
@@ -95,6 +95,14 @@ def _source_ok(source) -> bool:
|
||||
return isinstance(source, str) and bool(_SOURCE.match(source))
|
||||
|
||||
|
||||
def _division(name: str) -> str | None:
|
||||
"""건설품셈 표형 요소·로직 파일의 부문 — 열쇠 앞말(「건축 1-1-1 계수」)."""
|
||||
m = _FILE.match(name)
|
||||
if not m or m.group(2) != "건설품셈" or not m.group(3):
|
||||
return None
|
||||
return next((d for d in DIVISIONS if m.group(3).startswith(d)), None)
|
||||
|
||||
|
||||
def check_form(name: str, data: dict) -> list[str]:
|
||||
out = []
|
||||
m = _FILE.match(name)
|
||||
@@ -111,12 +119,15 @@ def check_form(name: str, data: dict) -> list[str]:
|
||||
if not isinstance(rows, list):
|
||||
return out + [f"{name} · 머리 「{'표' if table else '줄'}」 목록 없음"]
|
||||
seen = set()
|
||||
division = _division(name) if kind != "요소" else None
|
||||
for row in rows:
|
||||
key = str(row.get("열쇠"))
|
||||
where = f"{name} · {key}"
|
||||
if key in seen:
|
||||
out.append(f"{where} · 열쇠 겹침")
|
||||
seen.add(key)
|
||||
if division and not key.startswith(division + " "):
|
||||
out.append(f"{where} · 열쇠 앞에 부문 「{division}」 없음")
|
||||
for need in ROW_KEYS[kind]:
|
||||
if need not in row:
|
||||
out.append(f"{where} · 칸 「{need}」 없음")
|
||||
|
||||
Reference in New Issue
Block a user