Skip to content

Commit 32964a7

Browse files
committed
Fix pylint warnings (#297)
``` nox > pylint openlifu ************* Module openlifu.db.database Warning: .nox/pylint/lib/python3.12/site-packages/openlifu/db/database.py:396:24: R1732: Consider using 'with' for resource-allocating operations (consider-using-with) ************* Module openlifu.nav.photoscan Warning: .nox/pylint/lib/python3.12/site-packages/openlifu/nav/photoscan.py:195:13: I1101: Module 'OpenEXR' has no 'File' member, but source is unavailable. Consider adding this module to extension-pkg-allow-list if you want to perform analysis based on run-time introspection of living objects. (c-extension-no-member) ```
1 parent a7eae35 commit 32964a7

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ messages_control.disable = [
251251
"duplicate-code",
252252
"cyclic-import",
253253
"unreachable", # This is to allow marking of TODO items with a NotImplementedError
254+
"c-extension-no-member",
254255
]
255256

256257
[tool.setuptools.package-data]

src/openlifu/db/database.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,8 @@ def write_volume(self, subject_id, volume_id, volume_name, volume_data_filepath,
393393
temp_nifti_path = None
394394
if is_dicom_file_or_directory(volume_data_filepath):
395395
self.logger.info(f"Detected DICOM input for volume {volume_id}, converting to NIfTI format")
396-
temp_file = tempfile.NamedTemporaryFile(suffix='.nii.gz', delete=False)
397-
temp_nifti_path = Path(temp_file.name)
398-
temp_file.close()
396+
with tempfile.NamedTemporaryFile(suffix='.nii.gz', delete=False) as temp_file:
397+
temp_nifti_path = Path(temp_file.name)
399398

400399
try:
401400
convert_dicom_to_nifti(volume_data_filepath, temp_nifti_path)

0 commit comments

Comments
 (0)