From fd4b8bdb47eda74011ffceeccb5fcc5ea15547d0 Mon Sep 17 00:00:00 2001 From: Pablo Velasco Date: Thu, 23 Mar 2023 21:59:56 +0000 Subject: [PATCH 1/3] ENH: Dcm2niix - add mvec output --- nipype/interfaces/dcm2nii.py | 12 +++++++++--- nipype/interfaces/tests/test_auto_Dcm2niix.py | 1 + 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/nipype/interfaces/dcm2nii.py b/nipype/interfaces/dcm2nii.py index 1ba6f24eb9..95aa0412cf 100644 --- a/nipype/interfaces/dcm2nii.py +++ b/nipype/interfaces/dcm2nii.py @@ -119,7 +119,8 @@ class Dcm2nii(CommandLine): >>> converter.inputs.gzip_output = True >>> converter.inputs.output_dir = '.' >>> converter.cmdline # doctest: +ELLIPSIS - 'dcm2nii -a y -c y -b config.ini -v y -d y -e y -g y -i n -n y -o . -p y -x n -f n functional_1.dcm'""" + 'dcm2nii -a y -c y -b config.ini -v y -d y -e y -g y -i n -n y -o . -p y -x n -f n functional_1.dcm' + """ input_spec = Dcm2niiInputSpec output_spec = Dcm2niiOutputSpec @@ -374,6 +375,7 @@ class Dcm2niixInputSpec(CommandLineInputSpec): class Dcm2niixOutputSpec(TraitedSpec): converted_files = OutputMultiPath(File(exists=True)) bvecs = OutputMultiPath(File(exists=True)) + mvecs = OutputMultiPath(File(exists=True)) bvals = OutputMultiPath(File(exists=True)) bids = OutputMultiPath(File(exists=True)) @@ -456,8 +458,8 @@ def _parse_stdout(self, stdout): return filenames def _parse_files(self, filenames): - outfiles, bvals, bvecs, bids = [], [], [], [] - outtypes = [".bval", ".bvec", ".json", ".txt"] + outfiles, bvals, bvecs, mvecs, bids = [], [], [], [], [] + outtypes = [".bval", ".bvec", ".mvec", ".json", ".txt"] if self.inputs.to_nrrd: outtypes += [".nrrd", ".nhdr", ".raw.gz"] else: @@ -477,10 +479,13 @@ def _parse_files(self, filenames): bvals.append(fl) elif fl.endswith(".bvec"): bvecs.append(fl) + elif fl.endswith(".mvec"): + mvecs.append(fl) elif fl.endswith(".json") or fl.endswith(".txt"): bids.append(fl) self.output_files = outfiles self.bvecs = bvecs + self.mvecs = mvecs self.bvals = bvals self.bids = bids @@ -489,6 +494,7 @@ def _list_outputs(self): outputs["converted_files"] = self.output_files outputs["bvecs"] = self.bvecs outputs["bvals"] = self.bvals + outputs["mvecs"] = self.mvecs outputs["bids"] = self.bids return outputs diff --git a/nipype/interfaces/tests/test_auto_Dcm2niix.py b/nipype/interfaces/tests/test_auto_Dcm2niix.py index dec95abcff..5565919b70 100644 --- a/nipype/interfaces/tests/test_auto_Dcm2niix.py +++ b/nipype/interfaces/tests/test_auto_Dcm2niix.py @@ -95,6 +95,7 @@ def test_Dcm2niix_outputs(): bvals=dict(), bvecs=dict(), converted_files=dict(), + mvecs=dict(), ) outputs = Dcm2niix.output_spec() From cd3c20fb576ff3d0f574c7eed1e505520225fbc0 Mon Sep 17 00:00:00 2001 From: Pablo Velasco Date: Thu, 23 Mar 2023 22:05:23 +0000 Subject: [PATCH 2/3] NEW: add pvelasco to .zenodo.json --- .zenodo.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.zenodo.json b/.zenodo.json index fd9e5e9658..c0a07b8327 100644 --- a/.zenodo.json +++ b/.zenodo.json @@ -844,6 +844,11 @@ "name": "Pannetier, Nicolas", "orcid": "0000-0002-0744-5155" }, + { + "affiliation": "Flywheel.io, Minneapolis, MN, USA.", + "name": "Velasco, Pablo", + "orcid": "0000-0002-5749-6049" + }, { "affiliation": "Max Planck Institute for Human Cognitive and Brain Sciences", "name": "Numssen, Ole", From 09a44f4b029152ff7a1ed3e3b9f085ab269864a4 Mon Sep 17 00:00:00 2001 From: Pablo Velasco Date: Fri, 24 Mar 2023 14:02:18 +0000 Subject: [PATCH 3/3] LINT: Black edits --- doc/devel/matlab_example1.py | 17 +++++++++----- doc/devel/matlab_example2.py | 8 ++++--- nipype/algorithms/misc.py | 1 - nipype/algorithms/tests/test_ErrorMap.py | 1 - nipype/algorithms/tests/test_misc.py | 2 -- .../algorithms/tests/test_normalize_tpms.py | 1 - nipype/conftest.py | 1 - nipype/external/cloghandler.py | 4 +++- nipype/interfaces/afni/preprocess.py | 2 -- nipype/interfaces/afni/utils.py | 2 -- nipype/interfaces/base/core.py | 1 - nipype/interfaces/base/traits_extension.py | 1 - nipype/interfaces/brainsuite/brainsuite.py | 1 - nipype/interfaces/cat12/preprocess.py | 3 --- nipype/interfaces/cmtk/cmtk.py | 1 - nipype/interfaces/freesurfer/model.py | 1 - nipype/interfaces/freesurfer/petsurfer.py | 3 --- nipype/interfaces/freesurfer/preprocess.py | 8 ------- .../freesurfer/tests/test_FSSurfaceCommand.py | 1 - .../interfaces/freesurfer/tests/test_utils.py | 4 ---- nipype/interfaces/freesurfer/utils.py | 13 ----------- nipype/interfaces/fsl/dti.py | 5 ---- nipype/interfaces/fsl/fix.py | 1 - nipype/interfaces/fsl/maths.py | 23 ------------------- nipype/interfaces/fsl/tests/test_dti.py | 2 -- .../interfaces/fsl/tests/test_preprocess.py | 3 +-- nipype/interfaces/fsl/utils.py | 8 ------- nipype/interfaces/io.py | 14 ----------- nipype/interfaces/minc/base.py | 2 +- nipype/interfaces/minc/minc.py | 1 - .../niftyseg/tests/test_em_interfaces.py | 1 - .../niftyseg/tests/test_extra_PatchMatch.py | 1 - .../interfaces/niftyseg/tests/test_lesions.py | 1 - .../interfaces/niftyseg/tests/test_maths.py | 5 ---- nipype/interfaces/nitime/analysis.py | 1 - nipype/interfaces/spm/base.py | 1 - nipype/interfaces/spm/preprocess.py | 7 ------ nipype/interfaces/spm/utils.py | 1 - nipype/interfaces/tests/test_io.py | 1 - nipype/interfaces/tests/test_nilearn.py | 1 - nipype/pipeline/engine/tests/test_engine.py | 1 - .../pipeline/engine/tests/test_workflows.py | 1 - nipype/pipeline/plugins/slurm.py | 1 - .../tests/test_legacymultiproc_nondaemon.py | 3 --- nipype/tests/test_nipype.py | 2 -- nipype/utils/nipype_cmd.py | 1 - nipype/utils/tests/test_filemanip.py | 1 - tools/checkspecs.py | 15 ++++++------ tools/gitwash_dumper.py | 6 ++--- tools/run_examples.py | 12 +++++++--- 50 files changed, 39 insertions(+), 159 deletions(-) diff --git a/doc/devel/matlab_example1.py b/doc/devel/matlab_example1.py index aaf6c4cb3a..12d1a1302a 100644 --- a/doc/devel/matlab_example1.py +++ b/doc/devel/matlab_example1.py @@ -1,6 +1,10 @@ from nipype.interfaces.matlab import MatlabCommand -from nipype.interfaces.base import TraitedSpec, \ - BaseInterface, BaseInterfaceInputSpec, File +from nipype.interfaces.base import ( + TraitedSpec, + BaseInterface, + BaseInterfaceInputSpec, + File, +) import os from string import Template @@ -19,14 +23,15 @@ class ConmapTxt2Mat(BaseInterface): output_spec = ConmapTxt2MatOutputSpec def _run_interface(self, runtime): - d = dict(in_file=self.inputs.in_file, - out_file=self.inputs.out_file) + d = dict(in_file=self.inputs.in_file, out_file=self.inputs.out_file) # This is your MATLAB code template - script = Template("""in_file = '$in_file'; + script = Template( + """in_file = '$in_file'; out_file = '$out_file'; ConmapTxt2Mat(in_file, out_file); exit; - """).substitute(d) + """ + ).substitute(d) # mfile = True will create an .m file with your script and executed. # Alternatively diff --git a/doc/devel/matlab_example2.py b/doc/devel/matlab_example2.py index 8d683ea45f..224dc45d8c 100644 --- a/doc/devel/matlab_example2.py +++ b/doc/devel/matlab_example2.py @@ -4,8 +4,7 @@ class HelloWorldInputSpec(MatlabInputSpec): - name = traits.Str(mandatory=True, - desc='Name of person to say hello to') + name = traits.Str(mandatory=True, desc='Name of person to say hello to') class HelloWorldOutputSpec(TraitedSpec): @@ -29,6 +28,7 @@ class HelloWorld(MatlabCommand): >>> out = hello.run() >>> print out.outputs.matlab_output """ + input_spec = HelloWorldInputSpec output_spec = HelloWorldOutputSpec @@ -37,7 +37,9 @@ def _my_script(self): script = """ disp('Hello %s Python') two = 1 + 1 - """ % (self.inputs.name) + """ % ( + self.inputs.name + ) return script def run(self, **inputs): diff --git a/nipype/algorithms/misc.py b/nipype/algorithms/misc.py index 23006aad8b..839696144e 100644 --- a/nipype/algorithms/misc.py +++ b/nipype/algorithms/misc.py @@ -968,7 +968,6 @@ class CalculateNormalizedMoments(BaseInterface): output_spec = CalculateNormalizedMomentsOutputSpec def _run_interface(self, runtime): - self._moments = calc_moments(self.inputs.timeseries_file, self.inputs.moment) return runtime diff --git a/nipype/algorithms/tests/test_ErrorMap.py b/nipype/algorithms/tests/test_ErrorMap.py index adac507bad..faae860a5a 100644 --- a/nipype/algorithms/tests/test_ErrorMap.py +++ b/nipype/algorithms/tests/test_ErrorMap.py @@ -10,7 +10,6 @@ def test_errormap(tmpdir): - # Single-Spectual # Make two fake 2*2*2 voxel volumes # John von Neumann's birthday diff --git a/nipype/algorithms/tests/test_misc.py b/nipype/algorithms/tests/test_misc.py index 755527da49..3303344ef6 100644 --- a/nipype/algorithms/tests/test_misc.py +++ b/nipype/algorithms/tests/test_misc.py @@ -13,7 +13,6 @@ def test_CreateNifti(create_analyze_pair_file_in_directory): - filelist, outdir = create_analyze_pair_file_in_directory create_nifti = misc.CreateNifti() @@ -35,7 +34,6 @@ def test_CreateNifti(create_analyze_pair_file_in_directory): def test_CalculateMedian(create_analyze_pair_file_in_directory): - mean = misc.CalculateMedian() with pytest.raises(TypeError): diff --git a/nipype/algorithms/tests/test_normalize_tpms.py b/nipype/algorithms/tests/test_normalize_tpms.py index 9541d5d882..99aa5950ae 100644 --- a/nipype/algorithms/tests/test_normalize_tpms.py +++ b/nipype/algorithms/tests/test_normalize_tpms.py @@ -16,7 +16,6 @@ def test_normalize_tpms(tmpdir): - in_mask = example_data("tpms_msk.nii.gz") mskdata = np.asanyarray(nb.load(in_mask).dataobj) mskdata[mskdata > 0.0] = 1.0 diff --git a/nipype/conftest.py b/nipype/conftest.py index 7323e72846..18b8a1ca6d 100644 --- a/nipype/conftest.py +++ b/nipype/conftest.py @@ -27,7 +27,6 @@ def _docdir(request): # Trigger ONLY for the doctests. doctest_plugin = request.config.pluginmanager.getplugin("doctest") if isinstance(request.node, doctest_plugin.DoctestItem): - # Get the fixture dynamically by its name. tmpdir = pp.local(data_dir) diff --git a/nipype/external/cloghandler.py b/nipype/external/cloghandler.py index 08db7a3a0a..c861654990 100644 --- a/nipype/external/cloghandler.py +++ b/nipype/external/cloghandler.py @@ -151,7 +151,9 @@ def __init__( ) try: BaseRotatingHandler.__init__(self, filename, mode, encoding) - except TypeError: # Due to a different logging release without encoding support (Python 2.4.1 and earlier?) + except ( + TypeError + ): # Due to a different logging release without encoding support (Python 2.4.1 and earlier?) BaseRotatingHandler.__init__(self, filename, mode) self.encoding = encoding diff --git a/nipype/interfaces/afni/preprocess.py b/nipype/interfaces/afni/preprocess.py index 4fdb006554..0eec60cd62 100644 --- a/nipype/interfaces/afni/preprocess.py +++ b/nipype/interfaces/afni/preprocess.py @@ -1133,7 +1133,6 @@ class ClipLevel(AFNICommandBase): output_spec = ClipLevelOutputSpec def aggregate_outputs(self, runtime=None, needed_outputs=None): - outputs = self._outputs() outfile = os.path.join(os.getcwd(), "stat_result.json") @@ -2295,7 +2294,6 @@ class Seg(AFNICommandBase): output_spec = AFNICommandOutputSpec def aggregate_outputs(self, runtime=None, needed_outputs=None): - import glob outputs = self._outputs() diff --git a/nipype/interfaces/afni/utils.py b/nipype/interfaces/afni/utils.py index ef27d86b13..3075cffce3 100644 --- a/nipype/interfaces/afni/utils.py +++ b/nipype/interfaces/afni/utils.py @@ -302,7 +302,6 @@ class BrickStat(AFNICommandBase): output_spec = BrickStatOutputSpec def aggregate_outputs(self, runtime=None, needed_outputs=None): - outputs = self._outputs() outfile = os.path.join(os.getcwd(), "stat_result.json") @@ -2595,7 +2594,6 @@ def _format_arg(self, name, spec, value): class ResampleInputSpec(AFNICommandInputSpec): - in_file = File( desc="input file to 3dresample", argstr="-inset %s", diff --git a/nipype/interfaces/base/core.py b/nipype/interfaces/base/core.py index 8a20da3fb1..81da68be00 100644 --- a/nipype/interfaces/base/core.py +++ b/nipype/interfaces/base/core.py @@ -389,7 +389,6 @@ def run(self, cwd=None, ignore_exception=None, **inputs): self._check_version_requirements(self.inputs) with rtc(self, cwd=cwd, redirect_x=self._redirect_x) as runtime: - # Grab inputs now, as they should not change during execution inputs = self.inputs.get_traitsfree() outputs = None diff --git a/nipype/interfaces/base/traits_extension.py b/nipype/interfaces/base/traits_extension.py index 9ac4aa1839..cadce596fb 100644 --- a/nipype/interfaces/base/traits_extension.py +++ b/nipype/interfaces/base/traits_extension.py @@ -405,7 +405,6 @@ class MultiObject(traits.List): """Abstract class - shared functionality of input and output MultiObject""" def validate(self, objekt, name, value): - # want to treat range and other sequences (except str) as list if not isinstance(value, (str, bytes)) and isinstance(value, Sequence): value = list(value) diff --git a/nipype/interfaces/brainsuite/brainsuite.py b/nipype/interfaces/brainsuite/brainsuite.py index f353017e58..91f762f47d 100644 --- a/nipype/interfaces/brainsuite/brainsuite.py +++ b/nipype/interfaces/brainsuite/brainsuite.py @@ -19,7 +19,6 @@ class BseInputSpec(CommandLineInputSpec): - inputMRIFile = File(mandatory=True, argstr="-i %s", desc="input MRI volume") outputMRIVolume = File( desc="output brain-masked MRI volume. If unspecified, output file name will be auto generated.", diff --git a/nipype/interfaces/cat12/preprocess.py b/nipype/interfaces/cat12/preprocess.py index eec0ea936d..1d962bc08b 100644 --- a/nipype/interfaces/cat12/preprocess.py +++ b/nipype/interfaces/cat12/preprocess.py @@ -537,7 +537,6 @@ def _list_outputs(self): ] for tidx, tissue in enumerate(["gm", "wm", "csf"]): - for image, prefix in [("modulated", "mw"), ("dartel", "r"), ("native", "")]: outtype = f"{tissue}_output_{image}" if isdefined(getattr(self.inputs, outtype)) and getattr( @@ -594,7 +593,6 @@ def _list_outputs(self): class CAT12SANLMDenoisingInputSpec(SPMCommandInputSpec): - in_files = InputMultiPath( ImageFileSPM(exists=True), field="data", @@ -679,7 +677,6 @@ class CAT12SANLMDenoisingInputSpec(SPMCommandInputSpec): class CAT12SANLMDenoisingOutputSpec(TraitedSpec): - out_file = File(desc="out file") diff --git a/nipype/interfaces/cmtk/cmtk.py b/nipype/interfaces/cmtk/cmtk.py index 00c134fc37..bc5f2de2a5 100644 --- a/nipype/interfaces/cmtk/cmtk.py +++ b/nipype/interfaces/cmtk/cmtk.py @@ -272,7 +272,6 @@ def cmat( dis = 0 for i in range(endpoints.shape[0]): - # ROI start => ROI end try: startROI = int( diff --git a/nipype/interfaces/freesurfer/model.py b/nipype/interfaces/freesurfer/model.py index f1b7fafe53..5c06a09238 100644 --- a/nipype/interfaces/freesurfer/model.py +++ b/nipype/interfaces/freesurfer/model.py @@ -449,7 +449,6 @@ class GLMFitInputSpec(FSTraitedSpec): class GLMFitOutputSpec(TraitedSpec): - glm_dir = Directory(exists=True, desc="output directory") beta_file = File(exists=True, desc="map of regression coefficients") error_file = File(desc="map of residual error") diff --git a/nipype/interfaces/freesurfer/petsurfer.py b/nipype/interfaces/freesurfer/petsurfer.py index d04409ad20..33602d2711 100644 --- a/nipype/interfaces/freesurfer/petsurfer.py +++ b/nipype/interfaces/freesurfer/petsurfer.py @@ -24,7 +24,6 @@ class GTMSegInputSpec(FSTraitedSpec): - subject_id = traits.String(argstr="--s %s", desc="subject id", mandatory=True) xcerseg = traits.Bool( @@ -136,7 +135,6 @@ def _list_outputs(self): class GTMPVCInputSpec(FSTraitedSpec): - in_file = File( exists=True, argstr="--i %s", @@ -422,7 +420,6 @@ class GTMPVCInputSpec(FSTraitedSpec): class GTMPVCOutputSpec(TraitedSpec): - pvc_dir = Directory(desc="output directory") ref_file = File(desc="Reference TAC in .dat") hb_nifti = File(desc="High-binding TAC in nifti") diff --git a/nipype/interfaces/freesurfer/preprocess.py b/nipype/interfaces/freesurfer/preprocess.py index 4c9009cd10..ccf783a1e3 100644 --- a/nipype/interfaces/freesurfer/preprocess.py +++ b/nipype/interfaces/freesurfer/preprocess.py @@ -1833,7 +1833,6 @@ class BBRegister(FSCommand): output_spec = BBRegisterOutputSpec def _list_outputs(self): - outputs = self.output_spec().get() _in = self.inputs @@ -1893,7 +1892,6 @@ def _format_arg(self, name, spec, value): return super(BBRegister, self)._format_arg(name, spec, value) def _gen_filename(self, name): - if name == "out_reg_file": return self._list_outputs()[name] return None @@ -2180,7 +2178,6 @@ def _gen_filename(self, name): class RobustRegisterInputSpec(FSTraitedSpec): - source_file = File( exists=True, mandatory=True, argstr="--mov %s", desc="volume to be registered" ) @@ -2302,7 +2299,6 @@ class RobustRegisterInputSpec(FSTraitedSpec): class RobustRegisterOutputSpec(TraitedSpec): - out_reg_file = File(exists=True, desc="output registration file") registered_file = File(exists=True, desc="output image with registration applied") weights_file = File(exists=True, desc="image of weights used") @@ -2388,7 +2384,6 @@ def _list_outputs(self): class FitMSParamsInputSpec(FSTraitedSpec): - in_files = traits.List( File(exists=True), argstr="%s", @@ -2408,7 +2403,6 @@ class FitMSParamsInputSpec(FSTraitedSpec): class FitMSParamsOutputSpec(TraitedSpec): - t1_image = File(exists=True, desc="image of estimated T1 relaxation values") pd_image = File(exists=True, desc="image of estimated proton density values") t2star_image = File(exists=True, desc="image of estimated T2* values") @@ -2466,7 +2460,6 @@ def _gen_filename(self, name): class SynthesizeFLASHInputSpec(FSTraitedSpec): - fixed_weighting = traits.Bool( position=1, argstr="-w", @@ -2495,7 +2488,6 @@ class SynthesizeFLASHInputSpec(FSTraitedSpec): class SynthesizeFLASHOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="synthesized FLASH acquisition") diff --git a/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py b/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py index 6c377c9579..cdc2cc3131 100644 --- a/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py +++ b/nipype/interfaces/freesurfer/tests/test_FSSurfaceCommand.py @@ -35,7 +35,6 @@ def test_associated_file(tmpdir): ("./lh.white", "./lh.pial"), (fsavginfo["white"], fsavginfo["pial"]), ]: - # Unspecified paths, possibly with missing hemisphere information, # are equivalent to using the same directory and hemisphere for name in ("pial", "lh.pial", pial): diff --git a/nipype/interfaces/freesurfer/tests/test_utils.py b/nipype/interfaces/freesurfer/tests/test_utils.py index 0ee9dd3751..09584a404e 100644 --- a/nipype/interfaces/freesurfer/tests/test_utils.py +++ b/nipype/interfaces/freesurfer/tests/test_utils.py @@ -17,7 +17,6 @@ @pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") def test_sample2surf(create_files_in_directory_plus_dummy_file): - s2s = fs.SampleToSurface() # Test underlying command assert s2s.cmd == "mri_vol2surf" @@ -65,7 +64,6 @@ def set_illegal_range(): @pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") def test_surfsmooth(create_surf_file_in_directory): - smooth = fs.SurfaceSmooth() # Test underlying command @@ -104,7 +102,6 @@ def test_surfsmooth(create_surf_file_in_directory): @pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") def test_surfxfm(create_surf_file_in_directory): - xfm = fs.SurfaceTransform() # Test underlying command @@ -141,7 +138,6 @@ def test_surfxfm(create_surf_file_in_directory): @pytest.mark.skipif(fs.no_freesurfer(), reason="freesurfer is not installed") def test_surfshots(create_files_in_directory_plus_dummy_file): - fotos = fs.SurfaceSnapshots() # Test underlying command diff --git a/nipype/interfaces/freesurfer/utils.py b/nipype/interfaces/freesurfer/utils.py index 9ee65366d2..921bb7488f 100644 --- a/nipype/interfaces/freesurfer/utils.py +++ b/nipype/interfaces/freesurfer/utils.py @@ -116,7 +116,6 @@ def createoutputdirs(outputs): class SampleToSurfaceInputSpec(FSTraitedSpec): - source_file = File( exists=True, mandatory=True, @@ -289,7 +288,6 @@ class SampleToSurfaceInputSpec(FSTraitedSpec): class SampleToSurfaceOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="surface file") hits_file = File(exists=True, desc="image with number of hits at each voxel") vox_file = File( @@ -426,7 +424,6 @@ def _gen_filename(self, name): class SurfaceSmoothInputSpec(FSTraitedSpec): - in_file = File(mandatory=True, argstr="--sval %s", desc="source surface file") subject_id = traits.String( mandatory=True, argstr="--s %s", desc="subject id of surface file" @@ -455,7 +452,6 @@ class SurfaceSmoothInputSpec(FSTraitedSpec): class SurfaceSmoothOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="smoothed surface file") @@ -753,7 +749,6 @@ class Surface2VolTransform(FSCommand): class ApplyMaskInputSpec(FSTraitedSpec): - in_file = File( exists=True, mandatory=True, @@ -803,7 +798,6 @@ class ApplyMaskInputSpec(FSTraitedSpec): class ApplyMaskOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="masked image") @@ -822,7 +816,6 @@ class ApplyMask(FSCommand): class SurfaceSnapshotsInputSpec(FSTraitedSpec): - subject_id = traits.String( position=1, argstr="%s", mandatory=True, desc="subject to visualize" ) @@ -956,7 +949,6 @@ class SurfaceSnapshotsInputSpec(FSTraitedSpec): class SurfaceSnapshotsOutputSpec(TraitedSpec): - snapshots = OutputMultiPath( File(exists=True), desc="tiff images of the surface from different perspectives" ) @@ -1118,12 +1110,10 @@ def _gen_filename(self, name): class ImageInfoInputSpec(FSTraitedSpec): - in_file = File(exists=True, position=1, argstr="%s", desc="image to query") class ImageInfoOutputSpec(TraitedSpec): - info = traits.Any(desc="output of mri_info") out_file = File(exists=True, desc="text file with image information") data_type = traits.String(desc="image data type") @@ -1138,7 +1128,6 @@ class ImageInfoOutputSpec(TraitedSpec): class ImageInfo(FSCommand): - _cmd = "mri_info" input_spec = ImageInfoInputSpec output_spec = ImageInfoOutputSpec @@ -2015,7 +2004,6 @@ def _gen_outfilename(self): class AddXFormToHeaderInputSpec(FSTraitedSpec): - # required in_file = File( exists=True, mandatory=True, position=-2, argstr="%s", desc="input volume" @@ -2035,7 +2023,6 @@ class AddXFormToHeaderInputSpec(FSTraitedSpec): class AddXFormToHeaderOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="output volume") diff --git a/nipype/interfaces/fsl/dti.py b/nipype/interfaces/fsl/dti.py index a49c508c64..60f0d8128d 100644 --- a/nipype/interfaces/fsl/dti.py +++ b/nipype/interfaces/fsl/dti.py @@ -462,7 +462,6 @@ def _cuda_update(self): self._cmd = self._default_cmd def _run_interface(self, runtime): - subjectdir = os.path.abspath(self.inputs.out_dir) if not os.path.exists(subjectdir): os.makedirs(subjectdir) @@ -1347,7 +1346,6 @@ def _gen_filename(self, name): class TractSkeletonInputSpec(FSLCommandInputSpec): - in_file = File( exists=True, mandatory=True, @@ -1385,7 +1383,6 @@ class TractSkeletonInputSpec(FSLCommandInputSpec): class TractSkeletonOutputSpec(TraitedSpec): - projected_data = File(desc="input data projected onto skeleton") skeleton_file = File(desc="tract skeleton image") @@ -1468,7 +1465,6 @@ def _list_outputs(self): class DistanceMapInputSpec(FSLCommandInputSpec): - in_file = File( exists=True, mandatory=True, @@ -1492,7 +1488,6 @@ class DistanceMapInputSpec(FSLCommandInputSpec): class DistanceMapOutputSpec(TraitedSpec): - distance_map = File(exists=True, desc="value is distance to nearest nonzero voxels") local_max_file = File(desc="image of local maxima") diff --git a/nipype/interfaces/fsl/fix.py b/nipype/interfaces/fsl/fix.py index 5c978f0a97..1b6d62a5bc 100644 --- a/nipype/interfaces/fsl/fix.py +++ b/nipype/interfaces/fsl/fix.py @@ -302,7 +302,6 @@ class Classifier(CommandLine): cmd = "fix -c" def _gen_artifacts_list_file(self, mel_ica, thresh): - _, trained_wts_file = os.path.split(self.inputs.trained_wts_file) trained_wts_filestem = trained_wts_file.split(".")[0] filestem = "fix4melview_" + trained_wts_filestem + "_thr" diff --git a/nipype/interfaces/fsl/maths.py b/nipype/interfaces/fsl/maths.py index 6e7baf74ce..d8669c4422 100644 --- a/nipype/interfaces/fsl/maths.py +++ b/nipype/interfaces/fsl/maths.py @@ -13,7 +13,6 @@ class MathsInput(FSLCommandInputSpec): - in_file = File( position=2, argstr="%s", exists=True, mandatory=True, desc="image to operate on" ) @@ -40,12 +39,10 @@ class MathsInput(FSLCommandInputSpec): class MathsOutput(TraitedSpec): - out_file = File(desc="image written after calculations") class MathsCommand(FSLCommand): - _cmd = "fslmaths" input_spec = MathsInput output_spec = MathsOutput @@ -68,7 +65,6 @@ def _gen_filename(self, name): class ChangeDataTypeInput(MathsInput): - _dtypes = ["float", "char", "int", "short", "double", "input"] output_datatype = traits.Enum( *_dtypes, position=-1, argstr="-odt %s", mandatory=True, desc="output data type" @@ -83,7 +79,6 @@ class ChangeDataType(MathsCommand): class ThresholdInputSpec(MathsInput): - thresh = traits.Float( mandatory=True, position=4, argstr="%s", desc="threshold value" ) @@ -126,7 +121,6 @@ def _format_arg(self, name, spec, value): class StdImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -149,7 +143,6 @@ class StdImage(MathsCommand): class MeanImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -170,7 +163,6 @@ class MeanImage(MathsCommand): class MaxImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -202,7 +194,6 @@ class MaxImage(MathsCommand): class PercentileImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -242,7 +233,6 @@ class PercentileImage(MathsCommand): class MaxnImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -266,7 +256,6 @@ class MaxnImage(MathsCommand): class MinImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -287,7 +276,6 @@ class MinImage(MathsCommand): class MedianImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -308,7 +296,6 @@ class MedianImage(MathsCommand): class AR1ImageInput(MathsInput): - dimension = traits.Enum( "T", "X", @@ -332,7 +319,6 @@ class AR1Image(MathsCommand): class IsotropicSmoothInput(MathsInput): - fwhm = traits.Float( mandatory=True, xor=["sigma"], @@ -363,7 +349,6 @@ def _format_arg(self, name, spec, value): class ApplyMaskInput(MathsInput): - mask_file = File( exists=True, mandatory=True, @@ -381,7 +366,6 @@ class ApplyMask(MathsCommand): class KernelInput(MathsInput): - kernel_shape = traits.Enum( "3D", "2D", @@ -412,7 +396,6 @@ class KernelInput(MathsInput): class DilateInput(KernelInput): - operation = traits.Enum( "mean", "modal", @@ -437,7 +420,6 @@ def _format_arg(self, name, spec, value): class ErodeInput(KernelInput): - minimum_filter = traits.Bool( argstr="%s", position=6, @@ -462,7 +444,6 @@ def _format_arg(self, name, spec, value): class SpatialFilterInput(KernelInput): - operation = traits.Enum( "mean", "median", @@ -482,7 +463,6 @@ class SpatialFilter(MathsCommand): class UnaryMathsInput(MathsInput): - operation = traits.Enum( "exp", "log", @@ -525,7 +505,6 @@ def _list_outputs(self): class BinaryMathsInput(MathsInput): - operation = traits.Enum( "add", "sub", @@ -566,7 +545,6 @@ class BinaryMaths(MathsCommand): class MultiImageMathsInput(MathsInput): - op_string = traits.String( position=4, argstr="%s", @@ -605,7 +583,6 @@ def _format_arg(self, name, spec, value): class TemporalFilterInput(MathsInput): - lowpass_sigma = traits.Float( -1, argstr="%.6f", diff --git a/nipype/interfaces/fsl/tests/test_dti.py b/nipype/interfaces/fsl/tests/test_dti.py index 8f5abfc662..0a6a2e8d63 100644 --- a/nipype/interfaces/fsl/tests/test_dti.py +++ b/nipype/interfaces/fsl/tests/test_dti.py @@ -41,7 +41,6 @@ def test_dtifit2(create_files_in_directory): @pytest.mark.xfail(reason="These tests are skipped until we clean up some of this code") def test_randomise2(): - rand = fsl.Randomise() # make sure command gets called @@ -233,7 +232,6 @@ def test_Proj_thresh(): # test vec_reg @pytest.mark.xfail(reason="These tests are skipped until we clean up some of this code") def test_Vec_reg(): - vrg = fsl.VecReg() # make sure command gets called diff --git a/nipype/interfaces/fsl/tests/test_preprocess.py b/nipype/interfaces/fsl/tests/test_preprocess.py index 23ae7a6824..a5752d8d49 100644 --- a/nipype/interfaces/fsl/tests/test_preprocess.py +++ b/nipype/interfaces/fsl/tests/test_preprocess.py @@ -402,7 +402,6 @@ def test_mcflirt_noinput(): @pytest.mark.skipif(no_fsl(), reason="fsl is not installed") def test_fnirt(setup_flirt): - tmpdir, infile, reffile = setup_flirt tmpdir.chdir() fnirt = fsl.FNIRT() @@ -497,7 +496,7 @@ def test_fnirt(setup_flirt): ("log_file", "--logout=%s" % infile, infile), ] - for (name, settings, arg) in opt_map: + for name, settings, arg in opt_map: fnirt = fsl.FNIRT(in_file=infile, ref_file=reffile, **{name: arg}) if name in ("config_file", "affine_file", "field_file", "fieldcoeff_file"): diff --git a/nipype/interfaces/fsl/utils.py b/nipype/interfaces/fsl/utils.py index 4bb44d00b3..734eccc74d 100644 --- a/nipype/interfaces/fsl/utils.py +++ b/nipype/interfaces/fsl/utils.py @@ -482,7 +482,6 @@ class ExtractROI(FSLCommand): output_spec = ExtractROIOutputSpec def _format_arg(self, name, spec, value): - if name == "crop_list": return " ".join(map(str, sum(list(map(list, value)), []))) return super(ExtractROI, self)._format_arg(name, spec, value) @@ -1251,7 +1250,6 @@ def _gen_filename(self, name): class PlotTimeSeriesInputSpec(FSLCommandInputSpec): - in_file = traits.Either( File(exists=True), traits.List(File(exists=True)), @@ -1308,7 +1306,6 @@ class PlotTimeSeriesInputSpec(FSLCommandInputSpec): class PlotTimeSeriesOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="image to write") @@ -1374,7 +1371,6 @@ def _gen_filename(self, name): class PlotMotionParamsInputSpec(FSLCommandInputSpec): - in_file = traits.Either( File(exists=True), traits.List(File(exists=True)), @@ -1406,7 +1402,6 @@ class PlotMotionParamsInputSpec(FSLCommandInputSpec): class PlotMotionParamsOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="image to write") @@ -1443,7 +1438,6 @@ class PlotMotionParams(FSLCommand): output_spec = PlotMotionParamsOutputSpec def _format_arg(self, name, spec, value): - if name == "plot_type": source = self.inputs.in_source @@ -1602,7 +1596,6 @@ def _gen_filename(self, name): class SwapDimensionsInputSpec(FSLCommandInputSpec): - in_file = File( exists=True, mandatory=True, argstr="%s", position="1", desc="input image" ) @@ -1619,7 +1612,6 @@ class SwapDimensionsInputSpec(FSLCommandInputSpec): class SwapDimensionsOutputSpec(TraitedSpec): - out_file = File(exists=True, desc="image with new dimensions") diff --git a/nipype/interfaces/io.py b/nipype/interfaces/io.py index ea06482500..09919e8607 100644 --- a/nipype/interfaces/io.py +++ b/nipype/interfaces/io.py @@ -254,7 +254,6 @@ class DataSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): # Set call-able inputs attributes def __setattr__(self, key, value): - if key not in self.copyable_trait_names(): if not isdefined(value): super(DataSinkInputSpec, self).__setattr__(key, value) @@ -267,7 +266,6 @@ def __setattr__(self, key, value): # DataSink outputs class DataSinkOutputSpec(TraitedSpec): - # Init out file out_file = traits.Any(desc="datasink output") @@ -575,7 +573,6 @@ def _fetch_bucket(self, bucket_name): try: _get_head_bucket(s3_resource, bucket_name) except Exception as exc: - # Try to connect anonymously s3_resource.meta.client.meta.events.register( "choose-signer.s3.*", botocore.handlers.disable_signing @@ -1313,7 +1310,6 @@ def _list_outputs(self): class SelectFilesInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): - base_directory = Directory(exists=True, desc="Root path common to templates.") sort_filelist = traits.Bool( True, @@ -1447,7 +1443,6 @@ def _list_outputs(self): raise ValueError(msg) for field, template in list(self._templates.items()): - find_dirs = template[-1] == os.sep # Build the full template path @@ -1853,7 +1848,6 @@ def _list_outputs(self): class XNATSourceInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): - query_template = Str( mandatory=True, desc=("Layout used to get files. Relative to base " "directory if defined"), @@ -2065,7 +2059,6 @@ def _list_outputs(self): class XNATSinkInputSpec(DynamicTraitedSpec, BaseInterfaceInputSpec): - _outputs = traits.Dict(Str, value={}, usedefault=True) server = Str(mandatory=True, requires=["user", "pwd"], xor=["config"]) @@ -2154,7 +2147,6 @@ def _list_outputs(self): ) if not shared.exists(): # subject not in share project - share_project = xnat.select("/project/%s" % self.inputs.project_id) if not share_project.exists(): # check project exists @@ -2185,9 +2177,7 @@ def _list_outputs(self): # gather outputs and upload them for key, files in list(self.inputs._outputs.items()): - for name in ensure_list(files): - if isinstance(name, list): for i, file_name in enumerate(name): push_file( @@ -2206,7 +2196,6 @@ def unquote_id(string): def push_file(self, xnat, file_name, out_key, uri_template_args): - # grab info from output file names val_list = [ unquote_id(val) @@ -2269,7 +2258,6 @@ def push_file(self, xnat, file_name, out_key, uri_template_args): # shares the experiment back to the original project if relevant if "original_project" in uri_template_args: - experiment_template = ( "/project/%(original_project)s" "/subject/%(subject_id)s/experiment/%(experiment_id)s" @@ -2318,7 +2306,6 @@ class SQLiteSink(LibraryBaseInterface, IOBase): _pkg = "sqlite3" def __init__(self, input_names, **inputs): - super(SQLiteSink, self).__init__(**inputs) self._input_names = ensure_list(input_names) @@ -2381,7 +2368,6 @@ class MySQLSink(IOBase): input_spec = MySQLSinkInputSpec def __init__(self, input_names, **inputs): - super(MySQLSink, self).__init__(**inputs) self._input_names = ensure_list(input_names) diff --git a/nipype/interfaces/minc/base.py b/nipype/interfaces/minc/base.py index 3de0112614..7fe817dcaa 100644 --- a/nipype/interfaces/minc/base.py +++ b/nipype/interfaces/minc/base.py @@ -80,7 +80,7 @@ def read_hdf5_version(s): versions = {"minc": None, "libminc": None, "netcdf": None, "hdf5": None} for l in out.split("\n"): - for (name, f) in [ + for name, f in [ ("minc", read_program_version), ("libminc", read_libminc_version), ("netcdf", read_netcdf_version), diff --git a/nipype/interfaces/minc/minc.py b/nipype/interfaces/minc/minc.py index 9d28832f50..4e740afab4 100644 --- a/nipype/interfaces/minc/minc.py +++ b/nipype/interfaces/minc/minc.py @@ -3031,7 +3031,6 @@ class Volpad(CommandLine): class VolisoInputSpec(CommandLineInputSpec): - input_file = File( desc="input file to convert to isotropic sampling", exists=True, diff --git a/nipype/interfaces/niftyseg/tests/test_em_interfaces.py b/nipype/interfaces/niftyseg/tests/test_em_interfaces.py index 5615f3e61c..c90d93a6ba 100644 --- a/nipype/interfaces/niftyseg/tests/test_em_interfaces.py +++ b/nipype/interfaces/niftyseg/tests/test_em_interfaces.py @@ -11,7 +11,6 @@ @pytest.mark.skipif(no_nifty_tool(cmd="seg_EM"), reason="niftyseg is not installed") def test_seg_em(): - # Create a node object seg_em = EM() diff --git a/nipype/interfaces/niftyseg/tests/test_extra_PatchMatch.py b/nipype/interfaces/niftyseg/tests/test_extra_PatchMatch.py index 18156e37f1..53d5bd4170 100644 --- a/nipype/interfaces/niftyseg/tests/test_extra_PatchMatch.py +++ b/nipype/interfaces/niftyseg/tests/test_extra_PatchMatch.py @@ -13,7 +13,6 @@ no_nifty_tool(cmd="seg_PatchMatch"), reason="niftyseg is not installed" ) def test_seg_patchmatch(): - # Create a node object seg_patchmatch = PatchMatch() diff --git a/nipype/interfaces/niftyseg/tests/test_lesions.py b/nipype/interfaces/niftyseg/tests/test_lesions.py index d46b380cc2..2daece08cb 100644 --- a/nipype/interfaces/niftyseg/tests/test_lesions.py +++ b/nipype/interfaces/niftyseg/tests/test_lesions.py @@ -13,7 +13,6 @@ no_nifty_tool(cmd="seg_FillLesions"), reason="niftyseg is not installed" ) def test_seg_filllesions(): - # Create a node object seg_fill = FillLesions() diff --git a/nipype/interfaces/niftyseg/tests/test_maths.py b/nipype/interfaces/niftyseg/tests/test_maths.py index 84740b7447..6c0251d7f5 100644 --- a/nipype/interfaces/niftyseg/tests/test_maths.py +++ b/nipype/interfaces/niftyseg/tests/test_maths.py @@ -11,7 +11,6 @@ @pytest.mark.skipif(no_nifty_tool(cmd="seg_maths"), reason="niftyseg is not installed") def test_unary_maths(): - # Create a node object unarym = UnaryMaths() @@ -38,7 +37,6 @@ def test_unary_maths(): @pytest.mark.skipif(no_nifty_tool(cmd="seg_maths"), reason="niftyseg is not installed") def test_binary_maths(): - # Create a node object binarym = BinaryMaths() @@ -65,7 +63,6 @@ def test_binary_maths(): @pytest.mark.skipif(no_nifty_tool(cmd="seg_maths"), reason="niftyseg is not installed") def test_int_binary_maths(): - # Create a node object ibinarym = BinaryMathsInteger() @@ -93,7 +90,6 @@ def test_int_binary_maths(): @pytest.mark.skipif(no_nifty_tool(cmd="seg_maths"), reason="niftyseg is not installed") def test_tuple_maths(): - # Create a node object tuplem = TupleMaths() @@ -124,7 +120,6 @@ def test_tuple_maths(): @pytest.mark.skipif(no_nifty_tool(cmd="seg_maths"), reason="niftyseg is not installed") def test_merge(): - # Create a node object merge = Merge() diff --git a/nipype/interfaces/nitime/analysis.py b/nipype/interfaces/nitime/analysis.py index f6c7aa1f61..d5b6c3a3de 100644 --- a/nipype/interfaces/nitime/analysis.py +++ b/nipype/interfaces/nitime/analysis.py @@ -32,7 +32,6 @@ class CoherenceAnalyzerInputSpec(BaseInterfaceInputSpec): - # Input either csv file, or time-series object and use _xor_inputs to # discriminate _xor_inputs = ("in_file", "in_TS") diff --git a/nipype/interfaces/spm/base.py b/nipype/interfaces/spm/base.py index 2347d718ae..4e9b78e1f1 100644 --- a/nipype/interfaces/spm/base.py +++ b/nipype/interfaces/spm/base.py @@ -201,7 +201,6 @@ def getinfo(klass, matlab_cmd=None, paths=None, use_mcr=None): and klass._command == matlab_cmd and klass._paths == paths ): - return {"name": klass._name, "path": klass._path, "release": klass._version} logger.debug("matlab command or path has changed. recomputing version.") mlab = MatlabCommand(matlab_cmd=matlab_cmd, resource_monitor=False) diff --git a/nipype/interfaces/spm/preprocess.py b/nipype/interfaces/spm/preprocess.py index dbafdcd18d..a612865039 100644 --- a/nipype/interfaces/spm/preprocess.py +++ b/nipype/interfaces/spm/preprocess.py @@ -39,7 +39,6 @@ class FieldMapInputSpec(SPMCommandInputSpec): - jobtype = traits.Enum( "calculatevdm", usedefault=True, @@ -235,7 +234,6 @@ def _format_arg(self, opt, spec, val): """Convert input to appropriate format for spm""" if opt in ["phase_file", "magnitude_file", "anat_file", "epi_file"]: - return scans_for_fname(ensure_list(val)) return super(FieldMap, self)._format_arg(opt, spec, val) @@ -256,7 +254,6 @@ def _list_outputs(self): class ApplyVDMInputSpec(SPMCommandInputSpec): - in_files = InputMultiObject( ImageFileSPM(exists=True), field="data.scans", @@ -674,7 +671,6 @@ def _list_outputs(self): class RealignUnwarpInputSpec(SPMCommandInputSpec): - in_files = InputMultiObject( traits.Either( ImageFileSPM(exists=True), traits.List(ImageFileSPM(exists=True)) @@ -879,7 +875,6 @@ def _format_arg(self, opt, spec, val): return super(RealignUnwarp, self)._format_arg(opt, spec, val) def _parse_inputs(self, skip=()): - spmdict = super(RealignUnwarp, self)._parse_inputs(skip=())[0] if isdefined(self.inputs.phase_map): @@ -2681,7 +2676,6 @@ def _list_outputs(self): class VBMSegmentInputSpec(SPMCommandInputSpec): - in_files = InputMultiPath( ImageFileSPM(exists=True), desc="A list of files to be segmented", @@ -2851,7 +2845,6 @@ class VBMSegmentInputSpec(SPMCommandInputSpec): class VBMSegmentOuputSpec(TraitedSpec): - native_class_images = traits.List( traits.List(File(exists=True)), desc="native space probability maps" ) diff --git a/nipype/interfaces/spm/utils.py b/nipype/interfaces/spm/utils.py index 543a0d3024..1c9e506d57 100644 --- a/nipype/interfaces/spm/utils.py +++ b/nipype/interfaces/spm/utils.py @@ -24,7 +24,6 @@ class Analyze2niiOutputSpec(SPMCommandInputSpec): class Analyze2nii(SPMCommand): - input_spec = Analyze2niiInputSpec output_spec = Analyze2niiOutputSpec diff --git a/nipype/interfaces/tests/test_io.py b/nipype/interfaces/tests/test_io.py index 45bd53e32c..2df5c9dad8 100644 --- a/nipype/interfaces/tests/test_io.py +++ b/nipype/interfaces/tests/test_io.py @@ -571,7 +571,6 @@ def test_freesurfersource_incorrectdir(): def test_jsonsink_input(): - ds = nio.JSONFileSink() assert ds.inputs._outputs == {} diff --git a/nipype/interfaces/tests/test_nilearn.py b/nipype/interfaces/tests/test_nilearn.py index 4f94bbb87b..29a068552c 100644 --- a/nipype/interfaces/tests/test_nilearn.py +++ b/nipype/interfaces/tests/test_nilearn.py @@ -22,7 +22,6 @@ @pytest.mark.skipif(no_nilearn, reason="the nilearn library is not available") class TestSignalExtraction: - filenames = { "in_file": "fmri.nii", "label_files": "labels.nii", diff --git a/nipype/pipeline/engine/tests/test_engine.py b/nipype/pipeline/engine/tests/test_engine.py index a44922910d..2df8f0b233 100644 --- a/nipype/pipeline/engine/tests/test_engine.py +++ b/nipype/pipeline/engine/tests/test_engine.py @@ -196,7 +196,6 @@ def test_synchronize_tuples_expansion(): def test_itersource_expansion(): - wf1 = pe.Workflow(name="test") node1 = pe.Node(EngineTestInterface(), name="node1") node1.iterables = ("input1", [1, 2]) diff --git a/nipype/pipeline/engine/tests/test_workflows.py b/nipype/pipeline/engine/tests/test_workflows.py index c6170f7ba8..ab6ad663fd 100644 --- a/nipype/pipeline/engine/tests/test_workflows.py +++ b/nipype/pipeline/engine/tests/test_workflows.py @@ -100,7 +100,6 @@ def test_nested_workflow_doubleconnect(): def test_duplicate_node_check(): - wf = pe.Workflow(name="testidentity") original_list = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] diff --git a/nipype/pipeline/plugins/slurm.py b/nipype/pipeline/plugins/slurm.py index 44cdac70d5..c06444a02e 100644 --- a/nipype/pipeline/plugins/slurm.py +++ b/nipype/pipeline/plugins/slurm.py @@ -31,7 +31,6 @@ class SLURMPlugin(SGELikeBatchManagerBase): """ def __init__(self, **kwargs): - template = "#!/bin/bash" self._retry_timeout = 2 diff --git a/nipype/pipeline/plugins/tests/test_legacymultiproc_nondaemon.py b/nipype/pipeline/plugins/tests/test_legacymultiproc_nondaemon.py index 5f33b025b2..4e44c801ec 100644 --- a/nipype/pipeline/plugins/tests/test_legacymultiproc_nondaemon.py +++ b/nipype/pipeline/plugins/tests/test_legacymultiproc_nondaemon.py @@ -50,7 +50,6 @@ def dummyFunction(filename): f.write(str(j)) for n in range(numberOfThreads): - # mark thread as alive a[n] = True @@ -64,11 +63,9 @@ def dummyFunction(filename): # block until all processes are done allDone = False while not allDone: - time.sleep(1) for n in range(numberOfThreads): - a[n] = t[n].is_alive() if not any(a): diff --git a/nipype/tests/test_nipype.py b/nipype/tests/test_nipype.py index 9ac517f9d7..3f103b5529 100644 --- a/nipype/tests/test_nipype.py +++ b/nipype/tests/test_nipype.py @@ -51,7 +51,6 @@ def test_no_et_bare(tmp_path): # Pytest doesn't trigger this, so let's pretend it's there with patch.object(BaseInterface, "_etelemetry_version_data", {}): - # Direct function call - environment not set f = niu.Function(function=_check_no_et) res = f.run() @@ -87,7 +86,6 @@ def test_no_et_multiproc(tmp_path, plugin, run_without_submitting): # Pytest doesn't trigger this, so let's pretend it's there with patch.object(BaseInterface, "_etelemetry_version_data", {}): - wf = pe.Workflow(name="wf2", base_dir=str(tmp_path)) n = pe.Node( niu.Function(function=_check_no_et), diff --git a/nipype/utils/nipype_cmd.py b/nipype/utils/nipype_cmd.py index 7cfff832c1..76717bf168 100644 --- a/nipype/utils/nipype_cmd.py +++ b/nipype/utils/nipype_cmd.py @@ -61,7 +61,6 @@ def run_instance(interface, options): def main(argv): - if len(argv) == 2 and not argv[1].startswith("-"): listClasses(argv[1]) sys.exit(0) diff --git a/nipype/utils/tests/test_filemanip.py b/nipype/utils/tests/test_filemanip.py index 8d4597317c..91f0e1f229 100644 --- a/nipype/utils/tests/test_filemanip.py +++ b/nipype/utils/tests/test_filemanip.py @@ -612,7 +612,6 @@ def test_versioned_pklization(tmpdir): with mock.patch( "nipype.utils.tests.test_filemanip.Pickled", PickledBreaker ), mock.patch("nipype.__version__", "0.0.0"): - loadpkl("./pickled.pkz") diff --git a/tools/checkspecs.py b/tools/checkspecs.py index 032fd122cc..7aaac0d107 100644 --- a/tools/checkspecs.py +++ b/tools/checkspecs.py @@ -13,8 +13,7 @@ # Functions and classes class InterfaceChecker(object): - """Class for checking all interface specifications - """ + """Class for checking all interface specifications""" def __init__( self, @@ -23,7 +22,7 @@ def __init__( module_skip_patterns=None, class_skip_patterns=None, ): - r""" Initialize package for parsing + r"""Initialize package for parsing Parameters ---------- @@ -113,14 +112,14 @@ def _uri2path(self, uri): return path def _path2uri(self, dirpath): - """ Convert directory path to uri """ + """Convert directory path to uri""" relpath = dirpath.replace(self.root_path, self.package_name) if relpath.startswith(os.path.sep): relpath = relpath[1:] return relpath.replace(os.path.sep, ".") def _parse_module(self, uri): - """ Parse module defined in *uri* """ + """Parse module defined in *uri*""" filename = self._uri2path(uri) if filename is None: # nothing that we could handle here. @@ -131,7 +130,7 @@ def _parse_module(self, uri): return functions, classes def _parse_lines(self, linesource, module): - """ Parse lines of text for functions and classes """ + """Parse lines of text for functions and classes""" functions = [] classes = [] for line in linesource: @@ -387,7 +386,7 @@ def test_specs(self, uri): return bad_specs def _survives_exclude(self, matchstr, match_type): - """ Returns True if *matchstr* does not match patterns + """Returns True if *matchstr* does not match patterns ``self.package_name`` removed from front of string if present @@ -429,7 +428,7 @@ def _survives_exclude(self, matchstr, match_type): return True def discover_modules(self): - """ Return module sequence discovered from ``self.package_name`` + """Return module sequence discovered from ``self.package_name`` Parameters diff --git a/tools/gitwash_dumper.py b/tools/gitwash_dumper.py index 36efd7f83e..2c08547bac 100755 --- a/tools/gitwash_dumper.py +++ b/tools/gitwash_dumper.py @@ -50,9 +50,7 @@ def cp_files(in_path, globs, out_path): def filename_search_replace(sr_pairs, filename, backup=False): - """ Search and replace for expressions in files - - """ + """Search and replace for expressions in files""" in_txt = open(filename, "rt").read(-1) out_txt = in_txt[:] for in_exp, out_exp in sr_pairs: @@ -94,7 +92,7 @@ def make_link_targets( url=None, ml_url=None, ): - """ Check and make link targets + """Check and make link targets If url is None or ml_url is None, check if there are links present for these in `known_link_fname`. If not, raise error. The check is: diff --git a/tools/run_examples.py b/tools/run_examples.py index 20382ef74d..bd77f1a0a4 100644 --- a/tools/run_examples.py +++ b/tools/run_examples.py @@ -4,9 +4,15 @@ if __name__ == "__main__": - print(dedent("""Nipype examples have been moved to niflow-nipype1-examples. + print( + dedent( + """Nipype examples have been moved to niflow-nipype1-examples. -Install with: pip install niflow-nipype1-examples""")) +Install with: pip install niflow-nipype1-examples""" + ) + ) if sys.argv[1:]: - print("Run this command with: niflow-nipype1-examples " + " ".join(sys.argv[1:])) + print( + "Run this command with: niflow-nipype1-examples " + " ".join(sys.argv[1:]) + ) sys.exit(1)