Skip to content

fix: add missing stacklevel=2 to warnings.warn() in metrics/ #8931

@rtmalikian

Description

@rtmalikian

Problem

13 calls to warnings.warn() in monai/metrics/ are missing the stacklevel parameter. Without stacklevel=2, warnings point to the MONAI internal code instead of the user's calling code.

This is the same class of issue as #8929 (losses/ module).

Proposed Fix

Add stacklevel=2 to all 13 warnings.warn() calls in:

  • monai/metrics/embedding_collapse.py
  • monai/metrics/cumulative_average.py
  • monai/metrics/average_precision.py
  • monai/metrics/utils.py
  • monai/metrics/active_learning_metrics.py
  • monai/metrics/confusion_matrix.py
  • monai/metrics/rocauc.py

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