py2dag 0.3.7__tar.gz → 0.3.8__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.3.7 → py2dag-0.3.8}/PKG-INFO +1 -1
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/parser.py +14 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/pyproject.toml +1 -1
- {py2dag-0.3.7 → py2dag-0.3.8}/LICENSE +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/README.md +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/__init__.py +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/cli.py +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/colors.py +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/export_dagre.py +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/export_svg.py +0 -0
- {py2dag-0.3.7 → py2dag-0.3.8}/py2dag/pseudo.py +0 -0
@@ -14,6 +14,20 @@ def _literal(node: ast.AST) -> Any:
|
|
14
14
|
"""Return a Python literal from an AST node or raise DSLParseError."""
|
15
15
|
if isinstance(node, ast.Constant):
|
16
16
|
return node.value
|
17
|
+
if isinstance(node, ast.JoinedStr):
|
18
|
+
parts: List[str] = []
|
19
|
+
for value in node.values:
|
20
|
+
if isinstance(value, ast.Constant):
|
21
|
+
parts.append(str(value.value))
|
22
|
+
elif isinstance(value, ast.FormattedValue):
|
23
|
+
try:
|
24
|
+
expr = ast.unparse(value.value) # type: ignore[attr-defined]
|
25
|
+
except Exception:
|
26
|
+
expr = "?"
|
27
|
+
parts.append("{" + expr + "}")
|
28
|
+
else:
|
29
|
+
raise DSLParseError("Keyword argument values must be JSON-serialisable literals")
|
30
|
+
return "".join(parts)
|
17
31
|
if isinstance(node, (ast.List, ast.Tuple)):
|
18
32
|
return [_literal(elt) for elt in node.elts]
|
19
33
|
if isinstance(node, ast.Dict):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|