Power Puter: Allow lists and tuples to be used as iters within list comprehension
This commit is contained in:
+3
-3
@@ -326,11 +326,11 @@ class _Puter:
|
||||
raise
|
||||
return val
|
||||
|
||||
if isinstance(stmt, ast.List):
|
||||
if isinstance(stmt, (ast.List, ast.Tuple)):
|
||||
value = []
|
||||
for elt in stmt.elts:
|
||||
value.append(self._eval_statement(elt, ctx=ctx))
|
||||
return value
|
||||
return tuple(value) if isinstance(stmt, ast.Tuple) else value
|
||||
|
||||
# f-strings: https://www.basicexamples.com/example/python/ast-JoinedStr
|
||||
# Note, this will str() all evaluated items in the fstrings, and doesn't handle f-string
|
||||
@@ -372,7 +372,7 @@ class _Puter:
|
||||
# A call, like my_dct.items(), or a named ctx list
|
||||
if isinstance(gen.iter, ast.Call):
|
||||
gen_iters = self._eval_statement(gen.iter, ctx=gen_ctx)
|
||||
elif isinstance(gen.iter, (ast.Name, ast.Attribute)):
|
||||
elif isinstance(gen.iter, (ast.Name, ast.Attribute, ast.List, ast.Tuple)):
|
||||
gen_iters = self._eval_statement(gen.iter, ctx=gen_ctx)
|
||||
|
||||
for gen_iter in gen_iters:
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
[project]
|
||||
name = "rgthree-comfy"
|
||||
description = "Making ComfyUI more comfortable."
|
||||
version = "1.0.2505272100"
|
||||
version = "1.0.2505290026"
|
||||
license = { file = "LICENSE" }
|
||||
dependencies = []
|
||||
|
||||
|
||||
Reference in New Issue
Block a user