diff --git a/nipype/pipeline/engine/tests/test_join.py b/nipype/pipeline/engine/tests/test_join.py index 2fe5f70564..da24adee37 100644 --- a/nipype/pipeline/engine/tests/test_join.py +++ b/nipype/pipeline/engine/tests/test_join.py @@ -2,6 +2,7 @@ # vi: set ft=python sts=4 ts=4 sw=4 et: """Tests for join expansion """ +import operator import pytest from .... import config @@ -640,14 +641,11 @@ def sq(x): def test_join_nestediters(tmpdir): tmpdir.chdir() - def exponent(x, p): - return x**p - wf = pe.Workflow("wf", base_dir=tmpdir.strpath) xs = pe.Node(IdentityInterface(["x"]), iterables=[("x", [1, 2])], name="xs") ps = pe.Node(IdentityInterface(["p"]), iterables=[("p", [3, 4])], name="ps") - exp = pe.Node(Function(function=exponent), name="exp") + exp = pe.Node(Function(function=operator.pow), name="exp") exp_joinx = pe.JoinNode( Merge(1, ravel_inputs=True), name="exp_joinx", diff --git a/nipype/pipeline/engine/utils.py b/nipype/pipeline/engine/utils.py index d947735cb0..40994dcc80 100644 --- a/nipype/pipeline/engine/utils.py +++ b/nipype/pipeline/engine/utils.py @@ -4,6 +4,7 @@ import os import sys import pickle +import operator from collections import defaultdict import re from copy import deepcopy @@ -612,7 +613,7 @@ def count_iterables(iterables, synchronize=False): Otherwise, the count is the product of the iterables value list sizes. """ - op = max if synchronize else lambda x, y: x * y + op = max if synchronize else operator.mul return reduce(op, [len(func()) for _, func in list(iterables.items())])