py2dag 0.1.10__tar.gz → 0.1.12__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {py2dag-0.1.10 → py2dag-0.1.12}/PKG-INFO +1 -1
- {py2dag-0.1.10 → py2dag-0.1.12}/py2dag/parser.py +11 -2
- {py2dag-0.1.10 → py2dag-0.1.12}/pyproject.toml +1 -1
- {py2dag-0.1.10 → py2dag-0.1.12}/LICENSE +0 -0
- {py2dag-0.1.10 → py2dag-0.1.12}/README.md +0 -0
- {py2dag-0.1.10 → py2dag-0.1.12}/py2dag/__init__.py +0 -0
- {py2dag-0.1.10 → py2dag-0.1.12}/py2dag/cli.py +0 -0
- {py2dag-0.1.10 → py2dag-0.1.12}/py2dag/export_dagre.py +0 -0
- {py2dag-0.1.10 → py2dag-0.1.12}/py2dag/export_svg.py +0 -0
- {py2dag-0.1.10 → py2dag-0.1.12}/py2dag/pseudo.py +0 -0
@@ -76,7 +76,14 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
|
|
76
76
|
for kw in value.keywords:
|
77
77
|
if kw.arg is None:
|
78
78
|
raise DSLParseError("**kwargs are not allowed")
|
79
|
-
|
79
|
+
# Support variable-name keyword args as dependencies; literals remain in args
|
80
|
+
if isinstance(kw.value, ast.Name):
|
81
|
+
name = kw.value.id
|
82
|
+
if name not in defined:
|
83
|
+
raise DSLParseError(f"Undefined dependency: {name}")
|
84
|
+
deps.append(name)
|
85
|
+
else:
|
86
|
+
kwargs[kw.arg] = _literal(kw.value)
|
80
87
|
|
81
88
|
ops.append({"id": var_name, "op": op_name, "deps": deps, "args": kwargs})
|
82
89
|
elif isinstance(value, ast.JoinedStr):
|
@@ -171,9 +178,11 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
|
|
171
178
|
returned_var = const_id
|
172
179
|
else:
|
173
180
|
raise DSLParseError("return must return a variable name or literal")
|
174
|
-
elif isinstance(stmt, (ast.For, ast.AsyncFor, ast.While)):
|
181
|
+
elif isinstance(stmt, (ast.For, ast.AsyncFor, ast.While, ast.If)):
|
175
182
|
# Ignore control flow blocks; only top-level linear statements are modeled
|
176
183
|
continue
|
184
|
+
elif isinstance(stmt, (ast.Pass,)):
|
185
|
+
continue
|
177
186
|
else:
|
178
187
|
raise DSLParseError("Only assignments, expression calls, and a final return are allowed in function body")
|
179
188
|
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|