From 9e260a252e2c5acf5957ccf667cdaae26eac682a Mon Sep 17 00:00:00 2001 From: umsangdon Date: Wed, 18 Nov 2026 00:37:30 +0900 Subject: [PATCH] =?UTF-8?q?refactor(857-2):=20=EB=B6=88=EB=9F=AC=EC=98=A4?= =?UTF-8?q?=EA=B8=B0=EA=B0=80=20M01=20=EA=B8=B0=EC=B4=88=20=EC=9D=B4?= =?UTF-8?q?=EB=A6=84=ED=91=9C=20=C2=B7=20=EA=B8=B0=EA=B3=84=20=EA=B3=A0?= =?UTF-8?q?=EB=A5=B4=EA=B8=B0=EB=A5=BC=20=EC=88=98=EC=8B=9D=20=EB=AC=B8?= =?UTF-8?q?=EC=84=9C=EC=97=90=EC=84=9C=20=EC=9D=BD=EC=9D=8C(L2=20=E2=93=92?= =?UTF-8?q?)=20=E2=80=94=20=EB=A1=9C=EC=A7=81=20=EC=A4=84=20=EC=9D=BD?= =?UTF-8?q?=EA=B8=B0=203=20=E2=86=92=200?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `M02_Hopyo_Clause._named`(구분 · 원문번호 → 기초 이름) · `M02_Hopyo_Match._targets`(기초 키 · 이름 · 구분) = `M01_MasterData_Doc.docs()` 이름표(855 L1) - `M02_Hopyo_Units.mach_logics` 기계 고르기 = 문서 「기계」 선택 변수 목록(옛 = 로직 줄 `입력.고르기`) - 같은 값 확인 — 문서 1,521 이름 · 구분 · 원문번호 = 로직 줄(차례까지 같음) · 기계 기초 4 고르기 목록 같음 · 캐시 열쇠에 문서 묶음 더함 Co-Authored-By: Claude Opus 5.5 --- M02_MasterTemplete/M02_Hopyo_Clause.py | 15 +++++++-------- M02_MasterTemplete/M02_Hopyo_Match.py | 11 ++++++----- M02_MasterTemplete/M02_Hopyo_Units.py | 10 ++++++---- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/M02_MasterTemplete/M02_Hopyo_Clause.py b/M02_MasterTemplete/M02_Hopyo_Clause.py index c33ac48c0..d84115bf3 100644 --- a/M02_MasterTemplete/M02_Hopyo_Clause.py +++ b/M02_MasterTemplete/M02_Hopyo_Clause.py @@ -12,6 +12,7 @@ import re from functools import lru_cache from typing import Any +from M01_MasterData import M01_MasterData_Doc as m01_doc from M01_MasterData import M01_MasterData_Store as m01 from M01_MasterData import M01_MasterData_Store_Make as make @@ -62,14 +63,12 @@ def _sections(book: str) -> dict[tuple[str, str], str]: @lru_cache(maxsize=2) -def _named(whole_id: int) -> dict[tuple[str, str], list[str]]: - """{(구분, 원문번호): [로직 이름]} — M01 로직.""" +def _named(whole_id: int, docs_id: int) -> dict[tuple[str, str], list[str]]: + """{(구분, 원문번호): [기초 이름]} — M01 수식 문서 이름표(855 L1 · `M01_MasterData_Doc.docs`).""" out: dict[tuple[str, str], list[str]] = {} - for data in m01.loaded()[0].values(): - if data.get("그룹") == "로직": - for row in data.get("줄") or []: - key = (str(row.get("구분") or ""), str(row.get("원문번호") or "").split(" ")[0]) - out.setdefault(key, []).append(str(row.get("이름") or "")) + for doc in m01_doc.docs().values(): + key = (str(doc.get("구분") or ""), str(doc.get("원문번호") or "").split(" ")[0]) + out.setdefault(key, []).append(str(doc.get("이름") or "")) return out @@ -79,7 +78,7 @@ def _part(number: str, name: Any, text: Any = "") -> str: 둘 이상 = 모름 · 없음 = 「(옛)」(번호 뜻 안 맞음).""" if not _grams(name): return "건설품셈" - named = _named(id(m01.loaded()[1])) + named = _named(id(m01.loaded()[1]), id(m01_doc.docs())) texts = { part: [title, *named.get((f"건설품셈 {part}", no), [])] for (part, no), title in _sections("건설품셈").items() diff --git a/M02_MasterTemplete/M02_Hopyo_Match.py b/M02_MasterTemplete/M02_Hopyo_Match.py index 8812f201f..1f6c8e65c 100644 --- a/M02_MasterTemplete/M02_Hopyo_Match.py +++ b/M02_MasterTemplete/M02_Hopyo_Match.py @@ -17,6 +17,7 @@ from functools import lru_cache from pathlib import Path from typing import Any +from M01_MasterData import M01_MasterData_Doc as m01_doc from M01_MasterData import M01_MasterData_Store as m01 from M01_MasterData import M01_MasterData_Store_Combo as combo_store from M02_MasterTemplete import M02_Mat_Place as place @@ -206,10 +207,10 @@ def _grams(text: str) -> set[str]: @lru_cache(maxsize=2) -def _targets(whole_id: int) -> dict[str, Any]: - """로직(돈) · 자재품목 — 정규 이름 · 정리 이름 · 묶음 · 단위.""" - files, whole = m01.loaded() - rows = [r for d in files.values() if d.get("그룹") == "로직" for r in d.get("줄") or []] +def _targets(whole_id: int, docs_id: int) -> dict[str, Any]: + """기초(돈) · 자재품목 — 정규 이름 · 정리 이름 · 묶음 · 단위 · 기초 이름표 = M01 수식 문서(855 L1).""" + whole = m01.loaded()[1] + rows = list(m01_doc.docs().values()) pills = combo_store.combo_pills({"담은로직": [{"로직": r.get("키")} for r in rows]})["물량"] unit_of = {code: pill["단위"] for pill in pills for code in pill["로직"]} # 돈 로직만 logics, mats = [], [] @@ -253,7 +254,7 @@ def _targets(whole_id: int) -> dict[str, Any]: def targets() -> dict[str, Any]: - return _targets(id(m01.loaded()[1])) + return _targets(id(m01.loaded()[1]), id(m01_doc.docs())) def _seeds() -> dict[str, set[str]]: diff --git a/M02_MasterTemplete/M02_Hopyo_Units.py b/M02_MasterTemplete/M02_Hopyo_Units.py index 9afeee449..825636c5a 100644 --- a/M02_MasterTemplete/M02_Hopyo_Units.py +++ b/M02_MasterTemplete/M02_Hopyo_Units.py @@ -20,6 +20,7 @@ from __future__ import annotations import re from typing import Any +from M01_MasterData import M01_MasterData_Doc as m01_doc from M02_MasterTemplete import M02_Hopyo_Elem as elem from M02_MasterTemplete import M02_Hopyo_Fixed as hfix from M02_MasterTemplete import M02_Elem_Alias as ea @@ -66,11 +67,12 @@ def mach_logics(whole: Any, kinds: set, eq: dict | None = None) -> list[str]: has = mcrew.view(eq.get("값")) if isinstance(eq.get("값"), dict) else {} if solo := SOLO.get((bool(has.get("주연료")), bool(has.get("조종원")))): return [solo] - eqs = whole.numbers.get("EQ", {}) + eqs, docs = whole.numbers.get("EQ", {}), m01_doc.docs() - def takes(code: str) -> bool: - ins = whole.logic(code).get("입력") or [] - opts = next((s.get("고르기") or [] for s in ins if s.get("이름") == MACH_IN), []) + def takes(code: str) -> bool: # 기초 수식 문서 기계 고르기 변수(855 L1) 목록 + ins = (docs.get(code) or {}).get("변수") or [] + pick = [(s.get("연결") or {}) for s in ins if s.get("이름") == MACH_IN] + opts = next((p.get("목록") or [] for p in pick if p.get("갈래") == "선택"), []) same = any((eqs.get(o) or {}).get("이름") == eq.get("이름") for o in opts) return eq.get("원문번호") in opts or same