mirror of
https://github.com/KenanZhu/AutoLibrary.git
synced 2026-06-18 15:33:03 +08:00
refactor(autoscript): 完善 Lua 错误分类与 Date/Time 严格校验,清理死代码并补齐类型注解
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -88,6 +88,8 @@ DATE_RELATIVE_OPTIONS = [
|
||||
DATE_OFFSET_UNITS = [
|
||||
("天", "days"),
|
||||
("周", "weeks"),
|
||||
# NOTE: "月" and "年" use fixed day counts (30 / 365), not calendar months/years,
|
||||
# because date_add() works with second-level offsets (n * 86400).
|
||||
("月", "months"),
|
||||
("年", "years"),
|
||||
]
|
||||
@@ -657,6 +659,8 @@ def _encodeDateOrTime(
|
||||
|
||||
s = raw_value.strip()
|
||||
up = s.upper()
|
||||
# Input comes from widget values — single binary expressions only (e.g. "A + 3",
|
||||
# "CURRENT_DATE + 5"). Multi-operator expressions are not produced by the UI.
|
||||
m_arith_spaced = re.match(r'^(.+?)\s+([+-])\s+(.+)$', s)
|
||||
m_arith_nospace = re.match(r'^([A-Za-z_]\w*)([+-])(\d+|[A-Za-z_]\w*)$', s)
|
||||
m_arith = m_arith_spaced or m_arith_nospace
|
||||
|
||||
Reference in New Issue
Block a user