py2dag 0.1.7__py3-none-any.whl → 0.1.9__py3-none-any.whl
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/parser.py +12 -3
- {py2dag-0.1.7.dist-info → py2dag-0.1.9.dist-info}/METADATA +2 -2
- {py2dag-0.1.7.dist-info → py2dag-0.1.9.dist-info}/RECORD +6 -6
- {py2dag-0.1.7.dist-info → py2dag-0.1.9.dist-info}/LICENSE +0 -0
- {py2dag-0.1.7.dist-info → py2dag-0.1.9.dist-info}/WHEEL +0 -0
- {py2dag-0.1.7.dist-info → py2dag-0.1.9.dist-info}/entry_points.txt +0 -0
py2dag/parser.py
CHANGED
@@ -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
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: py2dag
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.9
|
4
4
|
Summary: Convert Python function plans to DAG (JSON, pseudo, optional SVG).
|
5
5
|
License: MIT
|
6
6
|
Author: rvergis
|
@@ -117,7 +117,7 @@ This repo includes a GitHub Actions workflow that publishes to PyPI when you pus
|
|
117
117
|
|
118
118
|
```
|
119
119
|
make patch # bumps version, commits, and tags vX.Y.Z
|
120
|
-
make release # pushes tags to GitHub (triggers publish)
|
120
|
+
make release # pushes commits and tags to GitHub (triggers publish)
|
121
121
|
```
|
122
122
|
|
123
123
|
Or push tags manually:
|
@@ -2,10 +2,10 @@ py2dag/__init__.py,sha256=i8VB44JCVcRJAcvnQtbH8YVRUz5j7dE355iRbikXPGQ,250
|
|
2
2
|
py2dag/cli.py,sha256=BCBi5mNxOqeEN8uEMt_hiDx0iSt7ZE3y74cGXREzZ2I,1296
|
3
3
|
py2dag/export_dagre.py,sha256=S244wUxBMuM9qXD8bklaslkMp3rcbBGWvMhwWVBzBF0,3487
|
4
4
|
py2dag/export_svg.py,sha256=YyjqOuj8GhUTDWP70SKnnSWAKI1PvJwyOhHLwB29uNM,1812
|
5
|
-
py2dag/parser.py,sha256
|
5
|
+
py2dag/parser.py,sha256=-Q4FK6aM6bzi5-z5LY7jRYJqCrqY8tjxi9c5tWFEpKc,10257
|
6
6
|
py2dag/pseudo.py,sha256=NJK61slyFLtSjhj8gJDJneUInEpBN57_41g8IfHNPWI,922
|
7
|
-
py2dag-0.1.
|
8
|
-
py2dag-0.1.
|
9
|
-
py2dag-0.1.
|
10
|
-
py2dag-0.1.
|
11
|
-
py2dag-0.1.
|
7
|
+
py2dag-0.1.9.dist-info/LICENSE,sha256=3Qee1EPwej_nusovTbyIQ8LvD2rXHdM0c6LNwk_D8Kc,1067
|
8
|
+
py2dag-0.1.9.dist-info/METADATA,sha256=skJgvQ_BodA_JhixDpVL8yxbsA87--Y3B07mFhVSiM0,3549
|
9
|
+
py2dag-0.1.9.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
10
|
+
py2dag-0.1.9.dist-info/entry_points.txt,sha256=Q0SHexJJ0z1te4AYL1xTZogx5FrxCCE1ZJ5qntkFMZs,42
|
11
|
+
py2dag-0.1.9.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|