Skip to content

Commit f9849b8

Browse files
committed
Fix formatting inconsistencies and improve error message clarity
- Adjusted whitespace in print statements for better readability in the DICOM data loader operator. - Enhanced the error message in the AppGenerator class to improve clarity regarding valid model_id formats. - Corrected spacing in the file processing output of the generic directory scanner operator. - Removed unused import from the test_run_command module to clean up the code. Signed-off-by: Victor Chang <[email protected]>
1 parent ed8b7c2 commit f9849b8

File tree

4 files changed

+8
-5
lines changed

4 files changed

+8
-5
lines changed

monai/deploy/operators/dicom_data_loader_operator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,10 +437,10 @@ def test():
437437
print(f" 'SeriesDescription': {ds.SeriesDescription if ds.SeriesDescription else ''}")
438438
print(
439439
" 'IssuerOfPatientID':"
440-
f" {ds.get('IssuerOfPatientID', '').repval if ds.get('IssuerOfPatientID', '') else '' }"
440+
f" {ds.get('IssuerOfPatientID', '').repval if ds.get('IssuerOfPatientID', '') else ''}"
441441
)
442442
try:
443-
print(f" 'IssuerOfPatientID': {ds.IssuerOfPatientID if ds.IssuerOfPatientID else '' }")
443+
print(f" 'IssuerOfPatientID': {ds.IssuerOfPatientID if ds.IssuerOfPatientID else ''}")
444444
except AttributeError:
445445
print(
446446
" If the IssuerOfPatientID does not exist, ds.IssuerOfPatientID would throw AttributeError."

tools/pipeline-generator/pipeline_generator/generator/app_generator.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,11 @@ def generate_app(
9999

100100
if not model_id or not re.match(model_id_pattern, model_id):
101101
raise ValueError(
102-
f"Invalid model_id: {model_id}. Only alphanumeric characters, hyphens, underscores, and single slashes between segments are allowed. No leading/trailing slashes, consecutive slashes, or '..' allowed."
102+
(
103+
f"Invalid model_id: {model_id}. Only alphanumeric characters, hyphens, "
104+
"underscores, and single slashes between segments are allowed. "
105+
"No leading/trailing slashes, consecutive slashes, or '..' allowed."
106+
)
103107
)
104108

105109
# Create output directory

tools/pipeline-generator/pipeline_generator/templates/operators/generic_directory_scanner_operator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def emit(self, data, name):
192192

193193
# Process a few files
194194
for i in range(min(3, len(scanner._files))):
195-
print(f"\n--- Processing file {i+1} ---")
195+
print(f"\n--- Processing file {i + 1} ---")
196196
scanner.compute(None, mock_output, None)
197197

198198

tools/pipeline-generator/tests/test_run_command.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"""Tests for the run command with validation fixes."""
1313

1414
import subprocess
15-
from pathlib import Path
1615
from unittest.mock import Mock, patch
1716

1817
from click.testing import CliRunner

0 commit comments

Comments
 (0)