Skip to content

Commit 35a0257

Browse files
DimitriPapadopouloseffigies
authored andcommitted
FIX: LGTM alerts
FIX: LGTM error: Special method has incorrect signature Too few parameters for special method __getitem__, which has 1 parameter, but should have 2, in class FileBasedImage. https://lgtm.com/rules/7850093/ FIX: LGTM warning: Unnecessary 'else' clause in loop This 'for' statement has a redundant 'else' as no 'break' is present in the body. https://lgtm.com/rules/5980098/ FIX: LGTM warning: Variable defined multiple times This assignment to 'patient_info' is unnecessary as it is redefined here before this value is used. https://lgtm.com/rules/1800095/ FIX: LGTM recommendations: Unused import Import of '...' is not used. https://lgtm.com/rules/6770079/ Backport of gh-1043
1 parent 1fc2aff commit 35a0257

File tree

8 files changed

+3
-13
lines changed

8 files changed

+3
-13
lines changed

nibabel/cifti2/cifti2.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,8 +1156,7 @@ def get_index_map(self, index):
11561156
a2md = self._get_indices_from_mim(v)
11571157
if index in a2md:
11581158
return v
1159-
else:
1160-
raise Cifti2HeaderError("Index not mapped")
1159+
raise Cifti2HeaderError("Index not mapped")
11611160

11621161
def _validate_new_mim(self, value):
11631162
if value.applies_to_matrix_dimension is None:

nibabel/cmdline/dicomfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def get_paths(self):
7171
for study in dft.get_studies(self.dicom_path, self.followlinks):
7272
pd = paths.setdefault(study.patient_name_or_uid(), {})
7373
patient_info = 'patient information\n'
74-
patient_info = f'name: {study.patient_name}\n'
74+
patient_info += f'name: {study.patient_name}\n'
7575
patient_info += f'ID: {study.patient_id}\n'
7676
patient_info += f'birth date: {study.patient_birth_date}\n'
7777
patient_info += f'sex: {study.patient_sex}\n'

nibabel/filebasedimages.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def __init__(self, header=None, extra=None, file_map=None):
202202
def header(self):
203203
return self._header
204204

205-
def __getitem__(self):
205+
def __getitem__(self, key):
206206
""" No slicing or dictionary interface for images
207207
"""
208208
raise TypeError("Cannot slice image objects.")

nibabel/pydicom_compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
# Module has (apparently) unused imports; stop flake8 complaining
2424
# flake8: noqa
2525

26-
import numpy as np
2726
from .deprecated import deprecate_with_version
2827

2928
have_dicom = True

nisext/py3builder.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
""" distutils utilities for porting to python 3 within 2-compatible tree """
22

33

4-
import sys
5-
import re
6-
74
try:
85
from distutils.command.build_py import build_py_2to3
96
except ImportError:

setup.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
"""Build helper."""
1111

1212
import sys
13-
import os
1413

1514
from setuptools import setup
1615
import versioneer

tools/make_tarball.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
import commands
66
import os
7-
import sys
8-
import shutil
97

108
from toollib import *
119

tools/mpkg_wrapper.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
__docformat__ = 'restructuredtext'
1717

1818
import sys
19-
import setuptools
20-
import bdist_mpkg
2119

2220
def main():
2321
del sys.argv[0]

0 commit comments

Comments
 (0)