|
15 | 15 |
|
16 | 16 | """
|
17 | 17 | from __future__ import print_function, division, unicode_literals, absolute_import
|
18 |
| -from builtins import range, object, str, bytes, open |
19 |
| - |
20 |
| -# Py2 compat: http://python-future.org/compatible_idioms.html#collections-counter-and-ordereddict |
21 |
| -from future import standard_library |
22 |
| -standard_library.install_aliases() |
| 18 | +from builtins import str, bytes, open |
23 | 19 |
|
| 20 | +import os |
| 21 | +import os.path as op |
| 22 | +import sys |
24 | 23 | from datetime import datetime
|
25 |
| - |
26 | 24 | from copy import deepcopy
|
27 | 25 | import pickle
|
28 |
| -import os |
29 |
| -import os.path as op |
30 | 26 | import shutil
|
31 |
| -import sys |
32 | 27 | from warnings import warn
|
33 | 28 |
|
34 | 29 | import numpy as np
|
35 | 30 | import networkx as nx
|
36 | 31 |
|
37 |
| - |
38 | 32 | from ... import config, logging
|
39 |
| - |
40 |
| -from ...utils.misc import (unflatten, str2bool) |
| 33 | +from ...utils.misc import str2bool |
41 | 34 | from ...utils.functions import (getsource, create_function_from_source)
|
42 |
| -from ...interfaces.base import (traits, InputMultiPath, CommandLine, |
43 |
| - Undefined, TraitedSpec, DynamicTraitedSpec, |
44 |
| - Bunch, InterfaceResult, md5, Interface, |
45 |
| - TraitDictObject, TraitListObject, isdefined) |
46 |
| - |
47 |
| -from ...utils.filemanip import (save_json, FileNotFoundError, |
48 |
| - filename_to_list, list_to_filename, |
49 |
| - copyfiles, fnames_presuffix, loadpkl, |
50 |
| - split_filename, load_json, makedirs, savepkl, |
51 |
| - write_rst_header, write_rst_dict, |
52 |
| - write_rst_list, to_str) |
53 |
| -from .utils import (generate_expanded_graph, modify_paths, |
54 |
| - export_graph, write_workflow_prov, |
55 |
| - write_workflow_resources, |
56 |
| - clean_working_directory, format_dot, topological_sort, |
57 |
| - get_print_name, merge_dict, evaluate_connect_function, |
58 |
| - _write_inputs, format_node) |
| 35 | +from ...interfaces.base import ( |
| 36 | + traits, TraitedSpec, TraitDictObject, TraitListObject) |
| 37 | +from ...utils.filemanip import save_json, makedirs, to_str |
| 38 | +from .utils import ( |
| 39 | + generate_expanded_graph, export_graph, write_workflow_prov, |
| 40 | + write_workflow_resources, format_dot, topological_sort, |
| 41 | + get_print_name, merge_dict, format_node |
| 42 | +) |
59 | 43 |
|
60 | 44 | from .base import EngineBase
|
61 |
| -from .nodes import Node, MapNode |
| 45 | +from .nodes import MapNode |
| 46 | + |
| 47 | +# Py2 compat: http://python-future.org/compatible_idioms.html#collections-counter-and-ordereddict |
| 48 | +from future import standard_library |
| 49 | +standard_library.install_aliases() |
62 | 50 |
|
63 | 51 | logger = logging.getLogger('workflow')
|
64 | 52 |
|
@@ -202,16 +190,16 @@ def connect(self, *args, **kwargs):
|
202 | 190 | connected.
|
203 | 191 | """ % (srcnode, source, destnode, dest, dest, destnode))
|
204 | 192 | if not (hasattr(destnode, '_interface') and
|
205 |
| - ('.io' in str(destnode._interface.__class__) or |
206 |
| - any(['.io' in str(val) for val in |
207 |
| - destnode._interface.__class__.__bases__])) |
| 193 | + ('.io' in str(destnode._interface.__class__) or |
| 194 | + any(['.io' in str(val) for val in |
| 195 | + destnode._interface.__class__.__bases__])) |
208 | 196 | ):
|
209 | 197 | if not destnode._check_inputs(dest):
|
210 | 198 | not_found.append(['in', destnode.name, dest])
|
211 | 199 | if not (hasattr(srcnode, '_interface') and
|
212 |
| - ('.io' in str(srcnode._interface.__class__) |
213 |
| - or any(['.io' in str(val) for val in |
214 |
| - srcnode._interface.__class__.__bases__]))): |
| 200 | + ('.io' in str(srcnode._interface.__class__) or |
| 201 | + any(['.io' in str(val) |
| 202 | + for val in srcnode._interface.__class__.__bases__]))): |
215 | 203 | if isinstance(source, tuple):
|
216 | 204 | # handles the case that source is specified
|
217 | 205 | # with a function
|
@@ -930,13 +918,13 @@ def _get_dot(self, prefix=None, hierarchy=None, colored=False,
|
930 | 918 | prefix = ' '
|
931 | 919 | if hierarchy is None:
|
932 | 920 | hierarchy = []
|
933 |
| - colorset = ['#FFFFC8', # Y |
934 |
| - '#0000FF', '#B4B4FF', '#E6E6FF', # B |
935 |
| - '#FF0000', '#FFB4B4', '#FFE6E6', # R |
936 |
| - '#00A300', '#B4FFB4', '#E6FFE6', # G |
937 |
| - '#0000FF', '#B4B4FF'] # loop B |
| 921 | + colorset = ['#FFFFC8', # Y |
| 922 | + '#0000FF', '#B4B4FF', '#E6E6FF', # B |
| 923 | + '#FF0000', '#FFB4B4', '#FFE6E6', # R |
| 924 | + '#00A300', '#B4FFB4', '#E6FFE6', # G |
| 925 | + '#0000FF', '#B4B4FF'] # loop B |
938 | 926 | if level > len(colorset) - 2:
|
939 |
| - level = 3 # Loop back to blue |
| 927 | + level = 3 # Loop back to blue |
940 | 928 |
|
941 | 929 | dotlist = ['%slabel="%s";' % (prefix, self.name)]
|
942 | 930 | for node in nx.topological_sort(self._graph):
|
|
0 commit comments