py2dag 0.1.8__tar.gz → 0.1.9__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.8 → py2dag-0.1.9}/PKG-INFO +1 -1
- {py2dag-0.1.8 → py2dag-0.1.9}/py2dag/parser.py +12 -3
- {py2dag-0.1.8 → py2dag-0.1.9}/pyproject.toml +1 -1
- {py2dag-0.1.8 → py2dag-0.1.9}/LICENSE +0 -0
- {py2dag-0.1.8 → py2dag-0.1.9}/README.md +0 -0
- {py2dag-0.1.8 → py2dag-0.1.9}/py2dag/__init__.py +0 -0
- {py2dag-0.1.8 → py2dag-0.1.9}/py2dag/cli.py +0 -0
- {py2dag-0.1.8 → py2dag-0.1.9}/py2dag/export_dagre.py +0 -0
- {py2dag-0.1.8 → py2dag-0.1.9}/py2dag/export_svg.py +0 -0
- {py2dag-0.1.8 → py2dag-0.1.9}/py2dag/pseudo.py +0 -0
@@ -101,6 +101,15 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
|
|
101
101
|
"deps": deps,
|
102
102
|
"args": {"template": template},
|
103
103
|
})
|
104
|
+
elif isinstance(value, (ast.Constant, ast.List, ast.Tuple, ast.Dict)):
|
105
|
+
# Allow assigning JSON-serialisable literals directly
|
106
|
+
lit = _literal(value)
|
107
|
+
ops.append({
|
108
|
+
"id": var_name,
|
109
|
+
"op": "CONST.value",
|
110
|
+
"deps": [],
|
111
|
+
"args": {"value": lit},
|
112
|
+
})
|
104
113
|
else:
|
105
114
|
raise DSLParseError("Right hand side must be a call or f-string")
|
106
115
|
defined.add(var_name)
|
@@ -144,9 +153,9 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
|
|
144
153
|
if var not in defined:
|
145
154
|
raise DSLParseError(f"Undefined return variable: {var}")
|
146
155
|
returned_var = var
|
147
|
-
elif isinstance(stmt.value, ast.Constant):
|
148
|
-
# Support returning a literal (
|
149
|
-
lit = stmt.value
|
156
|
+
elif isinstance(stmt.value, (ast.Constant, ast.List, ast.Tuple, ast.Dict)):
|
157
|
+
# Support returning a JSON-serialisable literal (str/num/bool/None, list/tuple, dict)
|
158
|
+
lit = _literal(stmt.value)
|
150
159
|
const_id_base = "return_value"
|
151
160
|
const_id = const_id_base
|
152
161
|
n = 1
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|