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:
dekun
2026-07-08 23:42:26 +08:00
parent aaa72c7961
commit b733e551a0
392 changed files with 71522 additions and 71369 deletions
+10 -10
View File
@@ -1,15 +1,15 @@
#!/usr/bin/env python3
"""
将三所共用的交易/关键位/轮询 env 写入币安OKX 的 .env缺失则追加不覆盖已有值)。
将三所共用的交易/关键位/轮询 env 写入币安,OKX 的 .env(缺失则追加,不覆盖已有值).
以 Gate .env.example 为基准Gate 自身也可运行以补缺失项
以 Gate .env.example 为基准;Gate 自身也可运行以补缺失项.
用法仓库根目录):
用法(仓库根目录):
python scripts/sync_common_trading_env.py
python scripts/sync_common_trading_env.py --dry-run
python scripts/sync_common_trading_env.py --instances crypto_monitor_okx
修改后须 pm2 restart 对应实例说明见 docs/env-sync-scripts.md
修改后须 pm2 restart 对应实例.说明见 docs/env-sync-scripts.md
"""
from __future__ import annotations
@@ -24,7 +24,7 @@ DEFAULT_INSTANCES = (
"crypto_monitor_okx",
)
# 与 crypto_monitor_gate/.env.example 对齐不含 GATE_* / 各所 API 密钥
# 与 crypto_monitor_gate/.env.example 对齐(不含 GATE_* / 各所 API 密钥)
SHARED_DEFAULTS: dict[str, str] = {
"TRADING_DAY_RESET_OPEN_GUARD_ENABLED": "true",
"KEY_CONFIRM_BREAKOUT_BAR": "-2",
@@ -54,7 +54,7 @@ SHARED_DEFAULTS: dict[str, str] = {
"AI_TIMEOUT_SECONDS": "120",
}
# 仅 Gate 启用 0 点强制清仓币安/OKX 须保持关闭
# 仅 Gate 启用 0 点强制清仓;币安/OKX 须保持关闭
FORCE_CLOSE_POLICY: dict[str, dict[str, str]] = {
"crypto_monitor_gate": {
"FORCE_CLOSE_ENABLED": "true",
@@ -131,7 +131,7 @@ def sync_one(dir_name: str, *, dry_run: bool, force: bool) -> bool:
def apply_force_close_policy(*, dry_run: bool) -> bool:
"""Gate 开启强制清仓币安/OKX 强制关闭覆盖已有值)。"""
"""Gate 开启强制清仓;币安/OKX 强制关闭(覆盖已有值)."""
any_changed = False
for dir_name, values in FORCE_CLOSE_POLICY.items():
path = os.path.join(REPO, dir_name, ".env")
@@ -160,13 +160,13 @@ def apply_force_close_policy(*, dry_run: bool) -> bool:
def main() -> None:
ap = argparse.ArgumentParser(description="同步币安/OKX 共用 trading env缺失项追加")
ap = argparse.ArgumentParser(description="同步币安/OKX 共用 trading env(缺失项追加)")
ap.add_argument("--dry-run", action="store_true")
ap.add_argument("--force", action="store_true", help="覆盖已有值慎用")
ap.add_argument("--force", action="store_true", help="覆盖已有值(慎用)")
ap.add_argument(
"--apply-force-close-policy",
action="store_true",
help="Gate 开启 0 点强制清仓币安/OKX 强制关闭",
help="Gate 开启 0 点强制清仓,币安/OKX 强制关闭",
)
ap.add_argument(
"--instances",