py2dag 0.3.5__tar.gz → 0.3.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: py2dag
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: Convert Python function plans to DAG (JSON, pseudo, optional SVG).
5
5
  License: MIT
6
6
  Author: rvergis
@@ -131,7 +131,7 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
131
131
  return list(prev.get("deps", []))
132
132
  return [ssa_var]
133
133
 
134
- for arg in call.args:
134
+ for idx, arg in enumerate(call.args):
135
135
  if isinstance(arg, ast.Starred):
136
136
  star_val = arg.value
137
137
  if isinstance(star_val, ast.Name):
@@ -156,7 +156,20 @@ def parse(source: str, function_name: Optional[str] = None) -> Dict[str, Any]:
156
156
  deps.append(_ssa_get(elt.id))
157
157
  dep_labels.append("")
158
158
  else:
159
- raise DSLParseError("Positional args must be variable names or lists/tuples of names")
159
+ # Allow literal positional arguments by emitting a CONST node
160
+ try:
161
+ lit = _literal(arg)
162
+ except DSLParseError:
163
+ raise DSLParseError("Positional args must be variable names or lists/tuples of names or literals")
164
+ const_id = _ssa_new(f"{var_name}_arg{idx}")
165
+ ops.append({
166
+ "id": const_id,
167
+ "op": "CONST.value",
168
+ "deps": [],
169
+ "args": {"value": lit},
170
+ })
171
+ deps.append(const_id)
172
+ dep_labels.append("")
160
173
 
161
174
  kwargs: Dict[str, Any] = {}
162
175
  for kw in call.keywords:
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "py2dag"
7
- version = "0.3.5"
7
+ version = "0.3.6"
8
8
  description = "Convert Python function plans to DAG (JSON, pseudo, optional SVG)."
9
9
  authors = ["rvergis"]
10
10
  license = "MIT"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes