Skip to content

Commit 4b86e83

Browse files
committed
sty: ruff format
1 parent ed26ad9 commit 4b86e83

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

nibabel/nicom/csareader.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
"""CSA header reader from SPM spec"""
22

3-
import numpy as np
43
import struct
54

5+
import numpy as np
6+
67
from .structreader import Unpacker
78
from .utils import find_private_section
89

@@ -167,7 +168,7 @@ def read(csa_str):
167168

168169

169170
def write(csa_header):
170-
''' Write string from CSA header `csa_header`
171+
"""Write string from CSA header `csa_header`
171172
172173
Parameters
173174
----------
@@ -180,18 +181,14 @@ def write(csa_header):
180181
-------
181182
csa_str : str
182183
byte string containing CSA header information
183-
'''
184+
"""
184185
result = []
185186
if csa_header['type'] == 2:
186187
result.append(b'SV10')
187188
result.append(csa_header['unused0'])
188189
if not 0 < csa_header['n_tags'] <= 128:
189-
raise CSAWriteError('Number of tags `t` should be '
190-
'0 < t <= 128')
191-
result.append(struct.pack('2I',
192-
csa_header['n_tags'],
193-
csa_header['check'])
194-
)
190+
raise CSAWriteError('Number of tags `t` should be 0 < t <= 128')
191+
result.append(struct.pack('2I', csa_header['n_tags'], csa_header['check']))
195192

196193
# Build list of tags in correct order
197194
tags = list(csa_header['tags'].items())
@@ -204,14 +201,17 @@ def write(csa_header):
204201
vr = tag_dict['vr']
205202
n_items = tag_dict['n_items']
206203
assert n_items < 100
207-
result.append(struct.pack('64si4s3i',
208-
make_nt_str(tag_name),
209-
vm,
210-
make_nt_str(vr),
211-
tag_dict['syngodt'],
212-
n_items,
213-
tag_dict['last3'])
214-
)
204+
result.append(
205+
struct.pack(
206+
'64si4s3i',
207+
make_nt_str(tag_name),
208+
vm,
209+
make_nt_str(vr),
210+
tag_dict['syngodt'],
211+
n_items,
212+
tag_dict['last3'],
213+
)
214+
)
215215

216216
# Figure out the number of values for this tag
217217
if vm == 0:
@@ -356,7 +356,7 @@ def nt_str(s):
356356

357357

358358
def make_nt_str(s):
359-
''' Create a null terminated byte string from a unicode object.
359+
"""Create a null terminated byte string from a unicode object.
360360
361361
Parameters
362362
----------
@@ -366,5 +366,5 @@ def make_nt_str(s):
366366
-------
367367
result : bytes
368368
s encoded as latin-1 with a null char appended
369-
'''
369+
"""
370370
return s.encode('latin-1') + b'\x00'

0 commit comments

Comments
 (0)