Skip to content

Commit 7252f2e

Browse files
committed
ENH: Improved style taking advantage of inheritance
1 parent 6d7af13 commit 7252f2e

File tree

1 file changed

+1
-36
lines changed

1 file changed

+1
-36
lines changed

nipype/interfaces/io.py

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,7 +1570,7 @@ class SSHDataGrabberInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec):
15701570
desc='If set SSH commands will be logged to the given file')
15711571

15721572

1573-
class SSHDataGrabber(IOBase):
1573+
class SSHDataGrabber(Datagrabber):
15741574
""" Datagrabber module that downloads the file list and optionally
15751575
the files from a SSH server. The SSH operation must not need
15761576
user and password so an SSH agent must be active in where this
@@ -1647,46 +1647,13 @@ def __init__(self, infields=None, outfields=None, **kwargs):
16471647
if not outfields:
16481648
outfields = ['outfiles']
16491649
super(SSHDataGrabber, self).__init__(**kwargs)
1650-
undefined_traits = {}
1651-
# used for mandatory inputs check
1652-
self._infields = infields
1653-
self._outfields = outfields
1654-
if infields:
1655-
for key in infields:
1656-
self.inputs.add_trait(key, traits.Any)
1657-
undefined_traits[key] = Undefined
1658-
# add ability to insert field specific templates
1659-
self.inputs.add_trait('field_template',
1660-
traits.Dict(traits.Enum(outfields),
1661-
desc="arguments that fit into template"))
1662-
undefined_traits['field_template'] = Undefined
1663-
if not isdefined(self.inputs.template_args):
1664-
self.inputs.template_args = {}
1665-
for key in outfields:
1666-
if not key in self.inputs.template_args:
1667-
if infields:
1668-
self.inputs.template_args[key] = [infields]
1669-
else:
1670-
self.inputs.template_args[key] = []
1671-
1672-
self.inputs.trait_set(trait_change_notify=False, **undefined_traits)
1673-
16741650
if (
16751651
self.inputs.template_expression == 'regexp' and
16761652
self.inputs.template[-1] != '$'
16771653
):
16781654
self.inputs.template += '$'
16791655

16801656

1681-
1682-
def _add_output_traits(self, base):
1683-
"""
1684-
1685-
Using traits.Any instead out OutputMultiPath till add_trait bug
1686-
is fixed.
1687-
"""
1688-
return add_traits(base, self.inputs.template_args.keys())
1689-
16901657
def _list_outputs(self):
16911658
if len(self.inputs.ssh_log_to_file) > 0:
16921659
paramiko.util.log_to_file(self.inputs.ssh_log_to_file)
@@ -1708,8 +1675,6 @@ def _list_outputs(self):
17081675
isdefined(self.inputs.field_template) and \
17091676
key in self.inputs.field_template:
17101677
template = self.inputs.field_template[key]
1711-
#template = os.path.join(
1712-
# os.path.abspath(self.inputs.base_directory), template)
17131678
if not args:
17141679
client = self._get_ssh_client()
17151680
sftp = client.open_sftp()

0 commit comments

Comments
 (0)