Skip to content

Commit 84ed702

Browse files
committed
tidy code for tab comletion of inputs and outputs
1 parent c695ed8 commit 84ed702

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

nipype/interfaces/base/specs.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,9 @@ def __repr__(self):
8383
""" Return a well-formatted representation of the traits """
8484
outstr = []
8585
for name, value in sorted(self.trait_get().items()):
86-
if not name == '__all__':
87-
outstr.append('%s = %s' % (name, value))
86+
outstr.append('%s = %s' % (name, value))
8887
return '\n{}\n'.format('\n'.join(outstr))
8988

90-
9189
def _generate_handlers(self):
9290
"""Find all traits with the 'xor' metadata and attach an event
9391
handler to them.
@@ -236,7 +234,6 @@ def get_hashval(self, hash_method=None):
236234
The md5 hash value of the traited spec
237235
238236
"""
239-
240237
list_withhash = []
241238
list_nofilename = []
242239
for name, val in sorted(self.trait_get().items()):
@@ -313,8 +310,7 @@ def _get_sorteddict(self,
313310

314311
@property
315312
def __all__(self):
316-
return [k for k,v in self.items() if not k == "__all__"]
317-
313+
return self.copyable_trait_names()
318314

319315

320316
class TraitedSpec(BaseTraitedSpec):

nipype/interfaces/base/tests/test_specs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,11 @@ def test_TraitedSpec_tab_completion():
5858
bet_outputs = bet_nd.outputs.class_editable_traits()
5959

6060
# Check __all__ for bet node and interface inputs
61-
assert bet_nd.inputs.__all__ == bet_inputs
62-
assert bet_interface.inputs.__all__ == bet_inputs
61+
assert set(bet_nd.inputs.__all__) == set(bet_inputs)
62+
assert set(bet_interface.inputs.__all__) == set(bet_inputs)
6363

6464
# Check __all__ for bet node outputs
65-
assert bet_nd.outputs.__all__ == bet_outputs
65+
assert set(bet_nd.outputs.__all__) == set(bet_outputs)
6666

6767

6868
@pytest.mark.skip

0 commit comments

Comments
 (0)