From b9ab67c1c2065ca3537e446434b6eba21120dcae Mon Sep 17 00:00:00 2001 From: kjh2064 Date: Mon, 15 Jun 2026 02:38:00 +0900 Subject: [PATCH] =?UTF-8?q?JSON=20=EC=A7=81=EB=A0=AC=ED=99=94=20=EC=95=88?= =?UTF-8?q?=EC=A0=95=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- runtime/refactor_baseline_v1.yaml | 6 +++--- src/quant_engine/convert_xlsx_to_json.py | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/runtime/refactor_baseline_v1.yaml b/runtime/refactor_baseline_v1.yaml index ed753cb..ce0a6f6 100644 --- a/runtime/refactor_baseline_v1.yaml +++ b/runtime/refactor_baseline_v1.yaml @@ -1,9 +1,9 @@ { "formula_id": "AUDIT_REPOSITORY_ENTROPY_V2", "gate": "PASS", - "total_file_count": 1697, + "total_file_count": 1703, "package_script_count": 17, - "temp_json_count": 159, + "temp_json_count": 160, "budget": { "schema_version": "repository_entropy_budget.v1", "max_total_files": 2200, @@ -15,5 +15,5 @@ "keep package scripts within release envelope" ] }, - "source_zip_sha256": "4de4a7b1217ef5d5375b3b1ea1209f738719e79c4c3c0954e9e96a9dc0d8607e" + "source_zip_sha256": "b992c6e54eae1b3b5ccf822d25a902dfcf10dc7a4fec93a902ff920d1cbd02b0" } \ No newline at end of file diff --git a/src/quant_engine/convert_xlsx_to_json.py b/src/quant_engine/convert_xlsx_to_json.py index f0c6854..e2b08db 100644 --- a/src/quant_engine/convert_xlsx_to_json.py +++ b/src/quant_engine/convert_xlsx_to_json.py @@ -115,7 +115,7 @@ def clean_scalar(value: Any) -> Any: return None if isinstance(value, float) and math.isnan(value): return None - if isinstance(value, (pd.Timestamp, dt.datetime, dt.date)): + if isinstance(value, (pd.Timestamp, dt.datetime, dt.date, dt.time)): return value.isoformat() if hasattr(value, "item"): try: @@ -125,6 +125,17 @@ def clean_scalar(value: Any) -> Any: return value +def _json_default(value: Any) -> Any: + if isinstance(value, (pd.Timestamp, dt.datetime, dt.date, dt.time)): + return value.isoformat() + if hasattr(value, "item"): + try: + return _json_default(value.item()) + except Exception: + pass + return str(value) + + def normalize_code(value: Any) -> str: value = clean_scalar(value) if value in (None, ""): @@ -1585,7 +1596,7 @@ def convert_xlsx_to_json(xlsx_path: Path, output_path: Path) -> None: # Recompute checksum invariants after any blueprint mutation patch. result["data"]["_harness_context"] = ensure_extended_harness_defaults(result["data"]["_harness_context"]) - output_path.write_text(json.dumps(result, ensure_ascii=False, indent=2), encoding="utf-8") + output_path.write_text(json.dumps(result, ensure_ascii=False, indent=2, default=_json_default), encoding="utf-8") print(f"Conversion complete: {output_path}")