Skip to content

Commit 6c06030

Browse files
authored
Merge pull request #3321 from nipy/ci/contrib
CI: Add specs and style checks
2 parents 467183e + 29e2760 commit 6c06030

File tree

143 files changed

+2170
-2344
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

143 files changed

+2170
-2344
lines changed

.git-blame-ignore-revs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Commits with messages like "STY: black" or "run black"
2+
f64bf338f630a9ee5cbe7a3ec98c68292897e720
3+
83358d7f17aac07cb90d0330f11ea2322e2974d8
4+
faef7d0f93013a700c882f709e98fb3cd36ebb03
5+
d50c1858564c0b3073fb23c54886a0454cb66afa
6+
417b8897a116fcded5000e21e2b6ccbe29452a52
7+
aaf677a87f64c485f3e305799e4a5dc73b69e5fb
8+
f763008442d88d8ce00ec266698268389415f8d6
9+
b1eccafd4edc8503b02d715f5b5f6f783520fdf9
10+
70db90349598cc7f26a4a513779529fba7d0a797
11+
6c1d91d71f6f0db0e985bd2adc34206442b0653d
12+
97bdbd5f48ab242de5288ba4715192a27619a803
13+
78fa360f5b785224349b8b85b07e510d2233bb63
14+
7f85f43a34de8bff8e634232c939b17cee8e8fc5
15+
9c50b5daa797def5672dd057155b0e2c658853e2
16+
47194993ae14aceeec436cfb3769def667196668
17+
75653feadc6667d5313d83e9c62a5d5819771a9c
18+
497b44d680eee0892fa59c6aaaae22a17d70a536

.github/workflows/contrib.yml

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Contribution checks
2+
3+
# This checks validate contributions meet baseline checks
4+
#
5+
# * specs - Ensure make
6+
7+
on:
8+
push:
9+
branches:
10+
- master
11+
- maint/*
12+
pull_request:
13+
branches:
14+
- master
15+
- maint/*
16+
17+
defaults:
18+
run:
19+
shell: bash
20+
21+
jobs:
22+
stable:
23+
# Check each OS, all supported Python, minimum versions and latest releases
24+
runs-on: ${{ matrix.os }}
25+
strategy:
26+
matrix:
27+
os: ['ubuntu-18.04']
28+
python-version: [3.8]
29+
nipype-extras: ['dev']
30+
check: ['specs', 'style']
31+
env:
32+
DEPENDS: ""
33+
CHECK_TYPE: ${{ matrix.check }}
34+
NIPYPE_EXTRAS: ${{ matrix.nipype-extras }}
35+
EXTRA_PIP_FLAGS: ""
36+
INSTALL_DEB_DEPENDENCIES: false
37+
INSTALL_TYPE: pip
38+
CI_SKIP_TEST: 1
39+
40+
steps:
41+
- uses: actions/checkout@v2
42+
with:
43+
submodules: recursive
44+
fetch-depth: 0
45+
- name: Set up Python ${{ matrix.python-version }}
46+
uses: actions/setup-python@v2
47+
with:
48+
python-version: ${{ matrix.python-version }}
49+
- name: Display Python version
50+
run: python -c "import sys; print(sys.version)"
51+
- name: Create virtual environment
52+
run: tools/ci/create_venv.sh
53+
- name: Build archive
54+
run: |
55+
source tools/ci/build_archive.sh
56+
echo "ARCHIVE=$ARCHIVE" >> $GITHUB_ENV
57+
- name: Install Debian dependencies
58+
run: tools/ci/install_deb_dependencies.sh
59+
if: ${{ matrix.os == 'ubuntu-18.04' }}
60+
- name: Install dependencies
61+
run: tools/ci/install_dependencies.sh
62+
- name: Install Nipype
63+
run: tools/ci/install.sh
64+
- name: Run tests
65+
run: tools/ci/check.sh
66+
if: ${{ matrix.check != 'skiptests' }}
67+
- uses: codecov/codecov-action@v1
68+
with:
69+
file: coverage.xml
70+
if: ${{ always() }}
71+
- name: Upload pytest test results
72+
uses: actions/upload-artifact@v2
73+
with:
74+
name: pytest-results-${{ matrix.os }}-${{ matrix.python-version }}
75+
path: test-results.xml
76+
if: ${{ always() && matrix.check == 'test' }}

.pre-commit-config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v2.0.0
5+
rev: v3.4.0
66
hooks:
77
- id: trailing-whitespace
88
- id: end-of-file-fixer
99
- id: check-yaml
1010
- id: check-added-large-files
1111
- repo: https://github.com/psf/black
12-
rev: 19.3b0
12+
rev: 20.8b1
1313
hooks:
1414
- id: black

nipype/algorithms/metrics.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ class DistanceOutputSpec(TraitedSpec):
6363

6464

6565
class Distance(BaseInterface):
66-
"""Calculates distance between two volumes.
67-
"""
66+
"""Calculates distance between two volumes."""
6867

6968
input_spec = DistanceInputSpec
7069
output_spec = DistanceOutputSpec
@@ -542,7 +541,7 @@ class ErrorMapOutputSpec(TraitedSpec):
542541

543542

544543
class ErrorMap(BaseInterface):
545-
""" Calculates the error (distance) map between two input volumes.
544+
"""Calculates the error (distance) map between two input volumes.
546545
547546
Example
548547
-------

nipype/algorithms/misc.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ class SimpleThresholdOutputSpec(TraitedSpec):
141141

142142

143143
class SimpleThreshold(BaseInterface):
144-
"""Applies a threshold to input volumes
145-
"""
144+
"""Applies a threshold to input volumes"""
146145

147146
input_spec = SimpleThresholdInputSpec
148147
output_spec = SimpleThresholdOutputSpec
@@ -240,8 +239,7 @@ class CreateNiftiOutputSpec(TraitedSpec):
240239

241240

242241
class CreateNifti(BaseInterface):
243-
"""Creates a nifti volume
244-
"""
242+
"""Creates a nifti volume"""
245243

246244
input_spec = CreateNiftiInputSpec
247245
output_spec = CreateNiftiOutputSpec

nipype/algorithms/modelgen.py

+13-17
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ def spm_hrf(RT, P=None, fMRI_T=16):
4040
% p - parameters of the response function (two gamma
4141
% functions)
4242
% defaults (seconds)
43-
% p(0) - delay of response (relative to onset) 6
44-
% p(1) - delay of undershoot (relative to onset) 16
45-
% p(2) - dispersion of response 1
46-
% p(3) - dispersion of undershoot 1
47-
% p(4) - ratio of response to undershoot 6
48-
% p(5) - onset (seconds) 0
49-
% p(6) - length of kernel (seconds) 32
43+
% p(0) - delay of response (relative to onset) 6
44+
% p(1) - delay of undershoot (relative to onset) 16
45+
% p(2) - dispersion of response 1
46+
% p(3) - dispersion of undershoot 1
47+
% p(4) - ratio of response to undershoot 6
48+
% p(5) - onset (seconds) 0
49+
% p(6) - length of kernel (seconds) 32
5050
%
5151
% hrf - hemodynamic response function
5252
% p - parameters of the response function
@@ -135,7 +135,7 @@ def scale_timings(timelist, input_units, output_units, time_repetition):
135135

136136

137137
def bids_gen_info(
138-
bids_event_files, condition_column="", amplitude_column=None, time_repetition=False,
138+
bids_event_files, condition_column="", amplitude_column=None, time_repetition=False
139139
):
140140
"""
141141
Generate a subject_info structure from a list of BIDS .tsv event files.
@@ -471,8 +471,7 @@ def _generate_standard_design(
471471
return sessinfo
472472

473473
def _generate_design(self, infolist=None):
474-
"""Generate design specification for a typical fmri paradigm
475-
"""
474+
"""Generate design specification for a typical fmri paradigm"""
476475
realignment_parameters = []
477476
if isdefined(self.inputs.realignment_parameters):
478477
for parfile in self.inputs.realignment_parameters:
@@ -517,8 +516,7 @@ def _generate_design(self, infolist=None):
517516
)
518517

519518
def _run_interface(self, runtime):
520-
"""
521-
"""
519+
""""""
522520
self._sessioninfo = None
523521
self._generate_design()
524522
return runtime
@@ -739,7 +737,7 @@ class SpecifySparseModelOutputSpec(SpecifyModelOutputSpec):
739737

740738

741739
class SpecifySparseModel(SpecifyModel):
742-
""" Specify a sparse model that is compatible with SPM/FSL designers [1]_.
740+
"""Specify a sparse model that is compatible with SPM/FSL designers [1]_.
743741
744742
Examples
745743
--------
@@ -770,8 +768,7 @@ class SpecifySparseModel(SpecifyModel):
770768
output_spec = SpecifySparseModelOutputSpec
771769

772770
def _gen_regress(self, i_onsets, i_durations, i_amplitudes, nscans):
773-
"""Generates a regressor for a sparse/clustered-sparse acquisition
774-
"""
771+
"""Generates a regressor for a sparse/clustered-sparse acquisition"""
775772
bplot = False
776773
if isdefined(self.inputs.save_plot) and self.inputs.save_plot:
777774
bplot = True
@@ -901,8 +898,7 @@ def _gen_regress(self, i_onsets, i_durations, i_amplitudes, nscans):
901898
return reg
902899

903900
def _cond_to_regress(self, info, nscans):
904-
"""Converts condition information to full regressors
905-
"""
901+
"""Converts condition information to full regressors"""
906902
reg = []
907903
regnames = []
908904
for i, cond in enumerate(info.conditions):

nipype/algorithms/rapidart.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -686,8 +686,7 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
686686
save_json(statsfile, stats)
687687

688688
def _run_interface(self, runtime):
689-
"""Execute this module.
690-
"""
689+
"""Execute this module."""
691690
funcfilelist = ensure_list(self.inputs.realigned_files)
692691
motparamlist = ensure_list(self.inputs.realignment_parameters)
693692
for i, imgf in enumerate(funcfilelist):
@@ -814,8 +813,7 @@ def _get_spm_submatrix(self, spmmat, sessidx, rows=None):
814813
return outmatrix
815814

816815
def _run_interface(self, runtime):
817-
"""Execute this module.
818-
"""
816+
"""Execute this module."""
819817
import scipy.io as sio
820818

821819
motparamlist = self.inputs.realignment_parameters

nipype/algorithms/tests/test_TSNR.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ def test_tsnr_withpoly3(self):
9393

9494
@mock.patch("warnings.warn")
9595
def test_warning(self, mock_warn):
96-
""" test that usage of misc.TSNR trips a warning to use
97-
confounds.TSNR instead """
96+
"""test that usage of misc.TSNR trips a warning to use
97+
confounds.TSNR instead"""
9898
# run
9999
misc.TSNR(in_file=self.in_filenames["in_file"])
100100

nipype/algorithms/tests/test_modelgen.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def test_modelgen1(tmpdir):
105105
np.array([6.0, 6.0]),
106106
)
107107
npt.assert_almost_equal(
108-
np.array(res.outputs.session_info[0]["cond"][1]["duration"]), np.array([6.0,])
108+
np.array(res.outputs.session_info[0]["cond"][1]["duration"]), np.array([6.0])
109109
)
110110
npt.assert_almost_equal(
111111
np.array(res.outputs.session_info[1]["cond"][1]["duration"]),
@@ -191,14 +191,14 @@ def test_modelgen_spm_concat(tmpdir):
191191
np.array([1.0, 1.0]),
192192
)
193193
npt.assert_almost_equal(
194-
np.array(res.outputs.session_info[0]["cond"][1]["duration"]), np.array([1.0,])
194+
np.array(res.outputs.session_info[0]["cond"][1]["duration"]), np.array([1.0])
195195
)
196196
npt.assert_almost_equal(
197197
np.array(res.outputs.session_info[1]["cond"][1]["duration"]),
198198
np.array([1.0, 1.0]),
199199
)
200200
npt.assert_almost_equal(
201-
np.array(res.outputs.session_info[2]["cond"][1]["duration"]), np.array([1.0,])
201+
np.array(res.outputs.session_info[2]["cond"][1]["duration"]), np.array([1.0])
202202
)
203203

204204
# Test case for variable number of events in concatenated runs, sometimes unique.

0 commit comments

Comments
 (0)