Skip to content

Commit e6695bc

Browse files
committed
FIX: PEP8 - W503 line break before binary operator
1 parent e9dc256 commit e6695bc

File tree

15 files changed

+108
-110
lines changed

15 files changed

+108
-110
lines changed

doc/sphinxext/numpy_ext/docscrape.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -504,9 +504,9 @@ def methods(self):
504504
if self._cls is None:
505505
return []
506506
return [name for name, func in inspect.getmembers(self._cls)
507-
if ((not name.startswith('_')
508-
or name in self.extra_public_methods)
509-
and callable(func))]
507+
if ((not name.startswith('_') or
508+
name in self.extra_public_methods) and
509+
callable(func))]
510510

511511
@property
512512
def properties(self):

doc/sphinxext/numpy_ext/docscrape_sphinx.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,8 @@ def _str_references(self):
164164
def _str_examples(self):
165165
examples_str = "\n".join(self['Examples'])
166166

167-
if (self.use_plots and 'import matplotlib' in examples_str
168-
and 'plot::' not in examples_str):
167+
if (self.use_plots and 'import matplotlib' in examples_str and
168+
'plot::' not in examples_str):
169169
out = []
170170
out += self._str_header('Examples')
171171
out += ['.. plot::', '']

nipype/algorithms/metrics.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,8 @@ def _run_interface(self, runtime):
335335

336336
self._labels = labels
337337
self._ove_rois = results
338-
self._vol_rois = (np.array(volumes1)
339-
- np.array(volumes2)) / np.array(volumes1)
338+
self._vol_rois = (np.array(volumes1) -
339+
np.array(volumes2)) / np.array(volumes1)
340340

341341
self._dice = round(np.sum(weights*results['dice']), 5)
342342
self._jaccard = round(np.sum(weights*results['jaccard']), 5)

nipype/algorithms/rapidart.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,8 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
461461
traval = mc[:, 0:3] # translation parameters (mm)
462462
rotval = mc[:, 3:6] # rotation parameters (rad)
463463
tidx = find_indices(np.sum(abs(traval) >
464-
self.inputs.translation_threshold, 1)
465-
> 0)
464+
self.inputs.translation_threshold, 1) >
465+
0)
466466
ridx = find_indices(np.sum(abs(rotval) >
467467
self.inputs.rotation_threshold, 1) > 0)
468468

nipype/caching/memory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ def __init__(self, interface, base_dir, callback=None):
5151
An optional callable called each time after the function
5252
is called.
5353
"""
54-
if not (isinstance(interface, type)
55-
and issubclass(interface, BaseInterface)):
54+
if not (isinstance(interface, type) and
55+
issubclass(interface, BaseInterface)):
5656
raise ValueError('the interface argument should be a nipype '
5757
'interface class, but %s (type %s) was passed.' %
5858
(interface, type(interface)))

nipype/fixes/numpy/testing/noseclasses.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,8 @@ def _find(self, tests, obj, name, module, source_lines, globs, seen):
8787
if ismodule(obj) and self._recurse:
8888
for valname, val in list(obj.__dict__.items()):
8989
valname1 = '%s.%s' % (name, valname)
90-
if ((isroutine(val) or isclass(val))
91-
and self._from_module(module, val)):
90+
if ((isroutine(val) or isclass(val)) and
91+
self._from_module(module, val)):
9292

9393
self._find(tests, val, valname1, module, source_lines,
9494
globs, seen)

nipype/interfaces/base.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -514,8 +514,8 @@ def _clean_container(self, object, undefinedval=None, skipundefined=False):
514514
else:
515515
if not skipundefined:
516516
out[key] = undefinedval
517-
elif (isinstance(object, TraitListObject) or isinstance(object, list)
518-
or isinstance(object, tuple)):
517+
elif (isinstance(object, TraitListObject) or
518+
isinstance(object, list) or isinstance(object, tuple)):
519519
out = []
520520
for val in object:
521521
if isdefined(val):
@@ -564,9 +564,8 @@ def get_hashval(self, hash_method=None):
564564
if has_metadata(trait.trait_type, "nohash", True):
565565
continue
566566
hash_files = (not has_metadata(trait.trait_type, "hash_files",
567-
False)
568-
and not has_metadata(trait.trait_type,
569-
"name_source"))
567+
False) and not
568+
has_metadata(trait.trait_type, "name_source"))
570569
dict_nofilename.append((name,
571570
self._get_sorteddict(val, hash_method=hash_method,
572571
hash_files=hash_files)))
@@ -1522,8 +1521,8 @@ def _format_arg(self, name, trait_spec, value):
15221521
# traits.Either turns into traits.TraitCompound and does not have any
15231522
# inner_traits
15241523
elif trait_spec.is_trait_type(traits.List) \
1525-
or (trait_spec.is_trait_type(traits.TraitCompound)
1526-
and isinstance(value, list)):
1524+
or (trait_spec.is_trait_type(traits.TraitCompound) and
1525+
isinstance(value, list)):
15271526
# This is a bit simple-minded at present, and should be
15281527
# construed as the default. If more sophisticated behavior
15291528
# is needed, it can be accomplished with metadata (e.g.
@@ -1771,13 +1770,14 @@ def validate(self, object, name, value):
17711770
newvalue = value
17721771

17731772
if not isinstance(value, list) \
1774-
or (self.inner_traits()
1775-
and isinstance(self.inner_traits()[0].trait_type, traits.List)
1776-
and not isinstance(self.inner_traits()[0].trait_type,
1777-
InputMultiPath)
1778-
and isinstance(value, list)
1779-
and value
1780-
and not isinstance(value[0], list)):
1773+
or (self.inner_traits() and
1774+
isinstance(self.inner_traits()[0].trait_type,
1775+
traits.List) and not
1776+
isinstance(self.inner_traits()[0].trait_type,
1777+
InputMultiPath) and
1778+
isinstance(value, list) and
1779+
value and not
1780+
isinstance(value[0], list)):
17811781
newvalue = [value]
17821782
value = super(MultiPath, self).validate(object, name, newvalue)
17831783

nipype/interfaces/fsl/dti.py

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ def _list_outputs(self):
9696
outputs = self.output_spec().get()
9797
for k in list(outputs.keys()):
9898
if k not in ('outputtype', 'environ', 'args'):
99-
if k != 'tensor' or (isdefined(self.inputs.save_tensor)
100-
and self.inputs.save_tensor):
99+
if k != 'tensor' or (isdefined(self.inputs.save_tensor) and
100+
self.inputs.save_tensor):
101101
outputs[k] = self._gen_fname(self.inputs.base_name, suffix='_' + k)
102102
return outputs
103103

@@ -623,27 +623,27 @@ def _list_outputs(self):
623623
outputs[k] = []
624624

625625
for n in range(self.inputs.fibres):
626-
outputs['merged_thsamples'].append(self._gen_fname('merged_th' + repr(n + 1)
627-
+ 'samples', suffix='',
628-
cwd=outputs['bpx_out_directory']))
629-
outputs['merged_phsamples'].append(self._gen_fname('merged_ph' + repr(n + 1)
630-
+ 'samples', suffix='',
631-
cwd=outputs['bpx_out_directory']))
632-
outputs['merged_fsamples'].append(self._gen_fname('merged_f' + repr(n + 1)
633-
+ 'samples', suffix='',
634-
cwd=outputs['bpx_out_directory']))
635-
outputs['mean_thsamples'].append(self._gen_fname('mean_th' + repr(n + 1)
636-
+ 'samples', suffix='',
637-
cwd=outputs['bpx_out_directory']))
638-
outputs['mean_phsamples'].append(self._gen_fname('mean_ph' + repr(n + 1)
639-
+ 'samples', suffix='',
640-
cwd=outputs['bpx_out_directory']))
641-
outputs['mean_fsamples'].append(self._gen_fname('mean_f' + repr(n + 1)
642-
+ 'samples', suffix='',
643-
cwd=outputs['bpx_out_directory']))
644-
outputs['dyads'].append(self._gen_fname('dyads' + repr(n + 1),
645-
suffix='',
646-
cwd=outputs['bpx_out_directory']))
626+
outputs['merged_thsamples'].append(self._gen_fname(
627+
'merged_th' + repr(n + 1) + 'samples',
628+
suffix='', cwd=outputs['bpx_out_directory']))
629+
outputs['merged_phsamples'].append(self._gen_fname(
630+
'merged_ph' + repr(n + 1) + 'samples',
631+
suffix='', cwd=outputs['bpx_out_directory']))
632+
outputs['merged_fsamples'].append(self._gen_fname(
633+
'merged_f' + repr(n + 1) + 'samples',
634+
suffix='', cwd=outputs['bpx_out_directory']))
635+
outputs['mean_thsamples'].append(self._gen_fname(
636+
'mean_th' + repr(n + 1) + 'samples',
637+
suffix='', cwd=outputs['bpx_out_directory']))
638+
outputs['mean_phsamples'].append(self._gen_fname(
639+
'mean_ph' + repr(n + 1) + 'samples',
640+
suffix='', cwd=outputs['bpx_out_directory']))
641+
outputs['mean_fsamples'].append(self._gen_fname(
642+
'mean_f' + repr(n + 1) + 'samples',
643+
suffix='', cwd=outputs['bpx_out_directory']))
644+
outputs['dyads'].append(self._gen_fname(
645+
'dyads' + repr(n + 1),
646+
suffix='', cwd=outputs['bpx_out_directory']))
647647
return outputs
648648

649649

@@ -735,8 +735,8 @@ class ProbTrackXBaseInputSpec(FSLCommandInputSpec):
735735

736736
class ProbTrackXInputSpec(ProbTrackXBaseInputSpec):
737737
mode = traits.Enum("simple", "two_mask_symm", "seedmask",
738-
desc='options: simple (single seed voxel), seedmask (mask of seed voxels), '
739-
+ 'twomask_symm (two bet binary masks) ',
738+
desc='options: simple (single seed voxel), seedmask (mask of seed voxels), ' +
739+
'twomask_symm (two bet binary masks) ',
740740
argstr='--mode=%s', genfile=True)
741741
mask2 = File(exists=True, desc='second bet binary mask (in diffusion space) in twomask_symm mode',
742742
argstr='--mask2=%s')

nipype/interfaces/fsl/model.py

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1818,31 +1818,30 @@ class GLMInputSpec(FSLCommandInputSpec):
18181818
in_file = File(exists=True, argstr='-i %s', mandatory=True, position=1,
18191819
desc='input file name (text matrix or 3D/4D image file)')
18201820
out_file = File(name_template="%s_glm", argstr='-o %s', position=3,
1821-
desc=('filename for GLM parameter estimates'
1822-
+ ' (GLM betas)'),
1821+
desc=('filename for GLM parameter estimates' +
1822+
' (GLM betas)'),
18231823
name_source="in_file", keep_extension=True)
18241824
design = File(exists=True, argstr='-d %s', mandatory=True, position=2,
1825-
desc=('file name of the GLM design matrix (text time'
1826-
+ ' courses for temporal regression or an image'
1827-
+ ' file for spatial regression)'))
1828-
contrasts = File(exists=True, argstr='-c %s', desc=('matrix of t-statics'
1829-
+ ' contrasts'))
1830-
mask = File(exists=True, argstr='-m %s', desc=('mask image file name if'
1831-
+ ' input is image'))
1832-
dof = traits.Int(argstr='--dof=%d', desc=('set degrees of freedom'
1833-
+ ' explicitly'))
1834-
des_norm = traits.Bool(argstr='--des_norm', desc=('switch on normalization'
1835-
+ ' of the design matrix'
1836-
+ ' columns to unit std'
1837-
+ ' deviation'))
1825+
desc=('file name of the GLM design matrix (text time' +
1826+
' courses for temporal regression or an image' +
1827+
' file for spatial regression)'))
1828+
contrasts = File(exists=True, argstr='-c %s', desc=('matrix of t-statics' +
1829+
' contrasts'))
1830+
mask = File(exists=True, argstr='-m %s', desc=('mask image file name if' +
1831+
' input is image'))
1832+
dof = traits.Int(argstr='--dof=%d', desc=('set degrees of freedom' +
1833+
' explicitly'))
1834+
des_norm = traits.Bool(argstr='--des_norm',
1835+
desc=('switch on normalization of the design' +
1836+
' matrix columns to unit std deviation'))
18381837
dat_norm = traits.Bool(argstr='--dat_norm', desc=('switch on normalization'
1839-
+ ' of the data time'
1840-
+ ' series to unit std'
1841-
+ ' deviation'))
1842-
var_norm = traits.Bool(argstr='--vn', desc=('perform MELODIC variance-'
1843-
+ 'normalisation on data'))
1844-
demean = traits.Bool(argstr='--demean', desc=('switch on demeaining of '
1845-
+ ' design and data'))
1838+
' of the data time' +
1839+
' series to unit std' +
1840+
' deviation'))
1841+
var_norm = traits.Bool(argstr='--vn', desc=('perform MELODIC variance-' +
1842+
'normalisation on data'))
1843+
demean = traits.Bool(argstr='--demean', desc=('switch on demeaining of ' +
1844+
' design and data'))
18461845
out_cope = File(argstr='--out_cope=%s',
18471846
desc='output file name for COPE (either as txt or image')
18481847
out_z_name = File(argstr='--out_z=%s',
@@ -1851,8 +1850,8 @@ class GLMInputSpec(FSLCommandInputSpec):
18511850
desc='output file name for t-stats (either as txt or image')
18521851

18531852
out_p_name = File(argstr='--out_p=%s',
1854-
desc=('output file name for p-values of Z-stats (either as'
1855-
+ ' text file or image)'))
1853+
desc=('output file name for p-values of Z-stats (either as' +
1854+
' text file or image)'))
18561855
out_f_name = File(argstr='--out_f=%s',
18571856
desc='output file name for F-value of full model fit')
18581857
out_pf_name = File(argstr='--out_pf=%s',
@@ -1863,13 +1862,13 @@ class GLMInputSpec(FSLCommandInputSpec):
18631862
desc='output file name for variance of COPEs')
18641863

18651864
out_sigsq_name = File(argstr='--out_sigsq=%s',
1866-
desc=('output file name for residual noise variance'
1867-
+ ' sigma-square'))
1865+
desc=('output file name for residual noise variance' +
1866+
' sigma-square'))
18681867
out_data_name = File(argstr='--out_data=%s',
18691868
desc='output file name for pre-processed data')
18701869
out_vnscales_name = File(argstr='--out_vnscales=%s',
1871-
desc=('output file name for scaling factors for variance'
1872-
+ ' normalisation'))
1870+
desc=('output file name for scaling factors for variance' +
1871+
' normalisation'))
18731872

18741873

18751874
class GLMOutputSpec(TraitedSpec):

nipype/interfaces/fsl/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,8 @@ def _list_outputs(self):
739739
out_file = self.inputs.out_file
740740
if not isdefined(out_file):
741741
if isdefined(self.inputs.stat_image2) and (
742-
not isdefined(self.inputs.show_negative_stats)
743-
or not self.inputs.show_negative_stats):
742+
not isdefined(self.inputs.show_negative_stats) or not
743+
self.inputs.show_negative_stats):
744744
stem = "%s_and_%s" % (split_filename(self.inputs.stat_image)[1],
745745
split_filename(self.inputs.stat_image2)[1])
746746
else:

0 commit comments

Comments
 (0)