From e0649ab3f1c64a93091949ccabc89b2a05bd91ac Mon Sep 17 00:00:00 2001 From: Michael Waskom Date: Tue, 20 Jun 2017 19:05:46 -0400 Subject: [PATCH 1/2] Minimal viable product for interface specs as dicts --- nipype/interfaces/base.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/nipype/interfaces/base.py b/nipype/interfaces/base.py index 2f8b1bf0ea..52eeef7117 100644 --- a/nipype/interfaces/base.py +++ b/nipype/interfaces/base.py @@ -8,7 +8,7 @@ Requires Packages to be installed """ -from __future__ import print_function, division, unicode_literals, absolute_import +from __future__ import print_function, division, absolute_import from future import standard_library standard_library.install_aliases() from builtins import range, object, open, str, bytes @@ -760,7 +760,6 @@ class BaseInterface(Interface): This class cannot be instantiated. """ - input_spec = BaseInterfaceInputSpec _version = None _additional_metadata = [] _redirect_x = False @@ -771,6 +770,16 @@ def __init__(self, from_file=None, **inputs): raise Exception('No input_spec in class: %s' % self.__class__.__name__) + if isinstance(self.input_spec, dict): + self.input_spec = type("AnonyomousInputSpec", + (BaseInterfaceInputSpec,), + self.input_spec) + + if isinstance(self.output_spec, dict): + self.output_spec = type("AnonyomousOutputSpec", + (TraitedSpec,), + self.output_spec) + self.inputs = self.input_spec(**inputs) self.estimated_memory_gb = 0.25 self.num_threads = 1 From 143922201ae837f69da46c1ccd039c9213adc066 Mon Sep 17 00:00:00 2001 From: Michael Waskom Date: Mon, 26 Jun 2017 15:38:36 -0400 Subject: [PATCH 2/2] Revert removal of input_spec on BaseInterface --- nipype/interfaces/base.py | 1 + 1 file changed, 1 insertion(+) diff --git a/nipype/interfaces/base.py b/nipype/interfaces/base.py index 52eeef7117..1c7c480d57 100644 --- a/nipype/interfaces/base.py +++ b/nipype/interfaces/base.py @@ -760,6 +760,7 @@ class BaseInterface(Interface): This class cannot be instantiated. """ + input_spec = BaseInterfaceInputSpec _version = None _additional_metadata = [] _redirect_x = False