Skip to content

Commit

Permalink
get_input: Do not convert lists if it can be avoided
Browse files Browse the repository at this point in the history
core/modules/vistrails_module.py:
 - get_input:
   Only merge lists if there are more than one.

Fixes #1132
  • Loading branch information
rexissimus committed Oct 7, 2015
1 parent ebd598a commit 11db25b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions vistrails/core/modules/vistrails_module.py
Expand Up @@ -37,9 +37,8 @@

from base64 import b16encode, b16decode
import copy
from itertools import izip, product
from itertools import izip, product, chain
import json
import sys
import time
import traceback
import warnings
Expand Down Expand Up @@ -1193,7 +1192,12 @@ def get_input(self, port_name, allow_default=True):

if (self.input_specs[port_name].depth + self.list_depth > 0) or \
self.input_specs[port_name].descriptors() == [list_desc]:
return [j for i in self.get_input_list(port_name) for j in i]
ret = self.get_input_list(port_name)
if len(ret) > 1:
ret = list(chain.from_iterable(ret))
else:
ret = ret[0]
return ret

# else return first connector item
value = self.inputPorts[port_name][0]()
Expand Down

0 comments on commit 11db25b

Please sign in to comment.