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
Conversation
added 4 commits
February 26, 2026 19:56
Collaborator
|
Please fix the failure: https://github.com/pytorch/ignite/actions/runs/22447254171/job/65010772784?pr=3603 |
vfdev-5
reviewed
Feb 26, 2026
ignite/metrics/metric.py
Outdated
| 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 |
Collaborator
There was a problem hiding this comment.
Merge this line with the line 3: from collections.abc import Mapping
vfdev-5
requested changes
Feb 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Modernize type hints in core
ignite/metricsfiles by replacingtypingmodule imports with Python 3.10+ built-in syntax andcollections.abc.Files changed:
ignite/metrics/metric.pyignite/metrics/epoch_metric.pyignite/metrics/confusion_matrix.pyignite/metrics/classification_report.pyRelated to #3591