Skip to content

fix: should be in verify_report_format #8927

@rtmalikian

Description

@rtmalikian

Problem

In monai/auto3dseg/utils.py line 287, the code uses:

raise UserWarning("list length in report_format is not 1")

This raises UserWarning as an exception, which will crash the program. Since UserWarning inherits from Warning → Exception, it technically works as a raise, but the intent appears to be to emit a warning (the function returns bool to indicate format validity, not to signal fatal errors).

The warnings module is already imported in the file.

Proposed Fix

Replace raise UserWarning(...) with warnings.warn(...):

warnings.warn("list length in report_format is not 1", stacklevel=2)

Affected Files

  • monai/auto3dseg/utils.py (line 287)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions