Normalize fullwidth punctuation to ASCII across codebase.
Add scripts/normalize_ambiguous_unicode.py; fix corrupted patch_instance_theme_templates.py. Preserves curly quotes in string literals; removes Git homoglyph warnings on .env.example. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
"""整点强制清仓(FORCE_CLOSE_*):UI 标识与持仓倒计时。"""
|
||||
"""整点强制清仓(FORCE_CLOSE_*):UI 标识与持仓倒计时."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
@@ -45,7 +45,7 @@ def is_force_close_active_hour(
|
||||
tz_name: Optional[str] = None,
|
||||
grace_minutes: int = FORCE_CLOSE_GRACE_MINUTES,
|
||||
) -> bool:
|
||||
"""当前是否处于整点强制清仓执行窗口(整点起 grace 分钟内)。"""
|
||||
"""当前是否处于整点强制清仓执行窗口(整点起 grace 分钟内)."""
|
||||
return is_force_close_executing(
|
||||
bj_hour,
|
||||
now_ms=now_ms,
|
||||
@@ -96,7 +96,7 @@ def is_close_at_force_close_window(
|
||||
grace_minutes: int = FORCE_CLOSE_GRACE_MINUTES,
|
||||
tz_name: Optional[str] = None,
|
||||
) -> bool:
|
||||
"""平仓时刻是否落在北京时间整点强制清仓窗口内。"""
|
||||
"""平仓时刻是否落在北京时间整点强制清仓窗口内."""
|
||||
dt = parse_closed_at_dt(closed_at, tz_name=tz_name)
|
||||
if dt is None:
|
||||
return False
|
||||
@@ -133,7 +133,7 @@ def coerce_force_close_result(
|
||||
grace_minutes: int = FORCE_CLOSE_GRACE_MINUTES,
|
||||
tz_name: Optional[str] = None,
|
||||
) -> tuple[str, str]:
|
||||
"""同步平仓归类:整点窗口内优先记为强制清仓。"""
|
||||
"""同步平仓归类:整点窗口内优先记为强制清仓."""
|
||||
res = (result or "").strip()
|
||||
note = (miss_reason or "").strip()
|
||||
if res == FORCE_CLOSE_RESULT:
|
||||
@@ -161,7 +161,7 @@ def apply_force_close_display_result(
|
||||
grace_minutes: int = FORCE_CLOSE_GRACE_MINUTES,
|
||||
tz_name: Optional[str] = None,
|
||||
) -> str:
|
||||
"""展示层:外部平仓/手动平仓若落在整点窗口,显示为强制清仓。"""
|
||||
"""展示层:外部平仓/手动平仓若落在整点窗口,显示为强制清仓."""
|
||||
res = (result or "").strip()
|
||||
if res == FORCE_CLOSE_RESULT:
|
||||
return res
|
||||
@@ -183,7 +183,7 @@ def compute_next_force_close_at_ms(
|
||||
now_ms: Optional[int] = None,
|
||||
tz_name: Optional[str] = None,
|
||||
) -> Optional[int]:
|
||||
"""下一次强制清仓时刻(北京时间整点)的 epoch 毫秒。"""
|
||||
"""下一次强制清仓时刻(北京时间整点)的 epoch 毫秒."""
|
||||
hour = normalize_force_close_bj_hour(bj_hour)
|
||||
now = _now_dt(now_ms=now_ms, tz_name=tz_name)
|
||||
target = now.replace(hour=hour, minute=0, second=0, microsecond=0)
|
||||
@@ -226,7 +226,7 @@ def build_force_close_state(
|
||||
tz_name: Optional[str] = None,
|
||||
has_active_positions: Optional[bool] = None,
|
||||
) -> dict[str, Any]:
|
||||
"""实例级强制清仓状态(模板 / API 共用)。"""
|
||||
"""实例级强制清仓状态(模板 / API 共用)."""
|
||||
if not enabled:
|
||||
return {
|
||||
"enabled": False,
|
||||
@@ -282,7 +282,7 @@ def apply_force_close_to_payload(
|
||||
now_ms: Optional[int] = None,
|
||||
tz_name: Optional[str] = None,
|
||||
) -> None:
|
||||
"""为 active 持仓 JSON 附加整点强制清仓倒计时。"""
|
||||
"""为 active 持仓 JSON 附加整点强制清仓倒计时."""
|
||||
state = build_force_close_state(
|
||||
enabled,
|
||||
bj_hour,
|
||||
|
||||
Reference in New Issue
Block a user