- 새 master_sheet_line.annotate — master_text.lines 답에 줄마다 덧칸(줄 차례 = 호표 _shares 비목 · 뒤 덧줄) · 머리 기준단위(결과단위 분모) - 쓰는입력 = 수량 식 · 요소 · 덧줄 식이 쓰는 로직 입력(중간값 거슬러 감) · 기준단위 = 줄이 찾는 표 기준(712-3 basis) · 환산근거 = 표 기준배 ↔ 결과단위 배 · 재료 품목 단위 ↔ 줄 단위(712-2 note) - M01 /text = 새 Store_Sheet 가 감쌈(Store.py · master_text.py 700 줄 근처라 안 늘림) · M02 /logic-lib/sheet 줄 칸에 같은 KEYS - 지킴 시험 test_714_1_sheet_line(두 길 같은 덧칸) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
28 lines
1.3 KiB
Python
28 lines
1.3 KiB
Python
"""M01 `/text` 계산서 줄 덧칸(PLAN 714-1) — `store.text` 답에 줄마다 쓰는 입력 · 묶음 · 기준단위 ·
|
|
환산 근거(`master_sheet_line.annotate` — M02 `/logic-lib/sheet` 와 한 벌) · 서버 단독(③) · 저장 안 함.
|
|
`M01_MasterData_Store.py` 는 700 줄 근처라 여기서 감쌈."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from M01_MasterData import M01_MasterData_Store as store
|
|
|
|
mf = store.cm.mf
|
|
import master_sheet_line as msl # noqa: E402 — `store` 가 scripts 를 길에 둔 뒤
|
|
|
|
|
|
def text(key: str, inputs: dict, row: dict | None = None, file: str | None = None) -> dict:
|
|
got = store.text(key, inputs, row, file)
|
|
if not isinstance(got, dict) or not got.get("ok"):
|
|
return got
|
|
given = {k: store._dec(v) for k, v in inputs.items()}
|
|
try:
|
|
if row is None:
|
|
master = store.loaded()[1]
|
|
else: # 저장 전 시험 — `store.text` 와 같은 메모리 사본
|
|
files = store.cm.load(folder=store.FOLDER)
|
|
key = store._swap(files, str(row.get("키") or key), row, file)
|
|
master = mf.Master(files)
|
|
return msl.annotate(master, key, mf.fill_empty(master.logic(key), given), got)
|
|
except (mf.FormulaError, ArithmeticError, KeyError, TypeError, ValueError):
|
|
return got
|