fix: add 'from __future__ import annotations' for Python <3.10

PEP 585 内建泛型 (tuple[str, str], dict[str, int]) 在 Python 3.9 之前不支持。
PEP 563 让所有 type hint 变成字符串, 兼容 Python 3.7+。

错误: 'type' object is not subscriptable
影响: app.py:1184 start_email_scheduler() -> import mailer -> mailer.py:417
修复: mailer.py / app.py 顶部加 from __future__ import annotations
This commit is contained in:
Hermes
2026-07-08 12:13:31 +08:00
parent 535e5832ab
commit 187f37f8e7
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -10,6 +10,8 @@ Palladium Z1 Monitor — LD逻辑板使用监控系统
2. API 推送 — 在 Palladium 主机运行 collect.py 远程推送
"""
from __future__ import annotations # PEP 563: 兼容 Python 3.7+ (避免 PEP 585 泛型语法)
import os
import re
import io
+2
View File
@@ -5,6 +5,8 @@ mailer.py — Palladium Z1 每日报告邮件发送
所有配置都从环境变量读 (生产建议用 systemd EnvironmentFile 或 .env)。
"""
from __future__ import annotations # PEP 563: 让所有 type hint 变字符串, 兼容 Python 3.7+
import os
import smtplib
import socket