Johannes Köster  committed f8e686d

Fix discrimination between named list or named str within input or output files.

  • Participants
  • Parent commits 08bd56e

Comments (0)

Files changed (3)

File snakemake/

         self.set_name(name, len(self) - 1)
-    def set_name(self, name, index, end=None, aslist=False):
+    def set_name(self, name, index, end=None):
         Set the name of an item.

File snakemake/

             ruleio = None):
             for name, item in olditems.allitems():
                 start = len(newitems)
+                is_iterable = True
                 if callable(item):
                     item = item(wildcards_obj)
                     if not_iterable(item):
                         item = [item]
+                        is_iterable = False
                     for item_ in item:
                         if not isinstance(item_, str):
                             raise RuleException("Input function did not return str or list of str.", rule=self)
                     if not_iterable(item):
                         item = [item]
+                        is_iterable = False
                     for item_ in item:
                         concrete = concretize(item_, wildcards)
                         if ruleio is not None:
                             ruleio[concrete] = item_
                 if name:
-                    newitems.set_name(name, start, end=len(newitems))
+                    newitems.set_name(name, start, end=len(newitems) if is_iterable else None)
         if wildcards is None:
             wildcards = dict()

File tests/test_keyword_list/Snakefile

 	input: bla="test.in1 test.in2".split()
 	output: "test.out"
+		print(input.bla)
 		assert len(input.bla) == 2
 		shell("touch {output}")