Skip to content

Commit 3b7f1c5

Browse files
committed
Various linter fixes
1 parent d59fd66 commit 3b7f1c5

7 files changed

Lines changed: 26 additions & 16 deletions

File tree

src/highdicom/frame.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,9 @@ def encode_frame(
257257
if transfer_syntax_uid == JPEG2000Lossless:
258258
if bits_allocated not in (1, 8, 16):
259259
raise ValueError(
260-
'Bits Allocated must be 1, 8, or 16 for encoding of '
261-
f'monochrome image frames with with {name} codec.'
260+
'Bits Allocated must be 1, 8, or 16 for encoding '
261+
f'of monochrome image frames with with {name} '
262+
'codec.'
262263
)
263264
else:
264265
if bits_allocated not in (8, 16):
@@ -287,9 +288,9 @@ def encode_frame(
287288

288289
if photometric_interpretation != required_pi.value:
289290
raise ValueError(
290-
f'Photometric interpretation must be "{required_pi.value}" '
291-
'for encoding of color image frames with '
292-
f'{name} codec.'
291+
f'Photometric interpretation must be '
292+
f'"{required_pi.value}" for encoding of color image '
293+
f'frames with {name} codec.'
293294
)
294295

295296
if transfer_syntax_uid == JPEG2000:

src/highdicom/sr/sop.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,9 @@ def extract_evidence(
389389
UID(instance_ds.ReferencedSOPClassUID),
390390
)
391391

392-
current_evidence_seq = self.get('CurrentRequestedProcedureEvidenceSequence')
392+
current_evidence_seq = self.get(
393+
'CurrentRequestedProcedureEvidenceSequence'
394+
)
393395
if current_evidence_seq is not None:
394396
current_evidence = extract_evidence(current_evidence_seq)
395397
else:
@@ -440,7 +442,9 @@ def extract_evidence_series(
440442
UID(series_ds.SeriesInstanceUID),
441443
)
442444

443-
current_evidence_seq = self.get('CurrentRequestedProcedureEvidenceSequence')
445+
current_evidence_seq = self.get(
446+
'CurrentRequestedProcedureEvidenceSequence'
447+
)
444448
if current_evidence_seq is not None:
445449
current_evidence = extract_evidence_series(current_evidence_seq)
446450
else:
@@ -459,6 +463,7 @@ def extract_evidence_series(
459463

460464
return evidence
461465

466+
462467
class EnhancedSR(_SR):
463468

464469
"""SOP class for an Enhanced Structured Report (SR) document, whose

tests/test_base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def test_big_endian(self):
7474
)
7575

7676
def test_explicit_vr(self):
77-
sop_class = SOPClass(
77+
_ = SOPClass(
7878
study_instance_uid=UID(),
7979
series_instance_uid=UID(),
8080
series_number=1,
@@ -87,7 +87,7 @@ def test_explicit_vr(self):
8787
)
8888

8989
def test_implicit_vr(self):
90-
sop_class = SOPClass(
90+
_ = SOPClass(
9191
study_instance_uid=UID(),
9292
series_instance_uid=UID(),
9393
series_number=1,

tests/test_frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_jpeg2000lossless_monochrome(self):
275275

276276
def test_jpeg2000lossless_single_bit(self):
277277
bits_allocated = 1
278-
frame = np.zeros((48, 32), dtype=np.dtype(f'uint8'))
278+
frame = np.zeros((48, 32), dtype=np.dtype('uint8'))
279279
frame[12:45, 3:6] = 1
280280
compressed_frame = encode_frame(
281281
frame,

tests/test_sc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ def test_monochrome_jpegls(self):
485485
frame
486486
)
487487

488-
def test_monochrome_jpegls(self):
488+
def test_monochrome_jpegls_near_lossless(self):
489489
pytest.importorskip("libjpeg")
490490
bits_allocated = 16
491491
photometric_interpretation = 'MONOCHROME2'

tests/test_seg.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -663,8 +663,8 @@ def setUp(self):
663663
frame = np.pad(frame, ((0, 0), (12, 12), (12, 12), (0, 0)))
664664
self._sm_image.PixelData = frame.flatten().tobytes()
665665
self._sm_image.TotalPixelMatrixRows = (
666-
frame.shape[1] *
667-
int(self._sm_image.TotalPixelMatrixRows / self._sm_image.Rows)
666+
frame.shape[1] *
667+
int(self._sm_image.TotalPixelMatrixRows / self._sm_image.Rows)
668668
)
669669
self._sm_image.TotalPixelMatrixColumns = (
670670
frame.shape[2] *
@@ -3871,11 +3871,14 @@ def setUp(self):
38713871

38723872
resized_multisegment = np.stack(
38733873
[
3874-
im.resize(out_size, Image.Resampling.NEAREST) for im in seg_pil_multisegment
3874+
im.resize(out_size, Image.Resampling.NEAREST)
3875+
for im in seg_pil_multisegment
38753876
],
38763877
axis=-1
38773878
)[None]
3878-
self._downsampled_pix_arrays_multisegment.append(resized_multisegment)
3879+
self._downsampled_pix_arrays_multisegment.append(
3880+
resized_multisegment
3881+
)
38793882

38803883
# Mock lower-resolution source images. No need to have their pixel
38813884
# data correctly set as it isn't used. Just update the relevant

tests/test_sr.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1479,8 +1479,9 @@ def test_from_image(self):
14791479
for item in subject_context:
14801480

14811481
# SpecimenUID
1482+
specimen_uid = '2.25.281821656492584880365678271074145532563'
14821483
if item.ConceptNameCodeSequence[0].CodeValue == '121039':
1483-
assert item.UID == '2.25.281821656492584880365678271074145532563'
1484+
assert item.UID == specimen_uid
14841485
has_specimen_uid = True
14851486

14861487
# Specimen Identifier

0 commit comments

Comments
 (0)