Skip to content

Replace typing module hints with modern syntax in metrics core (metric, epoch_metric, confusion_matrix, classification_report)#3603

Open
Manimaran-tech wants to merge 7 commits intopytorch:masterfrom
Manimaran-tech:fix/typing-metrics-core-part1
Open

Replace typing module hints with modern syntax in metrics core (metric, epoch_metric, confusion_matrix, classification_report)#3603
Manimaran-tech wants to merge 7 commits intopytorch:masterfrom
Manimaran-tech:fix/typing-metrics-core-part1

Conversation

@Manimaran-tech
Copy link
Contributor

Description

Modernize type hints in core ignite/metrics files by replacing typing module imports with Python 3.10+ built-in syntax and collections.abc.

Files changed:

  • ignite/metrics/metric.py
  • ignite/metrics/epoch_metric.py
  • ignite/metrics/confusion_matrix.py
  • ignite/metrics/classification_report.py

Related to #3591

@github-actions github-actions bot added the module: metrics Metrics module label Feb 26, 2026
Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@vfdev-5
Copy link
Collaborator

vfdev-5 commented Feb 26, 2026

from functools import wraps
from numbers import Number
from typing import TYPE_CHECKING, Any, Callable, Dict, List, Literal, Optional, Sequence, Tuple, Union, cast
from collections.abc import Callable, Sequence
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge this line with the line 3: from collections.abc import Mapping

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: metrics Metrics module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants