From 0c4256dcc53b5ca9fafbc30b4af073acdd303123 Mon Sep 17 00:00:00 2001 From: "Christopher J. Markiewicz" Date: Tue, 27 Nov 2018 10:56:50 -0500 Subject: [PATCH] STY: Flake8 3.6+ cleanup --- nibabel/affines.py | 2 +- nibabel/casting.py | 4 ++-- nibabel/nicom/dwiparams.py | 2 +- nibabel/nifti1.py | 3 +-- nibabel/py3k.py | 2 +- nibabel/quaternions.py | 2 +- nibabel/spatialimages.py | 6 ++---- nibabel/xmlutils.py | 2 +- tox.ini | 2 +- 9 files changed, 11 insertions(+), 14 deletions(-) diff --git a/nibabel/affines.py b/nibabel/affines.py index 2672c90814..d21db6958e 100644 --- a/nibabel/affines.py +++ b/nibabel/affines.py @@ -6,7 +6,7 @@ import numpy as np from six.moves import reduce -from .testing import setup_test # flake8: noqa F401 +from .testing import setup_test # noqa class AffineError(ValueError): diff --git a/nibabel/casting.py b/nibabel/casting.py index ebdd96d550..fd4170e1ff 100644 --- a/nibabel/casting.py +++ b/nibabel/casting.py @@ -8,7 +8,7 @@ from platform import processor, machine import numpy as np -from .testing import setup_test # flake8: noqa F401 +from .testing import setup_test # noqa class CastingError(Exception): @@ -268,7 +268,7 @@ def type_info(np_type): # 80) but in calculations nexp in fact appears to be 11 as for float64 ret.update(dict(width=width)) return ret - if vals == (105, 11, 16): # correctly detected double double + if vals == (105, 11, 16): # correctly detected double double ret.update(dict(nmant=nmant, nexp=nexp, width=width)) return ret # Oh dear, we don't recognize the type information. Try some known types diff --git a/nibabel/nicom/dwiparams.py b/nibabel/nicom/dwiparams.py index 10fdce0d5b..32ba3dbaa1 100644 --- a/nibabel/nicom/dwiparams.py +++ b/nibabel/nicom/dwiparams.py @@ -21,7 +21,7 @@ ''' import numpy as np import numpy.linalg as npl -from ..testing import setup_test as setup_module # flake8: noqa F401 +from ..testing import setup_test as setup_module # noqa def B2q(B, tol=None): diff --git a/nibabel/nifti1.py b/nibabel/nifti1.py index a10177e2f7..60ff818e57 100644 --- a/nibabel/nifti1.py +++ b/nibabel/nifti1.py @@ -27,7 +27,7 @@ from .spm99analyze import SpmAnalyzeHeader from .casting import have_binary128 from .pydicom_compat import have_dicom, pydicom as pdcm -from .testing import setup_test # flake8: noqa F401 +from .testing import setup_test # noqa # nifti1 flat header definition for Analyze-like first 348 bytes # first number in comments indicates offset in file header in bytes @@ -1788,7 +1788,6 @@ def __init__(self, dataobj, affine, header=None, has been created - see those methods, and the :ref:`manual ` for more details. ''' - def update_header(self): ''' Harmonize header with image data and affine diff --git a/nibabel/py3k.py b/nibabel/py3k.py index c132d7809d..bd55158d30 100644 --- a/nibabel/py3k.py +++ b/nibabel/py3k.py @@ -67,7 +67,7 @@ def open_latin1(filename, mode='r'): class FileNotFoundError(IOError): pass - import __builtin__ as builtins # flake8: noqa F401 + import __builtin__ as builtins # noqa def getexception(): diff --git a/nibabel/quaternions.py b/nibabel/quaternions.py index a2a60e324d..76e93e4490 100644 --- a/nibabel/quaternions.py +++ b/nibabel/quaternions.py @@ -27,7 +27,7 @@ import math import numpy as np -from .testing import setup_test # flake8: noqa F401 +from .testing import setup_test # noqa MAX_FLOAT = np.maximum_sctype(np.float) FLOAT_EPS = np.finfo(np.float).eps diff --git a/nibabel/spatialimages.py b/nibabel/spatialimages.py index 9c3fef4fbb..ede0820065 100644 --- a/nibabel/spatialimages.py +++ b/nibabel/spatialimages.py @@ -137,7 +137,7 @@ from .filebasedimages import FileBasedHeader from .dataobj_images import DataobjImage -from .filebasedimages import ImageFileError # flake8: noqa; for back-compat +from .filebasedimages import ImageFileError # noqa from .viewers import OrthoSlicer3D from .volumeutils import shape_zoom_affine from .fileslice import canonical_slicers @@ -165,7 +165,7 @@ def __init__(self, self.set_data_dtype(data_dtype) self._zooms = () self.set_data_shape(shape) - if not zooms is None: + if zooms is not None: self.set_zooms(zooms) @classmethod @@ -576,7 +576,6 @@ def slicer(self): """ return self.ImageSlicer(self) - def __getitem__(self, idx): ''' No slicing or dictionary interface for images @@ -606,7 +605,6 @@ def orthoview(self): return OrthoSlicer3D(self.dataobj, self.affine, title=self.get_filename()) - def as_reoriented(self, ornt): """Apply an orientation change and return a new image diff --git a/nibabel/xmlutils.py b/nibabel/xmlutils.py index 08794a7550..37c91d57d5 100644 --- a/nibabel/xmlutils.py +++ b/nibabel/xmlutils.py @@ -11,7 +11,7 @@ """ from io import BytesIO -from xml.etree.ElementTree import Element, SubElement, tostring # flake8: noqa aliasing +from xml.etree.ElementTree import Element, SubElement, tostring # noqa from xml.parsers.expat import ParserCreate from .filebasedimages import FileBasedHeader diff --git a/tox.ini b/tox.ini index 8a00d1f7e7..5585639795 100644 --- a/tox.ini +++ b/tox.ini @@ -20,6 +20,6 @@ deps = deps = [flake8] max-line-length=100 -ignore=D100,D101,D102,D103,D104,D105,D200,D201,D202,D204,D205,D208,D209,D210,D300,D301,D400,D401,D403,E266,E402,E731,F821,I100,I101,I201,N802,N803,N804,N806 +ignore=D100,D101,D102,D103,D104,D105,D200,D201,D202,D204,D205,D208,D209,D210,D300,D301,D400,D401,D403,E24,E121,E123,E126,E226,E266,E402,E704,E731,F821,I100,I101,I201,N802,N803,N804,N806,W503,W504,W605 exclude=*test*,*sphinx*,nibabel/externals/*,*/__init__.py