42 lines
1.7 KiB
Python
42 lines
1.7 KiB
Python
"""One functional benefic/malefic snapshot for the engine, API, and MCP.
|
|
|
|
This module is not ``functional_benefics.py``. That file is part of the
|
|
rectification freeze and must stay byte-for-byte unchanged.
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
from typing import Any
|
|
|
|
|
|
def functional_layer_for_ascendant(ascendant: Any) -> dict[str, Any]:
|
|
"""Return the functional layer for an ascendant payload.
|
|
|
|
A dict uses its ``sign``. Anything else is a missing sign and follows
|
|
the normal ``derive_functional_benefic_malefic`` blocked result.
|
|
Import or calculation failures return the engine's blocked shape.
|
|
The exception text stays inside ``effect_on_confidence`` because that
|
|
field already did; callers must not write this dict to a log.
|
|
"""
|
|
try:
|
|
try:
|
|
from functional_benefics import derive_functional_benefic_malefic
|
|
except ModuleNotFoundError:
|
|
from scripts.functional_benefics import derive_functional_benefic_malefic
|
|
|
|
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
|
|
return derive_functional_benefic_malefic(sign)
|
|
except Exception as exc:
|
|
sign = ascendant.get("sign") if isinstance(ascendant, dict) else None
|
|
return {
|
|
"status": "blocked",
|
|
"ascendant": sign,
|
|
"functional_benefics": [],
|
|
"functional_malefics": [],
|
|
"functional_neutrals": [],
|
|
"yogakarakas": [],
|
|
"owned_houses": {},
|
|
"effect_on_confidence": f"未完成功能性吉凶星判定,需降低高严谨结论置信度: {exc}",
|
|
"source": "strict_functional_benefic_malefic_v2",
|
|
}
|