py2dag 0.1.11__tar.gz → 0.1.13__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.11 → py2dag-0.1.13}/PKG-INFO +1 -1
- {py2dag-0.1.11 → py2dag-0.1.13}/py2dag/parser.py +21 -6
- {py2dag-0.1.11 → py2dag-0.1.13}/pyproject.toml +1 -1
- {py2dag-0.1.11 → py2dag-0.1.13}/LICENSE +0 -0
- {py2dag-0.1.11 → py2dag-0.1.13}/README.md +0 -0
- {py2dag-0.1.11 → py2dag-0.1.13}/py2dag/__init__.py +0 -0
- {py2dag-0.1.11 → py2dag-0.1.13}/py2dag/cli.py +0 -0
- {py2dag-0.1.11 → py2dag-0.1.13}/py2dag/export_dagre.py +0 -0
- {py2dag-0.1.11 → py2dag-0.1.13}/py2dag/export_svg.py +0 -0
- {py2dag-0.1.11 → py2dag-0.1.13}/py2dag/pseudo.py +0 -0
@@ -66,17 +66,32 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
|
|
66
66
|
|
67
67
|
deps: List[str] = []
|
68
68
|
for arg in value.args:
|
69
|
-
if
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
69
|
+
if isinstance(arg, ast.Name):
|
70
|
+
if arg.id not in defined:
|
71
|
+
raise DSLParseError(f"Undefined dependency: {arg.id}")
|
72
|
+
deps.append(arg.id)
|
73
|
+
elif isinstance(arg, (ast.List, ast.Tuple)):
|
74
|
+
for elt in arg.elts:
|
75
|
+
if not isinstance(elt, ast.Name):
|
76
|
+
raise DSLParseError("List/Tuple positional args must be variable names")
|
77
|
+
if elt.id not in defined:
|
78
|
+
raise DSLParseError(f"Undefined dependency: {elt.id}")
|
79
|
+
deps.append(elt.id)
|
80
|
+
else:
|
81
|
+
raise DSLParseError("Positional args must be variable names or lists/tuples of names")
|
74
82
|
|
75
83
|
kwargs: Dict[str, Any] = {}
|
76
84
|
for kw in value.keywords:
|
77
85
|
if kw.arg is None:
|
78
86
|
raise DSLParseError("**kwargs are not allowed")
|
79
|
-
|
87
|
+
# Support variable-name keyword args as dependencies; literals remain in args
|
88
|
+
if isinstance(kw.value, ast.Name):
|
89
|
+
name = kw.value.id
|
90
|
+
if name not in defined:
|
91
|
+
raise DSLParseError(f"Undefined dependency: {name}")
|
92
|
+
deps.append(name)
|
93
|
+
else:
|
94
|
+
kwargs[kw.arg] = _literal(kw.value)
|
80
95
|
|
81
96
|
ops.append({"id": var_name, "op": op_name, "deps": deps, "args": kwargs})
|
82
97
|
elif isinstance(value, ast.JoinedStr):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|