Upload alpha_factory/deterministic/lint.py
Browse files
alpha_factory/deterministic/lint.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
"""
|
| 2 |
Static Lint v3 — Layer 2: Deterministic pre-flight checks.
|
| 3 |
-
|
| 4 |
"""
|
| 5 |
import re
|
| 6 |
from pathlib import Path
|
|
@@ -103,7 +103,7 @@ def lint(expression: str, operators_path: Path = Path("data/operators.csv")) ->
|
|
| 103 |
found_ops = re.findall(r"\b([a-z_]+)\s*\(", expression.lower())
|
| 104 |
for op in found_ops:
|
| 105 |
if op not in ALLOWED_OPS and op not in {"if", "and", "or", "not"}:
|
| 106 |
-
errors.append(f"Unknown operator: '{op}' — not in
|
| 107 |
|
| 108 |
# CHECK 3: Look-ahead detection
|
| 109 |
for pattern in LOOKAHEAD_PATTERNS:
|
|
|
|
| 1 |
"""
|
| 2 |
Static Lint v3 — Layer 2: Deterministic pre-flight checks.
|
| 3 |
+
Validates operator ARITY (argument count) to catch 'Invalid number of inputs' errors.
|
| 4 |
"""
|
| 5 |
import re
|
| 6 |
from pathlib import Path
|
|
|
|
| 103 |
found_ops = re.findall(r"\b([a-z_]+)\s*\(", expression.lower())
|
| 104 |
for op in found_ops:
|
| 105 |
if op not in ALLOWED_OPS and op not in {"if", "and", "or", "not"}:
|
| 106 |
+
errors.append(f"Unknown operator: '{op}' — not in catalog")
|
| 107 |
|
| 108 |
# CHECK 3: Look-ahead detection
|
| 109 |
for pattern in LOOKAHEAD_PATTERNS:
|