replace typing hints in tests/ignite/metrics#3546
Merged
vfdev-5 merged 3 commits intopytorch:masterfrom Feb 22, 2026
Merged
Conversation
Collaborator
|
Originally, reviewing policy for the issue is to send one PR with one file changed. Here we have 20 files. I'll let copilot review it and let's see. Otherwise, we may need to split it... |
Contributor
There was a problem hiding this comment.
Pull request overview
Updates typing annotations in Ignite metric tests to use modern Python (PEP 585/604) syntax as part of #3481’s typing-hints modernization effort.
Changes:
- Replaces
typinggenerics (Tuple,List,Dict,Optional,Union) with builtin generics (tuple,list,dict) and| Noneunions. - Removes now-unneeded
typingimports and updates anisinstance(..., Tuple)check totuple. - Adjusts several function/fixture signatures in tests to reflect the new annotation style.
Reviewed changes
Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/ignite/metrics/vision/test_object_detection_map.py | Converts nested list/dict return/arg annotations to builtin generics. |
| tests/ignite/metrics/test_ssim.py | Replaces Union[..., None] with `... |
| tests/ignite/metrics/test_precision_recall_curve.py | Drops typing.Tuple import and uses tuple in isinstance check. |
| tests/ignite/metrics/test_mutual_information.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/test_metric.py | Replaces Dict/List annotations with dict/list. |
| tests/ignite/metrics/test_maximum_mean_discrepancy.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/test_loss.py | Replaces Tuple[...] with tuple[...] in a module forward signature. |
| tests/ignite/metrics/test_kl_divergence.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/test_js_divergence.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/test_hsic.py | Replaces Tuple[...] with tuple[...] in fixture and test parameter typing. |
| tests/ignite/metrics/test_cosine_similarity.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/test_accuracy.py | Replaces Union[str, torch.device] with `str |
| tests/ignite/metrics/regression/test_spearman_correlation.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/regression/test_pearson_correlation.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/regression/test_kendall_correlation.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/regression/test__base.py | Replaces Optional[str] with `str |
| tests/ignite/metrics/gan/test_utils.py | Replaces Optional[...]/Union[...] with `... |
| tests/ignite/metrics/clustering/test_silhouette_score.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/clustering/test_davies_bouldin_score.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
| tests/ignite/metrics/clustering/test_calinski_harabasz_score.py | Replaces Tuple[...] with tuple[...] in test parameter typing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
tests/ignite/metrics/clustering/test_calinski_harabasz_score.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
Contributor
Author
|
hey @vfdev-5 there seems to be some issue with the docs, all other tests are passing |
tests/ignite/metricstests/ignite/metrics
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.

Part of #3481