refactor: 优化代码格式,调整多个文件中的换行和缩进
This commit is contained in:
1 parent
95b4517bdd
commit
d100ac0a66
11 files changed
+91
-40
No files matched your search
@@ -6,6 +6,7 @@
|
||||
|
||||
日志以逐行 JSON(NDJSON)格式追加到 `state/param_usage.json`,方便并发写入与后续分析。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import inspect
|
||||
@@ -20,7 +21,9 @@ try:
|
||||
except Exception:
|
||||
# 兜底:如果无法导入 path_config,则使用 workspace 相对的 state 目录
|
||||
def get_state_dir() -> str:
|
||||
return os.path.join(os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "state")
|
||||
return os.path.join(
|
||||
os.path.dirname(os.path.abspath(__file__)), os.pardir, os.pardir, "state"
|
||||
)
|
||||
|
||||
def ensure_dir(path: str) -> None:
|
||||
dir_path = os.path.dirname(path) if os.path.isfile(path) else path
|
||||
@@ -111,8 +114,10 @@ def track_call(include_args: bool = True) -> Callable[[Callable], Callable]:
|
||||
"ts": _now_ts(),
|
||||
"type": "call",
|
||||
"func_name": getattr(func, "__name__", str(func)),
|
||||
"def_file": getattr(func, "__code__", None) and func.__code__.co_filename,
|
||||
"def_line": getattr(func, "__code__", None) and func.__code__.co_firstlineno,
|
||||
"def_file": getattr(func, "__code__", None)
|
||||
and func.__code__.co_filename,
|
||||
"def_line": getattr(func, "__code__", None)
|
||||
and func.__code__.co_firstlineno,
|
||||
"call_file": call_site.get("file"),
|
||||
"call_line": call_site.get("lineno"),
|
||||
"call_func": call_site.get("function"),
|
||||
|
||||
Reference in new issue
Block a user