Skip to content

Commit 67bf1c9

Browse files
committed
Merge remote-tracking branch 'upstream/master' into enh/restingconn
* upstream/master: tiny typo another attempt at fixing bash conditionals fixed bash conditionals added no dep install version. we'll be testing on both. Added xor option in Camino connectivity for robustness Conmat test function Added more connectivity matrix options in Camino interface Fixed tests. remove deb packages installation added apt caching switched to six.string_types for string type checks added external package: 'six' Removed unnecessary positional parameters as well as args argument Added whitespaces Dcm2nii and related tests Added input options to dcm2nii replaced str with basestring in instance checks to support unicode strings
2 parents 7603c3b + 9fef6d4 commit 67bf1c9

File tree

32 files changed

+915
-97
lines changed

32 files changed

+915
-97
lines changed

.travis.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
1+
cache:
2+
- apt
13
language: python
24
python:
35
- 2.6
46
- 2.7
7+
env:
8+
- INSTALL_DEB_DEPENDECIES=true
9+
- INSTALL_DEB_DEPENDECIES=false
510
# Setup anaconda
611
before_install:
712
- if [ ${TRAVIS_PYTHON_VERSION:0:1} == "2" ]; then wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh; else wget http://repo.continuum.io/miniconda/Miniconda3-3.6.0-Linux-x86_64.sh -O miniconda.sh; fi
813
- chmod +x miniconda.sh
914
- ./miniconda.sh -b
1015
- export PATH=/home/travis/miniconda/bin:$PATH
11-
# The next couple lines fix a crash with multiprocessing on Travis
12-
- sudo rm -rf /dev/shm
13-
- sudo ln -s /run/shm /dev/shm
14-
- bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh)
15-
- travis_retry sudo apt-get install -qq --no-install-recommends fsl afni elastix
16-
- travis_retry sudo apt-get install -qq fsl-atlases
17-
- source /etc/fsl/fsl.sh
16+
- if $INSTALL_DEB_DEPENDECIES; then sudo rm -rf /dev/shm; fi
17+
- if $INSTALL_DEB_DEPENDECIES; then sudo ln -s /run/shm /dev/shm; fi
18+
- if $INSTALL_DEB_DEPENDECIES; then bash <(wget -q -O- http://neuro.debian.net/_files/neurodebian-travis.sh); fi
19+
- if $INSTALL_DEB_DEPENDECIES; then travis_retry sudo apt-get install -qq --no-install-recommends fsl afni elastix; fi
20+
- if $INSTALL_DEB_DEPENDECIES; then travis_retry sudo apt-get install -qq fsl-atlases; fi
21+
- if $INSTALL_DEB_DEPENDECIES; then source /etc/fsl/fsl.sh; fi
1822

1923
# Install packages
2024
install:

doc/sphinxext/numpy_ext/docscrape_sphinx.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import re, inspect, textwrap, pydoc
22
import sphinx
33
from docscrape import NumpyDocString, FunctionDoc, ClassDoc
4+
from nipype.external import six
45

56
class SphinxDocString(NumpyDocString):
67
def __init__(self, docstring, config={}):
@@ -140,7 +141,7 @@ def _str_references(self):
140141
out = []
141142
if self['References']:
142143
out += self._str_header('References')
143-
if isinstance(self['References'], str):
144+
if isinstance(self['References'], six.string_types):
144145
self['References'] = [self['References']]
145146
out.extend(self['References'])
146147
out += ['']

examples/fmri_ants_openfmri.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414

1515
from nipype import config
1616
config.enable_provenance()
17+
from nipype.external import six
18+
1719

1820
from glob import glob
1921
import os
@@ -443,7 +445,7 @@ def get_contrasts(contrast_file, task_id, conds):
443445

444446
def check_behav_list(behav):
445447
out_behav = []
446-
if isinstance(behav, basestring):
448+
if isinstance(behav, six.string_types):
447449
behav = [behav]
448450
for val in behav:
449451
if not isinstance(val, list):

examples/fmri_openfmri.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
from nipype import config
1616
config.enable_provenance()
17+
from nipype.external import six
1718

1819
from glob import glob
1920
import os
@@ -237,7 +238,7 @@ def get_contrasts(contrast_file, task_id, conds):
237238

238239
def check_behav_list(behav):
239240
out_behav = []
240-
if isinstance(behav, basestring):
241+
if isinstance(behav, six.string_types):
241242
behav = [behav]
242243
for val in behav:
243244
if not isinstance(val, list):

nipype/algorithms/modelgen.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
isdefined)
3131
from nipype.utils.filemanip import filename_to_list
3232
from .. import config, logging
33+
from nipype.external import six
3334
iflogger = logging.getLogger('interface')
3435

3536
def gcd(a, b):
@@ -422,7 +423,7 @@ def _concatenate_info(self, infolist):
422423
for i, f in enumerate(self.inputs.functional_runs):
423424
if isinstance(f, list):
424425
numscans = len(f)
425-
elif isinstance(f, str):
426+
elif isinstance(f, six.string_types):
426427
img = load(f)
427428
numscans = img.get_shape()[3]
428429
else:

nipype/algorithms/rapidart.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import numpy as np
2727
from scipy import signal
2828
import scipy.io as sio
29+
from nipype.external import six
2930

3031
from ..interfaces.base import (BaseInterface, traits, InputMultiPath,
3132
OutputMultiPath, TraitedSpec, File,
@@ -279,7 +280,7 @@ def _get_output_filenames(self, motionfile, output_dir):
279280
output_dir: string
280281
output directory in which the files will be generated
281282
"""
282-
if isinstance(motionfile, str):
283+
if isinstance(motionfile, six.string_types):
283284
infile = motionfile
284285
elif isinstance(motionfile, list):
285286
infile = motionfile[0]
@@ -350,7 +351,7 @@ def _detect_outliers_core(self, imgfile, motionfile, runidx, cwd=None):
350351
cwd = os.getcwd()
351352

352353
# read in functional image
353-
if isinstance(imgfile, str):
354+
if isinstance(imgfile, six.string_types):
354355
nim = load(imgfile)
355356
elif isinstance(imgfile, list):
356357
if len(imgfile) == 1:

nipype/external/provcopy.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import dateutil.parser
1818
import collections
1919
from collections import defaultdict
20+
import six
2021

2122
try:
2223
from rdflib.term import URIRef, BNode
@@ -187,7 +188,7 @@ def _parse_xsd_dateTime(s):
187188

188189

189190
def _ensure_datetime(time):
190-
if isinstance(time, basestring):
191+
if isinstance(time, six.string_types):
191192
return _parse_xsd_dateTime(time)
192193
else:
193194
return time
@@ -232,12 +233,12 @@ def parse_xsd_types(value, datatype):
232233

233234

234235
def _ensure_multiline_string_triple_quoted(s):
235-
format_str = u'"""%s"""' if isinstance(s, basestring) and '\n' in s else u'"%s"'
236+
format_str = u'"""%s"""' if isinstance(s, six.string_types) and '\n' in s else u'"%s"'
236237
return format_str % s
237238

238239

239240
def encoding_PROV_N_value(value):
240-
if isinstance(value, basestring):
241+
if isinstance(value, six.string_types):
241242
return _ensure_multiline_string_triple_quoted(value)
242243
elif isinstance(value, datetime.datetime):
243244
return value.isoformat()
@@ -536,7 +537,7 @@ def _auto_literal_conversion(self, literal):
536537
if isinstance(literal, URIRef):
537538
return literal
538539

539-
if isinstance(literal, basestring):
540+
if isinstance(literal, six.string_types):
540541
return unicode(literal)
541542

542543
if isinstance(literal, Literal) and literal.has_no_langtag():
@@ -1568,7 +1569,7 @@ def _decode_JSON_container(self, jc):
15681569
key=lambda tuple_rec: tuple_rec[0])
15691570

15701571
record_map = {}
1571-
_parse_attr_value = lambda value: record_map[value] if (isinstance(value, basestring) and value in record_map) else self._decode_json_representation(value)
1572+
_parse_attr_value = lambda value: record_map[value] if (isinstance(value, six.string_types) and value in record_map) else self._decode_json_representation(value)
15721573
# Create all the records before setting their attributes
15731574
for (record_type, identifier, content) in records:
15741575
if record_type == PROV_REC_BUNDLE:

0 commit comments

Comments
 (0)