From 2efa21a7a7024309d5ef312f3c90b9c84c56d80c Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 16 Sep 2019 09:45:05 -0400 Subject: [PATCH 1/3] MAINT: Require yapf >= 0.27 for check specs --- nipype/info.py | 2 +- tools/checkspecs.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/nipype/info.py b/nipype/info.py index 83ce1ca43d..19f85d5178 100644 --- a/nipype/info.py +++ b/nipype/info.py @@ -186,7 +186,7 @@ def get_nipype_gitversion(): 'nipy': ['nitime', 'nilearn<0.5.0', 'dipy', 'nipy', 'matplotlib'], 'profiler': ['psutil>=5.0'], 'pybids': ['pybids>=0.7.0'], - 'specs': ['yapf'], + 'specs': ['yapf>=0.27'], 'ssh': ['paramiko'], 'tests': TESTS_REQUIRES, 'xvfbwrapper': ['xvfbwrapper'], diff --git a/tools/checkspecs.py b/tools/checkspecs.py index e282728c8e..92980cc6fb 100644 --- a/tools/checkspecs.py +++ b/tools/checkspecs.py @@ -10,8 +10,14 @@ import re import sys import warnings +from distutils.version import LooseVersion from nipype.interfaces.base import BaseInterface + +import yapf +if LooseVersion(yapf.__version__) < '0.27': + raise ImportError("Please upgrade yapf to version 0.27 or newer for stable formatting") + from yapf.yapflib.yapf_api import FormatCode From 729375d7b2e695a7a9f5ce2bf472d19b53bf188f Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 16 Sep 2019 09:45:48 -0400 Subject: [PATCH 2/3] ENH: Expect extensions metadata; FIX: raw docstring --- tools/checkspecs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/checkspecs.py b/tools/checkspecs.py index 92980cc6fb..3eebb0569c 100644 --- a/tools/checkspecs.py +++ b/tools/checkspecs.py @@ -31,7 +31,7 @@ def __init__(self, package_skip_patterns=None, module_skip_patterns=None, class_skip_patterns=None): - ''' Initialize package for parsing + r''' Initialize package for parsing Parameters ---------- @@ -200,7 +200,7 @@ def test_specs(self, uri): 'position', 'mandatory', 'copyfile', 'usedefault', 'sep', 'hash_files', 'deprecated', 'new_name', 'min_ver', 'max_ver', 'name_source', 'name_template', 'keep_extension', 'units', - 'output_name' + 'output_name', 'extensions' ] in_built = [ 'type', 'copy', 'parent', 'instance_handler', 'comparison_mode', From 399529fd29163b47d8d7bada46b64b9990eb44f6 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Mon, 16 Sep 2019 09:49:34 -0400 Subject: [PATCH 3/3] FIX: Invalid metadata identified by check specs --- nipype/algorithms/modelgen.py | 6 ++---- nipype/algorithms/tests/test_auto_SpecifyModel.py | 11 ++--------- nipype/algorithms/tests/test_auto_SpecifySPMModel.py | 11 ++--------- .../algorithms/tests/test_auto_SpecifySparseModel.py | 11 ++--------- 4 files changed, 8 insertions(+), 31 deletions(-) diff --git a/nipype/algorithms/modelgen.py b/nipype/algorithms/modelgen.py index d23ae392ba..56db46b9f5 100644 --- a/nipype/algorithms/modelgen.py +++ b/nipype/algorithms/modelgen.py @@ -254,15 +254,13 @@ class SpecifyModelInputSpec(BaseInterfaceInputSpec): xor=['subject_info', 'event_files', 'bids_event_file'], desc='TSV event file containing common BIDS fields: `onset`,' '`duration`, and categorization and amplitude columns') - bids_condition_column = traits.Str(exists=True, - mandatory=False, + bids_condition_column = traits.Str( default_value='trial_type', usedefault=True, desc='Column of the file passed to `bids_event_file` to the ' 'unique values of which events will be assigned' 'to regressors') - bids_amplitude_column = traits.Str(exists=True, - mandatory=False, + bids_amplitude_column = traits.Str( desc='Column of the file passed to `bids_event_file` ' 'according to which to assign amplitudes to events') realignment_parameters = InputMultiPath( diff --git a/nipype/algorithms/tests/test_auto_SpecifyModel.py b/nipype/algorithms/tests/test_auto_SpecifyModel.py index 5acfb84e37..1f883e3677 100644 --- a/nipype/algorithms/tests/test_auto_SpecifyModel.py +++ b/nipype/algorithms/tests/test_auto_SpecifyModel.py @@ -5,15 +5,8 @@ def test_SpecifyModel_inputs(): input_map = dict( - bids_amplitude_column=dict( - exists=True, - mandatory=False, - ), - bids_condition_column=dict( - exists=True, - mandatory=False, - usedefault=True, - ), + bids_amplitude_column=dict(), + bids_condition_column=dict(usedefault=True, ), bids_event_file=dict( mandatory=True, xor=['subject_info', 'event_files', 'bids_event_file'], diff --git a/nipype/algorithms/tests/test_auto_SpecifySPMModel.py b/nipype/algorithms/tests/test_auto_SpecifySPMModel.py index 6145791254..53fe0b3850 100644 --- a/nipype/algorithms/tests/test_auto_SpecifySPMModel.py +++ b/nipype/algorithms/tests/test_auto_SpecifySPMModel.py @@ -5,15 +5,8 @@ def test_SpecifySPMModel_inputs(): input_map = dict( - bids_amplitude_column=dict( - exists=True, - mandatory=False, - ), - bids_condition_column=dict( - exists=True, - mandatory=False, - usedefault=True, - ), + bids_amplitude_column=dict(), + bids_condition_column=dict(usedefault=True, ), bids_event_file=dict( mandatory=True, xor=['subject_info', 'event_files', 'bids_event_file'], diff --git a/nipype/algorithms/tests/test_auto_SpecifySparseModel.py b/nipype/algorithms/tests/test_auto_SpecifySparseModel.py index 933793f363..3e91aa242f 100644 --- a/nipype/algorithms/tests/test_auto_SpecifySparseModel.py +++ b/nipype/algorithms/tests/test_auto_SpecifySparseModel.py @@ -5,15 +5,8 @@ def test_SpecifySparseModel_inputs(): input_map = dict( - bids_amplitude_column=dict( - exists=True, - mandatory=False, - ), - bids_condition_column=dict( - exists=True, - mandatory=False, - usedefault=True, - ), + bids_amplitude_column=dict(), + bids_condition_column=dict(usedefault=True, ), bids_event_file=dict( mandatory=True, xor=['subject_info', 'event_files', 'bids_event_file'],