diff --git a/nibabel/cifti2/cifti2.py b/nibabel/cifti2/cifti2.py index 0b2b7f2a9a..948fe0d0d0 100644 --- a/nibabel/cifti2/cifti2.py +++ b/nibabel/cifti2/cifti2.py @@ -1156,8 +1156,7 @@ def get_index_map(self, index): a2md = self._get_indices_from_mim(v) if index in a2md: return v - else: - raise Cifti2HeaderError("Index not mapped") + raise Cifti2HeaderError("Index not mapped") def _validate_new_mim(self, value): if value.applies_to_matrix_dimension is None: diff --git a/nibabel/cmdline/dicomfs.py b/nibabel/cmdline/dicomfs.py index 6e53be103b..be3acad269 100644 --- a/nibabel/cmdline/dicomfs.py +++ b/nibabel/cmdline/dicomfs.py @@ -71,7 +71,7 @@ def get_paths(self): for study in dft.get_studies(self.dicom_path, self.followlinks): pd = paths.setdefault(study.patient_name_or_uid(), {}) patient_info = 'patient information\n' - patient_info = f'name: {study.patient_name}\n' + patient_info += f'name: {study.patient_name}\n' patient_info += f'ID: {study.patient_id}\n' patient_info += f'birth date: {study.patient_birth_date}\n' patient_info += f'sex: {study.patient_sex}\n' diff --git a/nibabel/filebasedimages.py b/nibabel/filebasedimages.py index 4fab9451c3..3fd5b5fc8f 100644 --- a/nibabel/filebasedimages.py +++ b/nibabel/filebasedimages.py @@ -202,7 +202,7 @@ def __init__(self, header=None, extra=None, file_map=None): def header(self): return self._header - def __getitem__(self): + def __getitem__(self, key): """ No slicing or dictionary interface for images """ raise TypeError("Cannot slice image objects.") diff --git a/nibabel/pydicom_compat.py b/nibabel/pydicom_compat.py index 9cca2a293d..b1ee685328 100644 --- a/nibabel/pydicom_compat.py +++ b/nibabel/pydicom_compat.py @@ -23,7 +23,6 @@ # Module has (apparently) unused imports; stop flake8 complaining # flake8: noqa -import numpy as np from .deprecated import deprecate_with_version have_dicom = True diff --git a/nisext/py3builder.py b/nisext/py3builder.py index 4f82a8cfb2..7bcaf2348c 100644 --- a/nisext/py3builder.py +++ b/nisext/py3builder.py @@ -1,9 +1,6 @@ """ distutils utilities for porting to python 3 within 2-compatible tree """ -import sys -import re - try: from distutils.command.build_py import build_py_2to3 except ImportError: diff --git a/setup.py b/setup.py index 9c281a032c..29fb3642da 100755 --- a/setup.py +++ b/setup.py @@ -10,7 +10,6 @@ """Build helper.""" import sys -import os from setuptools import setup import versioneer diff --git a/tools/make_tarball.py b/tools/make_tarball.py index 149837aaf5..afbde3d48d 100755 --- a/tools/make_tarball.py +++ b/tools/make_tarball.py @@ -4,8 +4,6 @@ import commands import os -import sys -import shutil from toollib import * diff --git a/tools/mpkg_wrapper.py b/tools/mpkg_wrapper.py index c050bd0f8c..d79f84caad 100644 --- a/tools/mpkg_wrapper.py +++ b/tools/mpkg_wrapper.py @@ -16,8 +16,6 @@ __docformat__ = 'restructuredtext' import sys -import setuptools -import bdist_mpkg def main(): del sys.argv[0]