Skip to content

Commit 86f1b7a

Browse files
committed
sty: pacify flake8
1 parent 6dd4cc0 commit 86f1b7a

File tree

6 files changed

+20
-19
lines changed

6 files changed

+20
-19
lines changed

nitransforms/io/afni.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ def from_string(cls, string):
6767
tf = cls()
6868
sa = tf.structarr
6969
lines = [
70-
l
71-
for l in string.splitlines()
72-
if l.strip() and not (l.startswith("#") or "3dvolreg matrices" in l)
70+
line
71+
for line in string.splitlines()
72+
if line.strip() and not (line.startswith("#") or "3dvolreg matrices" in line)
7373
]
7474

7575
if not lines:
@@ -101,9 +101,9 @@ def to_string(self):
101101
strings = []
102102
for i, xfm in enumerate(self.xforms):
103103
lines = [
104-
l.strip()
105-
for l in xfm.to_string(banner=(i == 0)).splitlines()
106-
if l.strip()
104+
line.strip()
105+
for line in xfm.to_string(banner=(i == 0)).splitlines()
106+
if line.strip()
107107
]
108108
strings += lines
109109
return "\n".join(strings)
@@ -124,14 +124,14 @@ def from_string(cls, string):
124124
_self = cls()
125125

126126
lines = [
127-
l.strip()
128-
for l in string.splitlines()
129-
if l.strip() and not l.startswith("#")
127+
line.strip()
128+
for line in string.splitlines()
129+
if line.strip() and not line.startswith("#")
130130
]
131131
if not lines:
132132
raise TransformFileError("Input string is empty.")
133133

134-
_self.xforms = [cls._inner_type.from_string(l) for l in lines]
134+
_self.xforms = [cls._inner_type.from_string(line) for line in lines]
135135
return _self
136136

137137

nitransforms/io/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class LinearParameters(StringBasedStruct):
4545
4646
"""
4747

48-
template_dtype = np.dtype([("parameters", "f8", (4, 4)),])
48+
template_dtype = np.dtype([("parameters", "f8", (4, 4))])
4949
dtype = template_dtype
5050

5151
def __init__(self, parameters=None):

nitransforms/io/fsl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def from_string(cls, string):
4545
"""Read the struct from string."""
4646
tf = cls()
4747
sa = tf.structarr
48-
lines = [l.strip() for l in string.splitlines() if l.strip()]
48+
lines = [line.strip() for line in string.splitlines() if line.strip()]
4949
if not lines or len(lines) < 4:
5050
raise TransformFileError
5151

nitransforms/io/itk.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def from_matlab_dict(cls, mdict, index=0):
133133
"AffineTransform_double_3_3",
134134
mdict.get("AffineTransform_float_3_3")
135135
)
136-
136+
137137
if affine is None:
138138
raise NotImplementedError("Unsupported transform type")
139139

@@ -159,15 +159,15 @@ def from_string(cls, string):
159159
"""Read the struct from string."""
160160
tf = cls()
161161
sa = tf.structarr
162-
lines = [l.strip() for l in string.splitlines() if l.strip()]
162+
lines = [line.strip() for line in string.splitlines() if line.strip()]
163163
if not lines or not lines[0].startswith("#"):
164164
raise TransformFileError
165165

166166
if lines[1][0] == "#":
167167
lines = lines[1:] # Drop banner with version
168168

169169
parameters = np.eye(4, dtype="f4")
170-
sa["index"] = int(lines[0][lines[0].index("T") :].split()[1])
170+
sa["index"] = int(lines[0][lines[0].index("T"):].split()[1])
171171
sa["offset"] = np.genfromtxt(
172172
[lines[3].split(":")[-1].encode()], dtype=cls.dtype["offset"]
173173
)
@@ -258,7 +258,7 @@ def from_ras(cls, ras, moving=None, reference=None):
258258
def from_string(cls, string):
259259
"""Read the struct from string."""
260260
_self = cls()
261-
lines = [l.strip() for l in string.splitlines() if l.strip()]
261+
lines = [line.strip() for line in string.splitlines() if line.strip()]
262262

263263
if (
264264
not lines

nitransforms/io/lta.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,9 +294,9 @@ def from_string(klass, string):
294294
lta = klass()
295295
sa = lta.structarr
296296
lines = [
297-
l.strip()
298-
for l in string.splitlines()
299-
if l.strip() and not l.strip().startswith("#")
297+
line.strip()
298+
for line in string.splitlines()
299+
if line.strip() and not line.strip().startswith("#")
300300
]
301301
if not lines or not lines[0].startswith("type"):
302302
raise TransformFileError("Invalid LTA format")

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ max-line-length = 99
5656
doctests = False
5757
ignore =
5858
E266
59+
E231
5960
W503
6061

6162
[tool:pytest]

0 commit comments

Comments
 (0)