Skip to content

Commit

Permalink
Merge pull request #695 from effigies/fix/flake8
Browse files Browse the repository at this point in the history
STY: Flake8 3.6+ cleanup
  • Loading branch information
effigies committed Nov 29, 2018
2 parents 118d305 + 0c4256d commit ad26878
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 14 deletions.
2 changes: 1 addition & 1 deletion nibabel/affines.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions nibabel/casting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nibabel/nicom/dwiparams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions nibabel/nifti1.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1788,7 +1788,6 @@ def __init__(self, dataobj, affine, header=None,
has been created - see those methods, and the :ref:`manual
<default-sform-qform-codes>` for more details. '''


def update_header(self):
''' Harmonize header with image data and affine
Expand Down
2 changes: 1 addition & 1 deletion nibabel/py3k.py
Original file line number Diff line number Diff line change
Expand Up @@ -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():
Expand Down
2 changes: 1 addition & 1 deletion nibabel/quaternions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 2 additions & 4 deletions nibabel/spatialimages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -576,7 +576,6 @@ def slicer(self):
"""
return self.ImageSlicer(self)


def __getitem__(self, idx):
''' No slicing or dictionary interface for images
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion nibabel/xmlutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit ad26878

Please sign in to comment.