Skip to content

Commit 750f80f

Browse files
committed
TEST: Compatibility for numpy 1.7. Also some style fixes to make flake8 happier
1 parent 63ff5ef commit 750f80f

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

nibabel/openers.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,16 +70,16 @@ def _gzip_open(fileish, mode='rb', compresslevel=9):
7070
have_indexed_gzip = False
7171

7272
# is this a file? if not we assume it is a string
73-
is_file = hasattr(fileish, 'read') and hasattr(fileish, 'write') and \
74-
hasattr(fileish, 'mode')
73+
is_file = (hasattr(fileish, 'read') and hasattr(fileish, 'write') and
74+
hasattr(fileish, 'mode')
7575

7676
# If we've been given a file object, we can't change its mode.
7777
if is_file:
7878
mode = fileish.mode
7979

8080
# use indexed_gzip if possible for faster read access
8181
if mode == 'rb' and have_indexed_gzip:
82-
kwargs = {'spacing' : 4194304, 'readbuf_size' : 1048576}
82+
kwargs = {'spacing':4194304, 'readbuf_size':1048576}
8383
if hasattr(fileish, 'read') and hasattr(fileish, 'write'):
8484
gzip_file = SafeIndexedGzipFile(fid=fileish, **kwargs)
8585
else:

nibabel/tests/test_arrayproxy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ def __init__(self, *args, **kwargs):
353353
proxy_no_kfp = ArrayProxy(fname, ((10, 10, 10), dtype))
354354
proxy_kfp = ArrayProxy(fname, ((10, 10, 10), dtype),
355355
keep_file_open=True)
356-
voxels = np.random.randint(0, 10, (10, 3), dtype=np.uint32)
356+
voxels = np.random.randint(0, 10, (10, 3))
357357
for i in range(voxels.shape[0]):
358358
x , y, z = [int(c) for c in voxels[i, :]]
359359
assert proxy_no_kfp[x, y, z] == x * 100 + y * 10 + z

nibabel/tests/test_fileslice.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ def test_read_segments():
694694
def test_read_segments_lock():
695695
# Test read_segment locking with multiple threads
696696
fobj = BytesIO()
697-
arr = np.random.randint(0, 256, 1000, dtype=np.uint8)
697+
arr = np.array(np.random.randint(0, 256, 1000), dtype=np.uint8)
698698
fobj.write(arr.tostring())
699699

700700
# Encourage the interpreter to switch threads between a seek/read pair

0 commit comments

Comments
 (0)