diff --git a/.github/assistant.py b/.github/assistant.py index 1718727c452..174ed2117a4 100644 --- a/.github/assistant.py +++ b/.github/assistant.py @@ -16,7 +16,7 @@ import os import re import sys -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import fire from packaging.version import parse diff --git a/_samples/bert_score-own_model.py b/_samples/bert_score-own_model.py index 74799c41acc..982d7f63876 100644 --- a/_samples/bert_score-own_model.py +++ b/_samples/bert_score-own_model.py @@ -18,7 +18,7 @@ """ from pprint import pprint -from typing import Dict, List, Union +from typing import Union import torch from torch import Tensor, nn diff --git a/examples/audio/signal_to_noise_ratio.py b/examples/audio/signal_to_noise_ratio.py index b203efb87d5..7099fc08d2b 100644 --- a/examples/audio/signal_to_noise_ratio.py +++ b/examples/audio/signal_to_noise_ratio.py @@ -8,7 +8,6 @@ # %% # Import necessary libraries -from typing import Tuple import matplotlib.animation as animation import matplotlib.pyplot as plt diff --git a/pyproject.toml b/pyproject.toml index ca69b1c1de3..9aa3f5c4e53 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -77,9 +77,6 @@ lint.per-file-ignores."tests/**" = [ "S101", "S301", # todo: `pickle` and modules that wrap it can be unsafe when used to deserialize untrusted data, possible security issue ] -lint.unfixable = [ - "F401", -] # Unlike Flake8, default to a complexity level of 10. lint.mccabe.max-complexity = 10 # Use Google-style docstrings. diff --git a/setup.py b/setup.py index dc66936b98a..915045028ac 100755 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from importlib.util import module_from_spec, spec_from_file_location from itertools import chain from pathlib import Path -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union from pkg_resources import Requirement, yield_lines from setuptools import find_packages, setup diff --git a/src/torchmetrics/aggregation.py b/src/torchmetrics/aggregation.py index ae30429bc20..312197ccbc4 100644 --- a/src/torchmetrics/aggregation.py +++ b/src/torchmetrics/aggregation.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Callable, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/audio/pit.py b/src/torchmetrics/audio/pit.py index 56cd28b5ae0..6c28738a3f9 100644 --- a/src/torchmetrics/audio/pit.py +++ b/src/torchmetrics/audio/pit.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Callable, Dict, Optional, Union +from typing import Any, Callable, Optional, Union from torch import Tensor, tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/accuracy.py b/src/torchmetrics/classification/accuracy.py index 1baec43a9e5..bc1a8bb5e36 100644 --- a/src/torchmetrics/classification/accuracy.py +++ b/src/torchmetrics/classification/accuracy.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/auroc.py b/src/torchmetrics/classification/auroc.py index e82498b221b..8e5a69092fb 100644 --- a/src/torchmetrics/classification/auroc.py +++ b/src/torchmetrics/classification/auroc.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/average_precision.py b/src/torchmetrics/classification/average_precision.py index e37f6989fa3..221f400918c 100644 --- a/src/torchmetrics/classification/average_precision.py +++ b/src/torchmetrics/classification/average_precision.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/calibration_error.py b/src/torchmetrics/classification/calibration_error.py index 7de354e54cd..3cd760d4c17 100644 --- a/src/torchmetrics/classification/calibration_error.py +++ b/src/torchmetrics/classification/calibration_error.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/cohen_kappa.py b/src/torchmetrics/classification/cohen_kappa.py index 154cae505c1..aa1d1d0780c 100644 --- a/src/torchmetrics/classification/cohen_kappa.py +++ b/src/torchmetrics/classification/cohen_kappa.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/confusion_matrix.py b/src/torchmetrics/classification/confusion_matrix.py index f713f6c1c40..b5f304dbd82 100644 --- a/src/torchmetrics/classification/confusion_matrix.py +++ b/src/torchmetrics/classification/confusion_matrix.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional, Type +from typing import Any, Optional import torch from torch import Tensor diff --git a/src/torchmetrics/classification/dice.py b/src/torchmetrics/classification/dice.py index 281324767af..ad160aa0d09 100644 --- a/src/torchmetrics/classification/dice.py +++ b/src/torchmetrics/classification/dice.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Callable, Optional, Tuple, Union, no_type_check +from typing import Any, Callable, Optional, Union, no_type_check import torch from torch import Tensor diff --git a/src/torchmetrics/classification/exact_match.py b/src/torchmetrics/classification/exact_match.py index 189b5b44822..e167b22219c 100644 --- a/src/torchmetrics/classification/exact_match.py +++ b/src/torchmetrics/classification/exact_match.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/classification/f_beta.py b/src/torchmetrics/classification/f_beta.py index 46b1dd6d297..dcbe8a8b69d 100644 --- a/src/torchmetrics/classification/f_beta.py +++ b/src/torchmetrics/classification/f_beta.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/group_fairness.py b/src/torchmetrics/classification/group_fairness.py index 0235ef123af..d966063856c 100644 --- a/src/torchmetrics/classification/group_fairness.py +++ b/src/torchmetrics/classification/group_fairness.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/classification/hamming.py b/src/torchmetrics/classification/hamming.py index c0dc94d3c21..183af336ae8 100644 --- a/src/torchmetrics/classification/hamming.py +++ b/src/torchmetrics/classification/hamming.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/hinge.py b/src/torchmetrics/classification/hinge.py index 4fed17aa0f1..878ea271049 100644 --- a/src/torchmetrics/classification/hinge.py +++ b/src/torchmetrics/classification/hinge.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/classification/jaccard.py b/src/torchmetrics/classification/jaccard.py index 7098db7896c..5f9a15b2e4f 100644 --- a/src/torchmetrics/classification/jaccard.py +++ b/src/torchmetrics/classification/jaccard.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/matthews_corrcoef.py b/src/torchmetrics/classification/matthews_corrcoef.py index c84ebed69d3..ea1b7a23cb5 100644 --- a/src/torchmetrics/classification/matthews_corrcoef.py +++ b/src/torchmetrics/classification/matthews_corrcoef.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/negative_predictive_value.py b/src/torchmetrics/classification/negative_predictive_value.py index a4bfb9bc4c4..cdff97f86e2 100644 --- a/src/torchmetrics/classification/negative_predictive_value.py +++ b/src/torchmetrics/classification/negative_predictive_value.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/precision_fixed_recall.py b/src/torchmetrics/classification/precision_fixed_recall.py index 5ce97e7effc..a17f19aa39b 100644 --- a/src/torchmetrics/classification/precision_fixed_recall.py +++ b/src/torchmetrics/classification/precision_fixed_recall.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/precision_recall.py b/src/torchmetrics/classification/precision_recall.py index b9b790008cd..0bd6f8b0d99 100644 --- a/src/torchmetrics/classification/precision_recall.py +++ b/src/torchmetrics/classification/precision_recall.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/precision_recall_curve.py b/src/torchmetrics/classification/precision_recall_curve.py index 86f2c66967b..0149f78bbd4 100644 --- a/src/torchmetrics/classification/precision_recall_curve.py +++ b/src/torchmetrics/classification/precision_recall_curve.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional, Tuple, Type, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/classification/recall_fixed_precision.py b/src/torchmetrics/classification/recall_fixed_precision.py index 88a4fbdd74f..f34b3bb580a 100644 --- a/src/torchmetrics/classification/recall_fixed_precision.py +++ b/src/torchmetrics/classification/recall_fixed_precision.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/roc.py b/src/torchmetrics/classification/roc.py index 73be641c66d..cf22c8c5646 100644 --- a/src/torchmetrics/classification/roc.py +++ b/src/torchmetrics/classification/roc.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional, Tuple, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/sensitivity_specificity.py b/src/torchmetrics/classification/sensitivity_specificity.py index bce575a1014..23851affe24 100644 --- a/src/torchmetrics/classification/sensitivity_specificity.py +++ b/src/torchmetrics/classification/sensitivity_specificity.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional, Tuple, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/specificity.py b/src/torchmetrics/classification/specificity.py index 59b7baac794..dab5fde8a60 100644 --- a/src/torchmetrics/classification/specificity.py +++ b/src/torchmetrics/classification/specificity.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Optional, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/specificity_sensitivity.py b/src/torchmetrics/classification/specificity_sensitivity.py index 2fd7b4c3f70..d8ed0f27cd4 100644 --- a/src/torchmetrics/classification/specificity_sensitivity.py +++ b/src/torchmetrics/classification/specificity_sensitivity.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional, Tuple, Type, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/classification/stat_scores.py b/src/torchmetrics/classification/stat_scores.py index 3a18a8b481e..483cbabda25 100644 --- a/src/torchmetrics/classification/stat_scores.py +++ b/src/torchmetrics/classification/stat_scores.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, Callable, List, Optional, Tuple, Type, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/clustering/adjusted_mutual_info_score.py b/src/torchmetrics/clustering/adjusted_mutual_info_score.py index 94d66609d14..966b2d00540 100644 --- a/src/torchmetrics/clustering/adjusted_mutual_info_score.py +++ b/src/torchmetrics/clustering/adjusted_mutual_info_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Literal, Optional, Union +from typing import Any, Literal, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/adjusted_rand_score.py b/src/torchmetrics/clustering/adjusted_rand_score.py index 5f202536bae..3f614c25c69 100644 --- a/src/torchmetrics/clustering/adjusted_rand_score.py +++ b/src/torchmetrics/clustering/adjusted_rand_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/calinski_harabasz_score.py b/src/torchmetrics/clustering/calinski_harabasz_score.py index 48463b94988..4a3d25138f2 100644 --- a/src/torchmetrics/clustering/calinski_harabasz_score.py +++ b/src/torchmetrics/clustering/calinski_harabasz_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/davies_bouldin_score.py b/src/torchmetrics/clustering/davies_bouldin_score.py index c2b30c93e01..98f373b9558 100644 --- a/src/torchmetrics/clustering/davies_bouldin_score.py +++ b/src/torchmetrics/clustering/davies_bouldin_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/dunn_index.py b/src/torchmetrics/clustering/dunn_index.py index ddc6b1867ba..db635dee23a 100644 --- a/src/torchmetrics/clustering/dunn_index.py +++ b/src/torchmetrics/clustering/dunn_index.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/fowlkes_mallows_index.py b/src/torchmetrics/clustering/fowlkes_mallows_index.py index 4c82f892da3..276c28f5456 100644 --- a/src/torchmetrics/clustering/fowlkes_mallows_index.py +++ b/src/torchmetrics/clustering/fowlkes_mallows_index.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/homogeneity_completeness_v_measure.py b/src/torchmetrics/clustering/homogeneity_completeness_v_measure.py index f9b7b5cc5c7..b610f134b85 100644 --- a/src/torchmetrics/clustering/homogeneity_completeness_v_measure.py +++ b/src/torchmetrics/clustering/homogeneity_completeness_v_measure.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/mutual_info_score.py b/src/torchmetrics/clustering/mutual_info_score.py index 8d206ed8886..549c2f8376b 100644 --- a/src/torchmetrics/clustering/mutual_info_score.py +++ b/src/torchmetrics/clustering/mutual_info_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/normalized_mutual_info_score.py b/src/torchmetrics/clustering/normalized_mutual_info_score.py index f829b3a3512..eedda19f784 100644 --- a/src/torchmetrics/clustering/normalized_mutual_info_score.py +++ b/src/torchmetrics/clustering/normalized_mutual_info_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Literal, Optional, Union +from typing import Any, Literal, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/clustering/rand_score.py b/src/torchmetrics/clustering/rand_score.py index c949dd06e5c..d625dec55ac 100644 --- a/src/torchmetrics/clustering/rand_score.py +++ b/src/torchmetrics/clustering/rand_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/collections.py b/src/torchmetrics/collections.py index 930540473bc..23cf92a7f9c 100644 --- a/src/torchmetrics/collections.py +++ b/src/torchmetrics/collections.py @@ -15,7 +15,7 @@ from collections import OrderedDict from collections.abc import Hashable, Iterable, Iterator, Mapping, Sequence from copy import deepcopy -from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union +from typing import Any, ClassVar, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/detection/_mean_ap.py b/src/torchmetrics/detection/_mean_ap.py index d9bba820185..5704fae1209 100644 --- a/src/torchmetrics/detection/_mean_ap.py +++ b/src/torchmetrics/detection/_mean_ap.py @@ -13,7 +13,7 @@ # limitations under the License. import logging from collections.abc import Sequence -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import numpy as np import torch diff --git a/src/torchmetrics/detection/helpers.py b/src/torchmetrics/detection/helpers.py index ae4c6c2b88c..ddb54463f54 100644 --- a/src/torchmetrics/detection/helpers.py +++ b/src/torchmetrics/detection/helpers.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Dict, Literal, Tuple, Union +from typing import Literal, Union from torch import Tensor diff --git a/src/torchmetrics/detection/iou.py b/src/torchmetrics/detection/iou.py index 9579eeae06d..26c48bd42c1 100644 --- a/src/torchmetrics/detection/iou.py +++ b/src/torchmetrics/detection/iou.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/detection/mean_ap.py b/src/torchmetrics/detection/mean_ap.py index 2a3c1095a53..f8234a08d69 100644 --- a/src/torchmetrics/detection/mean_ap.py +++ b/src/torchmetrics/detection/mean_ap.py @@ -16,7 +16,7 @@ import json from collections.abc import Sequence from types import ModuleType -from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, ClassVar, Optional, Union import numpy as np import torch diff --git a/src/torchmetrics/functional/audio/_deprecated.py b/src/torchmetrics/functional/audio/_deprecated.py index 4b31c5db37d..ff3c18e5458 100644 --- a/src/torchmetrics/functional/audio/_deprecated.py +++ b/src/torchmetrics/functional/audio/_deprecated.py @@ -1,4 +1,4 @@ -from typing import Any, Callable, Optional, Tuple +from typing import Any, Callable, Optional from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/functional/audio/dnsmos.py b/src/torchmetrics/functional/audio/dnsmos.py index 13935d9cdd2..2e23fba23a2 100644 --- a/src/torchmetrics/functional/audio/dnsmos.py +++ b/src/torchmetrics/functional/audio/dnsmos.py @@ -13,7 +13,7 @@ # limitations under the License. import os from functools import lru_cache -from typing import Any, Dict, Optional +from typing import Any, Optional import numpy as np import torch diff --git a/src/torchmetrics/functional/audio/nisqa.py b/src/torchmetrics/functional/audio/nisqa.py index a900d538d59..8718c97d8e6 100644 --- a/src/torchmetrics/functional/audio/nisqa.py +++ b/src/torchmetrics/functional/audio/nisqa.py @@ -40,7 +40,7 @@ import os import warnings from functools import lru_cache -from typing import Any, Dict, Tuple +from typing import Any import numpy as np import torch diff --git a/src/torchmetrics/functional/audio/pit.py b/src/torchmetrics/functional/audio/pit.py index 6fc431811c1..2d126c7000f 100644 --- a/src/torchmetrics/functional/audio/pit.py +++ b/src/torchmetrics/functional/audio/pit.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from itertools import permutations -from typing import Any, Callable, Tuple +from typing import Any, Callable import numpy as np import torch diff --git a/src/torchmetrics/functional/audio/sdr.py b/src/torchmetrics/functional/audio/sdr.py index a68c3e5f047..85da9597998 100644 --- a/src/torchmetrics/functional/audio/sdr.py +++ b/src/torchmetrics/functional/audio/sdr.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import math -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/audio/srmr.py b/src/torchmetrics/functional/audio/srmr.py index daf7befed02..20ad898fe8d 100644 --- a/src/torchmetrics/functional/audio/srmr.py +++ b/src/torchmetrics/functional/audio/srmr.py @@ -17,7 +17,7 @@ from functools import lru_cache from math import ceil, pi -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/auroc.py b/src/torchmetrics/functional/classification/auroc.py index 03bd8ff3aa0..c4c55769be5 100644 --- a/src/torchmetrics/functional/classification/auroc.py +++ b/src/torchmetrics/functional/classification/auroc.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/classification/average_precision.py b/src/torchmetrics/functional/classification/average_precision.py index cd941e0a9df..ff7a46f0a11 100644 --- a/src/torchmetrics/functional/classification/average_precision.py +++ b/src/torchmetrics/functional/classification/average_precision.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/calibration_error.py b/src/torchmetrics/functional/classification/calibration_error.py index 9d994679a42..ca55bb2f79b 100644 --- a/src/torchmetrics/functional/classification/calibration_error.py +++ b/src/torchmetrics/functional/classification/calibration_error.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/confusion_matrix.py b/src/torchmetrics/functional/classification/confusion_matrix.py index 31d9bbb7f46..92059072490 100644 --- a/src/torchmetrics/functional/classification/confusion_matrix.py +++ b/src/torchmetrics/functional/classification/confusion_matrix.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/exact_match.py b/src/torchmetrics/functional/classification/exact_match.py index 2b0339e0adc..d22b4cc6f89 100644 --- a/src/torchmetrics/functional/classification/exact_match.py +++ b/src/torchmetrics/functional/classification/exact_match.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/group_fairness.py b/src/torchmetrics/functional/classification/group_fairness.py index 2d5da8582ed..5e52e94733f 100644 --- a/src/torchmetrics/functional/classification/group_fairness.py +++ b/src/torchmetrics/functional/classification/group_fairness.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Dict, List, Optional, Tuple +from typing import Optional import torch from typing_extensions import Literal diff --git a/src/torchmetrics/functional/classification/hinge.py b/src/torchmetrics/functional/classification/hinge.py index d08df7d550d..8fe7cf840b8 100644 --- a/src/torchmetrics/functional/classification/hinge.py +++ b/src/torchmetrics/functional/classification/hinge.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/classification/precision_fixed_recall.py b/src/torchmetrics/functional/classification/precision_fixed_recall.py index d16beba4664..078d970299e 100644 --- a/src/torchmetrics/functional/classification/precision_fixed_recall.py +++ b/src/torchmetrics/functional/classification/precision_fixed_recall.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/precision_recall_curve.py b/src/torchmetrics/functional/classification/precision_recall_curve.py index c498ffcc864..f1765916b36 100644 --- a/src/torchmetrics/functional/classification/precision_recall_curve.py +++ b/src/torchmetrics/functional/classification/precision_recall_curve.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/classification/ranking.py b/src/torchmetrics/functional/classification/ranking.py index d78fe807a88..57dd389ec3a 100644 --- a/src/torchmetrics/functional/classification/ranking.py +++ b/src/torchmetrics/functional/classification/ranking.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/recall_fixed_precision.py b/src/torchmetrics/functional/classification/recall_fixed_precision.py index 72faf8b8b6d..196209bce21 100644 --- a/src/torchmetrics/functional/classification/recall_fixed_precision.py +++ b/src/torchmetrics/functional/classification/recall_fixed_precision.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Callable, List, Optional, Tuple, Union +from typing import Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/roc.py b/src/torchmetrics/functional/classification/roc.py index f2374778f01..2ce36bb3643 100644 --- a/src/torchmetrics/functional/classification/roc.py +++ b/src/torchmetrics/functional/classification/roc.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/sensitivity_specificity.py b/src/torchmetrics/functional/classification/sensitivity_specificity.py index bc590a4c6b9..940691a51f7 100644 --- a/src/torchmetrics/functional/classification/sensitivity_specificity.py +++ b/src/torchmetrics/functional/classification/sensitivity_specificity.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/specificity_sensitivity.py b/src/torchmetrics/functional/classification/specificity_sensitivity.py index 3f93cea467d..1f252cdd98e 100644 --- a/src/torchmetrics/functional/classification/specificity_sensitivity.py +++ b/src/torchmetrics/functional/classification/specificity_sensitivity.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import warnings -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/classification/stat_scores.py b/src/torchmetrics/functional/classification/stat_scores.py index d6079de55d3..e9d78b1a1b7 100644 --- a/src/torchmetrics/functional/classification/stat_scores.py +++ b/src/torchmetrics/functional/classification/stat_scores.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/clustering/dunn_index.py b/src/torchmetrics/functional/clustering/dunn_index.py index 05f7c87df33..ac073b7c273 100644 --- a/src/torchmetrics/functional/clustering/dunn_index.py +++ b/src/torchmetrics/functional/clustering/dunn_index.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. from itertools import combinations -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/clustering/fowlkes_mallows_index.py b/src/torchmetrics/functional/clustering/fowlkes_mallows_index.py index c2820e9001a..88b9288f9ed 100644 --- a/src/torchmetrics/functional/clustering/fowlkes_mallows_index.py +++ b/src/torchmetrics/functional/clustering/fowlkes_mallows_index.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/clustering/homogeneity_completeness_v_measure.py b/src/torchmetrics/functional/clustering/homogeneity_completeness_v_measure.py index 7eb7b478430..a85d9ab2a11 100644 --- a/src/torchmetrics/functional/clustering/homogeneity_completeness_v_measure.py +++ b/src/torchmetrics/functional/clustering/homogeneity_completeness_v_measure.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/detection/_panoptic_quality_common.py b/src/torchmetrics/functional/detection/_panoptic_quality_common.py index 9b6660e5629..16d0463ba45 100644 --- a/src/torchmetrics/functional/detection/_panoptic_quality_common.py +++ b/src/torchmetrics/functional/detection/_panoptic_quality_common.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Collection, Iterator -from typing import Dict, List, Optional, Set, Tuple, cast +from typing import Optional, cast import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/_deprecated.py b/src/torchmetrics/functional/image/_deprecated.py index 55485f47639..8ee36b77a43 100644 --- a/src/torchmetrics/functional/image/_deprecated.py +++ b/src/torchmetrics/functional/image/_deprecated.py @@ -1,5 +1,5 @@ from collections.abc import Sequence -from typing import Optional, Tuple, Union +from typing import Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/functional/image/d_lambda.py b/src/torchmetrics/functional/image/d_lambda.py index 668dde7c0fc..478455c0a68 100644 --- a/src/torchmetrics/functional/image/d_lambda.py +++ b/src/torchmetrics/functional/image/d_lambda.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/d_s.py b/src/torchmetrics/functional/image/d_s.py index f8f54873dbe..1c2797a2aab 100644 --- a/src/torchmetrics/functional/image/d_s.py +++ b/src/torchmetrics/functional/image/d_s.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/ergas.py b/src/torchmetrics/functional/image/ergas.py index c69773b06ba..ae940250dbe 100644 --- a/src/torchmetrics/functional/image/ergas.py +++ b/src/torchmetrics/functional/image/ergas.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/gradients.py b/src/torchmetrics/functional/image/gradients.py index 683c67c153d..68045663fa9 100644 --- a/src/torchmetrics/functional/image/gradients.py +++ b/src/torchmetrics/functional/image/gradients.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/lpips.py b/src/torchmetrics/functional/image/lpips.py index 44006874120..768116613ea 100644 --- a/src/torchmetrics/functional/image/lpips.py +++ b/src/torchmetrics/functional/image/lpips.py @@ -24,7 +24,7 @@ # License under BSD 2-clause import inspect import os -from typing import List, NamedTuple, Optional, Tuple, Union +from typing import NamedTuple, Optional, Union import torch from torch import Tensor, nn diff --git a/src/torchmetrics/functional/image/perceptual_path_length.py b/src/torchmetrics/functional/image/perceptual_path_length.py index b1a9e3f7857..035425539d2 100644 --- a/src/torchmetrics/functional/image/perceptual_path_length.py +++ b/src/torchmetrics/functional/image/perceptual_path_length.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import math -from typing import Literal, Optional, Tuple, Union +from typing import Literal, Optional, Union import torch from torch import Tensor, nn diff --git a/src/torchmetrics/functional/image/psnr.py b/src/torchmetrics/functional/image/psnr.py index 01348c425c3..e058d34e7b6 100644 --- a/src/torchmetrics/functional/image/psnr.py +++ b/src/torchmetrics/functional/image/psnr.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/image/psnrb.py b/src/torchmetrics/functional/image/psnrb.py index 1b67df53519..4a8469e19fe 100644 --- a/src/torchmetrics/functional/image/psnrb.py +++ b/src/torchmetrics/functional/image/psnrb.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. import math -from typing import Tuple import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/image/rase.py b/src/torchmetrics/functional/image/rase.py index fd30d455724..832a759b562 100644 --- a/src/torchmetrics/functional/image/rase.py +++ b/src/torchmetrics/functional/image/rase.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/rmse_sw.py b/src/torchmetrics/functional/image/rmse_sw.py index 6d9b9eae235..3b0eaf6221f 100644 --- a/src/torchmetrics/functional/image/rmse_sw.py +++ b/src/torchmetrics/functional/image/rmse_sw.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/sam.py b/src/torchmetrics/functional/image/sam.py index 82c304c9543..21efde6f9c4 100644 --- a/src/torchmetrics/functional/image/sam.py +++ b/src/torchmetrics/functional/image/sam.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/scc.py b/src/torchmetrics/functional/image/scc.py index f0c3db35295..d680a22b676 100644 --- a/src/torchmetrics/functional/image/scc.py +++ b/src/torchmetrics/functional/image/scc.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. import math -from typing import Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/image/ssim.py b/src/torchmetrics/functional/image/ssim.py index 9dbf38b0627..6a1ae9deefb 100644 --- a/src/torchmetrics/functional/image/ssim.py +++ b/src/torchmetrics/functional/image/ssim.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/image/tv.py b/src/torchmetrics/functional/image/tv.py index 21c7b5f6f31..a0f310d498d 100644 --- a/src/torchmetrics/functional/image/tv.py +++ b/src/torchmetrics/functional/image/tv.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple, Union +from typing import Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/functional/image/uqi.py b/src/torchmetrics/functional/image/uqi.py index 1b0711bb969..30b5e781e55 100644 --- a/src/torchmetrics/functional/image/uqi.py +++ b/src/torchmetrics/functional/image/uqi.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor, nn diff --git a/src/torchmetrics/functional/image/utils.py b/src/torchmetrics/functional/image/utils.py index 13dee62d2ae..24ed9cd0de8 100644 --- a/src/torchmetrics/functional/image/utils.py +++ b/src/torchmetrics/functional/image/utils.py @@ -1,5 +1,5 @@ from collections.abc import Sequence -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/multimodal/clip_iqa.py b/src/torchmetrics/functional/multimodal/clip_iqa.py index b22b3472b82..99985c5b022 100644 --- a/src/torchmetrics/functional/multimodal/clip_iqa.py +++ b/src/torchmetrics/functional/multimodal/clip_iqa.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING, Dict, List, Literal, Tuple, Union +from typing import TYPE_CHECKING, Literal, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/multimodal/clip_score.py b/src/torchmetrics/functional/multimodal/clip_score.py index ead25db6f5a..bae7cb7b849 100644 --- a/src/torchmetrics/functional/multimodal/clip_score.py +++ b/src/torchmetrics/functional/multimodal/clip_score.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import TYPE_CHECKING, List, Tuple, Union +from typing import TYPE_CHECKING, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/nominal/utils.py b/src/torchmetrics/functional/nominal/utils.py index d98d7e8806c..9d8dd8dc4af 100644 --- a/src/torchmetrics/functional/nominal/utils.py +++ b/src/torchmetrics/functional/nominal/utils.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/pairwise/helpers.py b/src/torchmetrics/functional/pairwise/helpers.py index a0a0dbf2f9f..703b5ddb083 100644 --- a/src/torchmetrics/functional/pairwise/helpers.py +++ b/src/torchmetrics/functional/pairwise/helpers.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional from torch import Tensor diff --git a/src/torchmetrics/functional/regression/cosine_similarity.py b/src/torchmetrics/functional/regression/cosine_similarity.py index c90885aab86..c57623931a4 100644 --- a/src/torchmetrics/functional/regression/cosine_similarity.py +++ b/src/torchmetrics/functional/regression/cosine_similarity.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/csi.py b/src/torchmetrics/functional/regression/csi.py index f58f615e62b..65d38e6f573 100644 --- a/src/torchmetrics/functional/regression/csi.py +++ b/src/torchmetrics/functional/regression/csi.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/explained_variance.py b/src/torchmetrics/functional/regression/explained_variance.py index bf93bf94112..d401bb5a349 100644 --- a/src/torchmetrics/functional/regression/explained_variance.py +++ b/src/torchmetrics/functional/regression/explained_variance.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/kendall.py b/src/torchmetrics/functional/regression/kendall.py index 804c4cb10ef..4d5b2028a1d 100644 --- a/src/torchmetrics/functional/regression/kendall.py +++ b/src/torchmetrics/functional/regression/kendall.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/kl_divergence.py b/src/torchmetrics/functional/regression/kl_divergence.py index 8d6aee5c001..c4ed9efb25a 100644 --- a/src/torchmetrics/functional/regression/kl_divergence.py +++ b/src/torchmetrics/functional/regression/kl_divergence.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/log_cosh.py b/src/torchmetrics/functional/regression/log_cosh.py index a0931bcaecb..e13ee2a3e7a 100644 --- a/src/torchmetrics/functional/regression/log_cosh.py +++ b/src/torchmetrics/functional/regression/log_cosh.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/log_mse.py b/src/torchmetrics/functional/regression/log_mse.py index 34f3d9d71de..7c3a3585127 100644 --- a/src/torchmetrics/functional/regression/log_mse.py +++ b/src/torchmetrics/functional/regression/log_mse.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/mae.py b/src/torchmetrics/functional/regression/mae.py index 17db54f242c..8774d67fbe1 100644 --- a/src/torchmetrics/functional/regression/mae.py +++ b/src/torchmetrics/functional/regression/mae.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/mape.py b/src/torchmetrics/functional/regression/mape.py index 89cbd865c43..c109e898eee 100644 --- a/src/torchmetrics/functional/regression/mape.py +++ b/src/torchmetrics/functional/regression/mape.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/mse.py b/src/torchmetrics/functional/regression/mse.py index 09f4fadb490..4ea9490c841 100644 --- a/src/torchmetrics/functional/regression/mse.py +++ b/src/torchmetrics/functional/regression/mse.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/nrmse.py b/src/torchmetrics/functional/regression/nrmse.py index a7e8c28a1af..ccbe81c333d 100644 --- a/src/torchmetrics/functional/regression/nrmse.py +++ b/src/torchmetrics/functional/regression/nrmse.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/pearson.py b/src/torchmetrics/functional/regression/pearson.py index 6dffb193340..e8fa9ef3408 100644 --- a/src/torchmetrics/functional/regression/pearson.py +++ b/src/torchmetrics/functional/regression/pearson.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. import math -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/r2.py b/src/torchmetrics/functional/regression/r2.py index f8d036ece99..f52d082fc74 100644 --- a/src/torchmetrics/functional/regression/r2.py +++ b/src/torchmetrics/functional/regression/r2.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/spearman.py b/src/torchmetrics/functional/regression/spearman.py index 7e57b93c06f..b72bd7f03f7 100644 --- a/src/torchmetrics/functional/regression/spearman.py +++ b/src/torchmetrics/functional/regression/spearman.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/symmetric_mape.py b/src/torchmetrics/functional/regression/symmetric_mape.py index 9d919c13b2a..3fca98258c7 100644 --- a/src/torchmetrics/functional/regression/symmetric_mape.py +++ b/src/torchmetrics/functional/regression/symmetric_mape.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/tweedie_deviance.py b/src/torchmetrics/functional/regression/tweedie_deviance.py index e369d7d5ad5..328829dffe3 100644 --- a/src/torchmetrics/functional/regression/tweedie_deviance.py +++ b/src/torchmetrics/functional/regression/tweedie_deviance.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/regression/wmape.py b/src/torchmetrics/functional/regression/wmape.py index c3834047777..1781f306608 100644 --- a/src/torchmetrics/functional/regression/wmape.py +++ b/src/torchmetrics/functional/regression/wmape.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/retrieval/_deprecated.py b/src/torchmetrics/functional/retrieval/_deprecated.py index 4621b7f5ed2..6284470d1b2 100644 --- a/src/torchmetrics/functional/retrieval/_deprecated.py +++ b/src/torchmetrics/functional/retrieval/_deprecated.py @@ -1,4 +1,4 @@ -from typing import Optional, Tuple +from typing import Optional from torch import Tensor diff --git a/src/torchmetrics/functional/retrieval/precision_recall_curve.py b/src/torchmetrics/functional/retrieval/precision_recall_curve.py index ed204d136cd..269dca04016 100644 --- a/src/torchmetrics/functional/retrieval/precision_recall_curve.py +++ b/src/torchmetrics/functional/retrieval/precision_recall_curve.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/segmentation/dice.py b/src/torchmetrics/functional/segmentation/dice.py index a9ecf99f69e..de9a8068bf9 100644 --- a/src/torchmetrics/functional/segmentation/dice.py +++ b/src/torchmetrics/functional/segmentation/dice.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/segmentation/hausdorff_distance.py b/src/torchmetrics/functional/segmentation/hausdorff_distance.py index 18d7c45ddff..ca58e5f036c 100644 --- a/src/torchmetrics/functional/segmentation/hausdorff_distance.py +++ b/src/torchmetrics/functional/segmentation/hausdorff_distance.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Literal, Optional, Union +from typing import Literal, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/segmentation/mean_iou.py b/src/torchmetrics/functional/segmentation/mean_iou.py index 5acbd445851..9cfed0fa1bf 100644 --- a/src/torchmetrics/functional/segmentation/mean_iou.py +++ b/src/torchmetrics/functional/segmentation/mean_iou.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple import torch from torch import Tensor diff --git a/src/torchmetrics/functional/segmentation/utils.py b/src/torchmetrics/functional/segmentation/utils.py index b6ee4c1195e..b6dd123a4d6 100644 --- a/src/torchmetrics/functional/segmentation/utils.py +++ b/src/torchmetrics/functional/segmentation/utils.py @@ -13,7 +13,7 @@ # limitations under the License. import functools import math -from typing import List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/shape/procrustes.py b/src/torchmetrics/functional/shape/procrustes.py index c17871ed251..e72ca339306 100644 --- a/src/torchmetrics/functional/shape/procrustes.py +++ b/src/torchmetrics/functional/shape/procrustes.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Tuple, Union +from typing import Union import torch from torch import Tensor, linalg diff --git a/src/torchmetrics/functional/text/_deprecated.py b/src/torchmetrics/functional/text/_deprecated.py index 8ff582f52fc..c34419ac613 100644 --- a/src/torchmetrics/functional/text/_deprecated.py +++ b/src/torchmetrics/functional/text/_deprecated.py @@ -1,6 +1,6 @@ import os from collections.abc import Sequence -from typing import Any, Callable, Dict, List, Literal, Optional, Tuple, Union +from typing import Any, Callable, Literal, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/text/bert.py b/src/torchmetrics/functional/text/bert.py index 4380f447da7..e4a38b29755 100644 --- a/src/torchmetrics/functional/text/bert.py +++ b/src/torchmetrics/functional/text/bert.py @@ -16,7 +16,7 @@ import urllib from collections.abc import Iterator, Sequence from contextlib import contextmanager -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/text/bleu.py b/src/torchmetrics/functional/text/bleu.py index 6ed88ae05c8..52b8bb17432 100644 --- a/src/torchmetrics/functional/text/bleu.py +++ b/src/torchmetrics/functional/text/bleu.py @@ -18,7 +18,7 @@ # Link: https://pytorch.org/text/_modules/torchtext/data/metrics.html#bleu_score from collections import Counter from collections.abc import Sequence -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/cer.py b/src/torchmetrics/functional/text/cer.py index 2b5e10f6c55..e9ee191c449 100644 --- a/src/torchmetrics/functional/text/cer.py +++ b/src/torchmetrics/functional/text/cer.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Tuple, Union +from typing import Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/chrf.py b/src/torchmetrics/functional/text/chrf.py index 70f09142d7c..66ee3b7a449 100644 --- a/src/torchmetrics/functional/text/chrf.py +++ b/src/torchmetrics/functional/text/chrf.py @@ -23,7 +23,7 @@ from collections import defaultdict from collections.abc import Sequence from itertools import chain -from typing import Dict, List, Optional, Tuple, Union +from typing import Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/eed.py b/src/torchmetrics/functional/text/eed.py index abdc4e01de8..ca562c5212a 100644 --- a/src/torchmetrics/functional/text/eed.py +++ b/src/torchmetrics/functional/text/eed.py @@ -90,7 +90,7 @@ import unicodedata from collections.abc import Sequence from math import inf -from typing import List, Optional, Tuple, Union +from typing import Optional, Union from torch import Tensor, stack, tensor from typing_extensions import Literal diff --git a/src/torchmetrics/functional/text/helper.py b/src/torchmetrics/functional/text/helper.py index 3266876d129..a61f06232ab 100644 --- a/src/torchmetrics/functional/text/helper.py +++ b/src/torchmetrics/functional/text/helper.py @@ -31,7 +31,7 @@ import math from collections.abc import Sequence from enum import Enum, unique -from typing import Dict, List, Tuple, Union +from typing import Union # Tercom-inspired limits _BEAM_WIDTH = 25 diff --git a/src/torchmetrics/functional/text/helper_embedding_metric.py b/src/torchmetrics/functional/text/helper_embedding_metric.py index ad57c13a2f4..17c89558163 100644 --- a/src/torchmetrics/functional/text/helper_embedding_metric.py +++ b/src/torchmetrics/functional/text/helper_embedding_metric.py @@ -14,7 +14,7 @@ import math import os from collections import Counter, defaultdict -from typing import TYPE_CHECKING, Any, Callable, Dict, List, Optional, Set, Tuple, Union +from typing import TYPE_CHECKING, Any, Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/text/infolm.py b/src/torchmetrics/functional/text/infolm.py index 33c20f97e53..48a42e32b2f 100644 --- a/src/torchmetrics/functional/text/infolm.py +++ b/src/torchmetrics/functional/text/infolm.py @@ -14,7 +14,7 @@ import os from collections.abc import Sequence from enum import unique -from typing import TYPE_CHECKING, Dict, List, Optional, Tuple, Union +from typing import TYPE_CHECKING, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/functional/text/mer.py b/src/torchmetrics/functional/text/mer.py index 34d0eaff0ed..46f30331b85 100644 --- a/src/torchmetrics/functional/text/mer.py +++ b/src/torchmetrics/functional/text/mer.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Tuple, Union +from typing import Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/perplexity.py b/src/torchmetrics/functional/text/perplexity.py index 5a58a8da4c0..5931b7b6944 100644 --- a/src/torchmetrics/functional/text/perplexity.py +++ b/src/torchmetrics/functional/text/perplexity.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/functional/text/rouge.py b/src/torchmetrics/functional/text/rouge.py index e9f926b4d66..791de8dbe26 100644 --- a/src/torchmetrics/functional/text/rouge.py +++ b/src/torchmetrics/functional/text/rouge.py @@ -14,7 +14,7 @@ import re from collections import Counter from collections.abc import Sequence -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/sacre_bleu.py b/src/torchmetrics/functional/text/sacre_bleu.py index 28e36b2ea3b..a398acaf676 100644 --- a/src/torchmetrics/functional/text/sacre_bleu.py +++ b/src/torchmetrics/functional/text/sacre_bleu.py @@ -42,7 +42,7 @@ import tempfile from collections.abc import Sequence from functools import partial -from typing import Any, ClassVar, Dict, Optional, Type +from typing import Any, ClassVar, Optional import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/squad.py b/src/torchmetrics/functional/text/squad.py index d317a7ce806..c52f0860e14 100644 --- a/src/torchmetrics/functional/text/squad.py +++ b/src/torchmetrics/functional/text/squad.py @@ -17,7 +17,7 @@ import re import string from collections import Counter -from typing import Any, Callable, Dict, List, Tuple, Union +from typing import Any, Callable, Union from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/ter.py b/src/torchmetrics/functional/text/ter.py index 3cb862d046a..02617f2cbaf 100644 --- a/src/torchmetrics/functional/text/ter.py +++ b/src/torchmetrics/functional/text/ter.py @@ -36,7 +36,7 @@ import re from collections.abc import Iterator, Sequence from functools import lru_cache -from typing import Dict, List, Optional, Tuple, Type, Union +from typing import Optional, Union from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/wer.py b/src/torchmetrics/functional/text/wer.py index 0479ad0d945..b61bdb4c105 100644 --- a/src/torchmetrics/functional/text/wer.py +++ b/src/torchmetrics/functional/text/wer.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Tuple, Union +from typing import Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/wil.py b/src/torchmetrics/functional/text/wil.py index e7ca50abec4..3d8c370facb 100644 --- a/src/torchmetrics/functional/text/wil.py +++ b/src/torchmetrics/functional/text/wil.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Tuple, Union +from typing import Union from torch import Tensor, tensor diff --git a/src/torchmetrics/functional/text/wip.py b/src/torchmetrics/functional/text/wip.py index 2f6f635b053..77dae42e5ed 100644 --- a/src/torchmetrics/functional/text/wip.py +++ b/src/torchmetrics/functional/text/wip.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Tuple, Union +from typing import Union from torch import Tensor, tensor diff --git a/src/torchmetrics/image/_deprecated.py b/src/torchmetrics/image/_deprecated.py index 18f3e1840ba..cab7692f5e7 100644 --- a/src/torchmetrics/image/_deprecated.py +++ b/src/torchmetrics/image/_deprecated.py @@ -1,5 +1,5 @@ from collections.abc import Sequence -from typing import Any, Dict, Optional, Tuple, Union +from typing import Any, Optional, Union from typing_extensions import Literal diff --git a/src/torchmetrics/image/d_lambda.py b/src/torchmetrics/image/d_lambda.py index 0330d203e33..65824c19600 100644 --- a/src/torchmetrics/image/d_lambda.py +++ b/src/torchmetrics/image/d_lambda.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/image/d_s.py b/src/torchmetrics/image/d_s.py index 926929fe2be..f6b12efd5ad 100644 --- a/src/torchmetrics/image/d_s.py +++ b/src/torchmetrics/image/d_s.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/image/ergas.py b/src/torchmetrics/image/ergas.py index 6e8ba2624d8..bdf884c2719 100644 --- a/src/torchmetrics/image/ergas.py +++ b/src/torchmetrics/image/ergas.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/image/fid.py b/src/torchmetrics/image/fid.py index 1eac1bc9fcf..c15b3302af9 100644 --- a/src/torchmetrics/image/fid.py +++ b/src/torchmetrics/image/fid.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence from copy import deepcopy -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/inception.py b/src/torchmetrics/image/inception.py index 02c5cf04a35..fd11a6afe03 100644 --- a/src/torchmetrics/image/inception.py +++ b/src/torchmetrics/image/inception.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/kid.py b/src/torchmetrics/image/kid.py index 5aa3645bc77..f3c3d16bdd4 100644 --- a/src/torchmetrics/image/kid.py +++ b/src/torchmetrics/image/kid.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/lpip.py b/src/torchmetrics/image/lpip.py index ba792ab5d19..811476dd75d 100644 --- a/src/torchmetrics/image/lpip.py +++ b/src/torchmetrics/image/lpip.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, ClassVar, List, Optional, Union +from typing import Any, ClassVar, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/mifid.py b/src/torchmetrics/image/mifid.py index 31105fd290b..6ce894cffd1 100644 --- a/src/torchmetrics/image/mifid.py +++ b/src/torchmetrics/image/mifid.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/perceptual_path_length.py b/src/torchmetrics/image/perceptual_path_length.py index f6d909bf477..5c48b57c3fe 100644 --- a/src/torchmetrics/image/perceptual_path_length.py +++ b/src/torchmetrics/image/perceptual_path_length.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, Literal, Optional, Tuple, Union +from typing import Any, Literal, Optional, Union from torch import Tensor, nn diff --git a/src/torchmetrics/image/psnr.py b/src/torchmetrics/image/psnr.py index fa76d677133..5f00d21c7cb 100644 --- a/src/torchmetrics/image/psnr.py +++ b/src/torchmetrics/image/psnr.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence from functools import partial -from typing import Any, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/image/qnr.py b/src/torchmetrics/image/qnr.py index 4d99396d9de..649a69617ef 100644 --- a/src/torchmetrics/image/qnr.py +++ b/src/torchmetrics/image/qnr.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/image/rase.py b/src/torchmetrics/image/rase.py index dbe51d5d969..0a06041f94d 100644 --- a/src/torchmetrics/image/rase.py +++ b/src/torchmetrics/image/rase.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/image/rmse_sw.py b/src/torchmetrics/image/rmse_sw.py index fdae49a72ba..6312174b1be 100644 --- a/src/torchmetrics/image/rmse_sw.py +++ b/src/torchmetrics/image/rmse_sw.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/sam.py b/src/torchmetrics/image/sam.py index e1407120b2f..07449cd6939 100644 --- a/src/torchmetrics/image/sam.py +++ b/src/torchmetrics/image/sam.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor, tensor from typing_extensions import Literal diff --git a/src/torchmetrics/image/ssim.py b/src/torchmetrics/image/ssim.py index 1a2a6f858c8..034dabf7821 100644 --- a/src/torchmetrics/image/ssim.py +++ b/src/torchmetrics/image/ssim.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/image/tv.py b/src/torchmetrics/image/tv.py index 087b6a06cb4..eb6122fb41f 100644 --- a/src/torchmetrics/image/tv.py +++ b/src/torchmetrics/image/tv.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/image/uqi.py b/src/torchmetrics/image/uqi.py index c2cf917301d..b094f14e851 100644 --- a/src/torchmetrics/image/uqi.py +++ b/src/torchmetrics/image/uqi.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor, tensor from typing_extensions import Literal diff --git a/src/torchmetrics/metric.py b/src/torchmetrics/metric.py index 3b8868adb54..2f0b3b617ed 100644 --- a/src/torchmetrics/metric.py +++ b/src/torchmetrics/metric.py @@ -21,7 +21,7 @@ from collections.abc import Generator, Sequence from contextlib import contextmanager from copy import deepcopy -from typing import Any, Callable, ClassVar, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, ClassVar, Optional, Union import torch from lightning_utilities import apply_to_collection diff --git a/src/torchmetrics/multimodal/clip_iqa.py b/src/torchmetrics/multimodal/clip_iqa.py index 947972ff02e..1378b203040 100644 --- a/src/torchmetrics/multimodal/clip_iqa.py +++ b/src/torchmetrics/multimodal/clip_iqa.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, List, Literal, Optional, Tuple, Union +from typing import Any, Literal, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/multimodal/clip_score.py b/src/torchmetrics/multimodal/clip_score.py index f4cf857bbf2..382e68db53a 100644 --- a/src/torchmetrics/multimodal/clip_score.py +++ b/src/torchmetrics/multimodal/clip_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/nominal/fleiss_kappa.py b/src/torchmetrics/nominal/fleiss_kappa.py index cf6f9058326..715565a9fdc 100644 --- a/src/torchmetrics/nominal/fleiss_kappa.py +++ b/src/torchmetrics/nominal/fleiss_kappa.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/regression/cosine_similarity.py b/src/torchmetrics/regression/cosine_similarity.py index f7bf201d7ea..7d2eec54470 100644 --- a/src/torchmetrics/regression/cosine_similarity.py +++ b/src/torchmetrics/regression/cosine_similarity.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/regression/csi.py b/src/torchmetrics/regression/csi.py index 9014cb2daab..854ce500d7b 100644 --- a/src/torchmetrics/regression/csi.py +++ b/src/torchmetrics/regression/csi.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional +from typing import Any, Optional import torch diff --git a/src/torchmetrics/regression/kendall.py b/src/torchmetrics/regression/kendall.py index 8b651737e8a..e3266f23623 100644 --- a/src/torchmetrics/regression/kendall.py +++ b/src/torchmetrics/regression/kendall.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/regression/pearson.py b/src/torchmetrics/regression/pearson.py index 8ae82e17662..adff24aab9e 100644 --- a/src/torchmetrics/regression/pearson.py +++ b/src/torchmetrics/regression/pearson.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/regression/spearman.py b/src/torchmetrics/regression/spearman.py index 59755846cc9..83ea08d5f50 100644 --- a/src/torchmetrics/regression/spearman.py +++ b/src/torchmetrics/regression/spearman.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/retrieval/base.py b/src/torchmetrics/retrieval/base.py index 94bb49982f7..d63be19ff1b 100644 --- a/src/torchmetrics/retrieval/base.py +++ b/src/torchmetrics/retrieval/base.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from abc import ABC, abstractmethod -from typing import Any, Callable, List, Optional, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/retrieval/precision_recall_curve.py b/src/torchmetrics/retrieval/precision_recall_curve.py index 5b6af216843..fb4d54a4f50 100644 --- a/src/torchmetrics/retrieval/precision_recall_curve.py +++ b/src/torchmetrics/retrieval/precision_recall_curve.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Callable, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/segmentation/dice.py b/src/torchmetrics/segmentation/dice.py index b28ade07f1e..70a38009ea2 100644 --- a/src/torchmetrics/segmentation/dice.py +++ b/src/torchmetrics/segmentation/dice.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/segmentation/hausdorff_distance.py b/src/torchmetrics/segmentation/hausdorff_distance.py index 666790f914d..4e646bb6a93 100644 --- a/src/torchmetrics/segmentation/hausdorff_distance.py +++ b/src/torchmetrics/segmentation/hausdorff_distance.py @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Literal, Optional, Union +from typing import Any, Literal, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/text/bert.py b/src/torchmetrics/text/bert.py index 6df6f20eb6b..f6550749f6b 100644 --- a/src/torchmetrics/text/bert.py +++ b/src/torchmetrics/text/bert.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Callable, Dict, List, Optional, Union +from typing import Any, Callable, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/text/cer.py b/src/torchmetrics/text/cer.py index 47370328dbc..e0337801916 100644 --- a/src/torchmetrics/text/cer.py +++ b/src/torchmetrics/text/cer.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/text/chrf.py b/src/torchmetrics/text/chrf.py index 88a791e9714..8b70e1b3269 100644 --- a/src/torchmetrics/text/chrf.py +++ b/src/torchmetrics/text/chrf.py @@ -19,7 +19,7 @@ import itertools from collections.abc import Iterator, Sequence -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/text/edit.py b/src/torchmetrics/text/edit.py index 060a8fc6b26..dd1750436b1 100644 --- a/src/torchmetrics/text/edit.py +++ b/src/torchmetrics/text/edit.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Literal, Optional, Union +from typing import Any, Literal, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/text/eed.py b/src/torchmetrics/text/eed.py index 9dfaaa9edcf..dd12a852ccf 100644 --- a/src/torchmetrics/text/eed.py +++ b/src/torchmetrics/text/eed.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union from torch import Tensor, stack from typing_extensions import Literal diff --git a/src/torchmetrics/text/infolm.py b/src/torchmetrics/text/infolm.py index 6c1320248d7..ae585161bc2 100644 --- a/src/torchmetrics/text/infolm.py +++ b/src/torchmetrics/text/infolm.py @@ -13,7 +13,7 @@ # limitations under the License. import os from collections.abc import Sequence -from typing import Any, ClassVar, Dict, List, Optional, Tuple, Union +from typing import Any, ClassVar, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/text/mer.py b/src/torchmetrics/text/mer.py index b3f086e0d00..a898c9c4758 100644 --- a/src/torchmetrics/text/mer.py +++ b/src/torchmetrics/text/mer.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/text/perplexity.py b/src/torchmetrics/text/perplexity.py index 950bb9ad449..af8d9e70795 100644 --- a/src/torchmetrics/text/perplexity.py +++ b/src/torchmetrics/text/perplexity.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, Optional, Union +from typing import Any, Optional, Union from torch import Tensor, tensor diff --git a/src/torchmetrics/text/rouge.py b/src/torchmetrics/text/rouge.py index be8399f6fad..ec1ef711afc 100644 --- a/src/torchmetrics/text/rouge.py +++ b/src/torchmetrics/text/rouge.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union from torch import Tensor from typing_extensions import Literal diff --git a/src/torchmetrics/text/squad.py b/src/torchmetrics/text/squad.py index 124c87f06ce..a545da95803 100644 --- a/src/torchmetrics/text/squad.py +++ b/src/torchmetrics/text/squad.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/text/ter.py b/src/torchmetrics/text/ter.py index bb477a65bfb..3773e3af923 100644 --- a/src/torchmetrics/text/ter.py +++ b/src/torchmetrics/text/ter.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/text/wer.py b/src/torchmetrics/text/wer.py index b96044ef1bc..93bc7b8da13 100644 --- a/src/torchmetrics/text/wer.py +++ b/src/torchmetrics/text/wer.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor, tensor diff --git a/src/torchmetrics/text/wil.py b/src/torchmetrics/text/wil.py index 0a0c9f7cd13..edd00b7f657 100644 --- a/src/torchmetrics/text/wil.py +++ b/src/torchmetrics/text/wil.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor, tensor diff --git a/src/torchmetrics/text/wip.py b/src/torchmetrics/text/wip.py index fc4ea5b8f15..b9b4351f548 100644 --- a/src/torchmetrics/text/wip.py +++ b/src/torchmetrics/text/wip.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from collections.abc import Sequence -from typing import Any, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor, tensor diff --git a/src/torchmetrics/utilities/checks.py b/src/torchmetrics/utilities/checks.py index 6da328c01e7..a1f7e47632f 100644 --- a/src/torchmetrics/utilities/checks.py +++ b/src/torchmetrics/utilities/checks.py @@ -17,7 +17,7 @@ from collections.abc import Mapping, Sequence from functools import partial from time import perf_counter -from typing import Any, Callable, Dict, Optional, Tuple, no_type_check +from typing import Any, Callable, Optional, no_type_check from unittest.mock import Mock import torch diff --git a/src/torchmetrics/utilities/compute.py b/src/torchmetrics/utilities/compute.py index f16600f35b6..cbb648a8844 100644 --- a/src/torchmetrics/utilities/compute.py +++ b/src/torchmetrics/utilities/compute.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Optional, Tuple +from typing import Optional import torch from torch import Tensor diff --git a/src/torchmetrics/utilities/data.py b/src/torchmetrics/utilities/data.py index d3ec64d621a..2f98de35d19 100644 --- a/src/torchmetrics/utilities/data.py +++ b/src/torchmetrics/utilities/data.py @@ -13,7 +13,7 @@ # limitations under the License. import sys from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from lightning_utilities import apply_to_collection diff --git a/src/torchmetrics/utilities/distributed.py b/src/torchmetrics/utilities/distributed.py index 150138e2198..31a1d0dca5b 100644 --- a/src/torchmetrics/utilities/distributed.py +++ b/src/torchmetrics/utilities/distributed.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, List, Optional +from typing import Any, Optional import torch from torch import Tensor diff --git a/src/torchmetrics/utilities/enums.py b/src/torchmetrics/utilities/enums.py index 14ec7135a86..155f1bb8f60 100644 --- a/src/torchmetrics/utilities/enums.py +++ b/src/torchmetrics/utilities/enums.py @@ -11,7 +11,6 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Type from lightning_utilities.core.enums import StrEnum from typing_extensions import Literal diff --git a/src/torchmetrics/utilities/plot.py b/src/torchmetrics/utilities/plot.py index 98ef71aa4d2..e3ced02575c 100644 --- a/src/torchmetrics/utilities/plot.py +++ b/src/torchmetrics/utilities/plot.py @@ -14,7 +14,7 @@ from collections.abc import Generator, Sequence from itertools import product from math import ceil, floor, sqrt -from typing import Any, Dict, List, Optional, Tuple, Union, no_type_check +from typing import Any, Optional, Union, no_type_check import numpy as np import torch diff --git a/src/torchmetrics/wrappers/bootstrapping.py b/src/torchmetrics/wrappers/bootstrapping.py index 47192dad5f7..566c4d4ab66 100644 --- a/src/torchmetrics/wrappers/bootstrapping.py +++ b/src/torchmetrics/wrappers/bootstrapping.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence from copy import deepcopy -from typing import Any, Dict, Optional, Union +from typing import Any, Optional, Union import torch from lightning_utilities import apply_to_collection diff --git a/src/torchmetrics/wrappers/classwise.py b/src/torchmetrics/wrappers/classwise.py index 517d4c060d0..c37e3c7fa2b 100644 --- a/src/torchmetrics/wrappers/classwise.py +++ b/src/torchmetrics/wrappers/classwise.py @@ -13,7 +13,7 @@ # limitations under the License. import typing from collections.abc import Sequence -from typing import Any, Dict, List, Optional, Union +from typing import Any, Optional, Union from torch import Tensor diff --git a/src/torchmetrics/wrappers/feature_share.py b/src/torchmetrics/wrappers/feature_share.py index caeb2e93217..62302fff140 100644 --- a/src/torchmetrics/wrappers/feature_share.py +++ b/src/torchmetrics/wrappers/feature_share.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence from functools import lru_cache -from typing import Any, Dict, Optional, Union +from typing import Any, Optional, Union from torch.nn import Module diff --git a/src/torchmetrics/wrappers/minmax.py b/src/torchmetrics/wrappers/minmax.py index 236179a6cbe..25300e8fbe0 100644 --- a/src/torchmetrics/wrappers/minmax.py +++ b/src/torchmetrics/wrappers/minmax.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence -from typing import Any, Dict, Optional, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/wrappers/multioutput.py b/src/torchmetrics/wrappers/multioutput.py index 86f53af6908..12a135099a2 100644 --- a/src/torchmetrics/wrappers/multioutput.py +++ b/src/torchmetrics/wrappers/multioutput.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence from copy import deepcopy -from typing import Any, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from lightning_utilities import apply_to_collection diff --git a/src/torchmetrics/wrappers/multitask.py b/src/torchmetrics/wrappers/multitask.py index c0b312cbedd..66e9516591e 100644 --- a/src/torchmetrics/wrappers/multitask.py +++ b/src/torchmetrics/wrappers/multitask.py @@ -14,7 +14,7 @@ # this is just a bypass for this module name collision with built-in one from collections.abc import Iterable, Sequence from copy import deepcopy -from typing import Any, Dict, Optional, Tuple, Union +from typing import Any, Optional, Union from torch import Tensor, nn diff --git a/src/torchmetrics/wrappers/tracker.py b/src/torchmetrics/wrappers/tracker.py index a223f803397..0a8ca7eac1d 100644 --- a/src/torchmetrics/wrappers/tracker.py +++ b/src/torchmetrics/wrappers/tracker.py @@ -13,7 +13,7 @@ # limitations under the License. from collections.abc import Sequence from copy import deepcopy -from typing import Any, Dict, List, Optional, Tuple, Union +from typing import Any, Optional, Union import torch from torch import Tensor diff --git a/src/torchmetrics/wrappers/transformations.py b/src/torchmetrics/wrappers/transformations.py index d4fb0f270d0..8a86e3224af 100644 --- a/src/torchmetrics/wrappers/transformations.py +++ b/src/torchmetrics/wrappers/transformations.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, Callable, Dict, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import torch diff --git a/tests/unittests/_helpers/testers.py b/tests/unittests/_helpers/testers.py index ed7b940c315..1622e4ad8a3 100644 --- a/tests/unittests/_helpers/testers.py +++ b/tests/unittests/_helpers/testers.py @@ -16,7 +16,7 @@ from collections.abc import Sequence from copy import deepcopy from functools import partial -from typing import Any, Callable, Dict, List, Optional, Tuple, Union +from typing import Any, Callable, Optional, Union import numpy as np import pytest diff --git a/tests/unittests/audio/test_dnsmos.py b/tests/unittests/audio/test_dnsmos.py index c8239fe4776..80607057467 100644 --- a/tests/unittests/audio/test_dnsmos.py +++ b/tests/unittests/audio/test_dnsmos.py @@ -13,7 +13,7 @@ # limitations under the License. import os from functools import partial -from typing import Any, Dict, Optional +from typing import Any, Optional import numpy as np import pytest diff --git a/tests/unittests/audio/test_nisqa.py b/tests/unittests/audio/test_nisqa.py index 8d4e47512c0..06eac64710c 100644 --- a/tests/unittests/audio/test_nisqa.py +++ b/tests/unittests/audio/test_nisqa.py @@ -13,7 +13,7 @@ # limitations under the License. from functools import partial -from typing import Any, Dict, Tuple +from typing import Any import pytest import torch diff --git a/tests/unittests/audio/test_pit.py b/tests/unittests/audio/test_pit.py index b431b9e8d6c..70c5b44c6ab 100644 --- a/tests/unittests/audio/test_pit.py +++ b/tests/unittests/audio/test_pit.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from functools import partial -from typing import Callable, Tuple +from typing import Callable import numpy as np import pytest diff --git a/tests/unittests/audio/test_srmr.py b/tests/unittests/audio/test_srmr.py index b627e6b8642..d3a18cca357 100644 --- a/tests/unittests/audio/test_srmr.py +++ b/tests/unittests/audio/test_srmr.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from functools import partial -from typing import Any, Dict +from typing import Any import pytest import torch diff --git a/tests/unittests/classification/test_group_fairness.py b/tests/unittests/classification/test_group_fairness.py index 42e64e21262..5f627676f09 100644 --- a/tests/unittests/classification/test_group_fairness.py +++ b/tests/unittests/classification/test_group_fairness.py @@ -13,7 +13,7 @@ # limitations under the License. import inspect from functools import partial -from typing import Any, Callable, Dict, Optional +from typing import Any, Callable, Optional from unittest import mock import numpy as np diff --git a/tests/unittests/detection/test_modified_panoptic_quality.py b/tests/unittests/detection/test_modified_panoptic_quality.py index a5d0767c342..f4fe1d1ee06 100644 --- a/tests/unittests/detection/test_modified_panoptic_quality.py +++ b/tests/unittests/detection/test_modified_panoptic_quality.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, Dict +from typing import Any import numpy as np import pytest diff --git a/tests/unittests/detection/test_panoptic_quality.py b/tests/unittests/detection/test_panoptic_quality.py index 452a43f7ee5..58287aa7fcd 100644 --- a/tests/unittests/detection/test_panoptic_quality.py +++ b/tests/unittests/detection/test_panoptic_quality.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import Any, Dict +from typing import Any import numpy as np import pytest diff --git a/tests/unittests/image/test_d_s.py b/tests/unittests/image/test_d_s.py index 6161df001fa..09a9675d380 100644 --- a/tests/unittests/image/test_d_s.py +++ b/tests/unittests/image/test_d_s.py @@ -13,7 +13,7 @@ # limitations under the License. from functools import partial -from typing import Dict, List, NamedTuple +from typing import NamedTuple import numpy as np import pytest diff --git a/tests/unittests/image/test_qnr.py b/tests/unittests/image/test_qnr.py index 89c9113adac..52d77896235 100644 --- a/tests/unittests/image/test_qnr.py +++ b/tests/unittests/image/test_qnr.py @@ -13,7 +13,7 @@ # limitations under the License. from functools import partial -from typing import Dict, List, NamedTuple +from typing import NamedTuple import pytest import torch diff --git a/tests/unittests/multimodal/test_clip_score.py b/tests/unittests/multimodal/test_clip_score.py index 6e5e3f3da50..9e71a30ca0a 100644 --- a/tests/unittests/multimodal/test_clip_score.py +++ b/tests/unittests/multimodal/test_clip_score.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from functools import partial -from typing import List, NamedTuple +from typing import NamedTuple import matplotlib import matplotlib.pyplot as plt diff --git a/tests/unittests/retrieval/helpers.py b/tests/unittests/retrieval/helpers.py index 8075c5e6ce0..6747be475ed 100644 --- a/tests/unittests/retrieval/helpers.py +++ b/tests/unittests/retrieval/helpers.py @@ -13,7 +13,7 @@ # limitations under the License. from functools import partial from itertools import chain -from typing import Any, Callable, Dict, List, Optional, Tuple, Type, Union +from typing import Any, Callable, Optional, Union import numpy as np import pytest diff --git a/tests/unittests/retrieval/test_precision_recall_curve.py b/tests/unittests/retrieval/test_precision_recall_curve.py index 12f7e60f8e2..d8e9817bd51 100644 --- a/tests/unittests/retrieval/test_precision_recall_curve.py +++ b/tests/unittests/retrieval/test_precision_recall_curve.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. from functools import partial -from typing import Callable, Optional, Tuple, Union +from typing import Callable, Optional, Union import numpy as np import pytest diff --git a/tests/unittests/text/_helpers.py b/tests/unittests/text/_helpers.py index 15723b529e0..2b9f8381d42 100644 --- a/tests/unittests/text/_helpers.py +++ b/tests/unittests/text/_helpers.py @@ -15,7 +15,7 @@ import sys from collections.abc import Sequence from functools import partial -from typing import Any, Callable, Dict, Optional, Union +from typing import Any, Callable, Optional, Union import numpy as np import pytest diff --git a/tests/unittests/text/test_cer.py b/tests/unittests/text/test_cer.py index a4d5de091a0..99de422ba26 100644 --- a/tests/unittests/text/test_cer.py +++ b/tests/unittests/text/test_cer.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Union +from typing import Union import pytest from torchmetrics.functional.text.cer import char_error_rate diff --git a/tests/unittests/text/test_mer.py b/tests/unittests/text/test_mer.py index d4c5a8c2d09..56592c34762 100644 --- a/tests/unittests/text/test_mer.py +++ b/tests/unittests/text/test_mer.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Union +from typing import Union import pytest from torchmetrics.functional.text.mer import match_error_rate diff --git a/tests/unittests/text/test_wer.py b/tests/unittests/text/test_wer.py index bae4c91c11d..e57c51af5fd 100644 --- a/tests/unittests/text/test_wer.py +++ b/tests/unittests/text/test_wer.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Union +from typing import Union import pytest from torchmetrics.functional.text.wer import word_error_rate diff --git a/tests/unittests/text/test_wil.py b/tests/unittests/text/test_wil.py index 59657956cd0..9b1615e5ee6 100644 --- a/tests/unittests/text/test_wil.py +++ b/tests/unittests/text/test_wil.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Union +from typing import Union import pytest from torchmetrics.functional.text.wil import word_information_lost diff --git a/tests/unittests/text/test_wip.py b/tests/unittests/text/test_wip.py index fe4bedb482c..b0393d12b29 100644 --- a/tests/unittests/text/test_wip.py +++ b/tests/unittests/text/test_wip.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -from typing import List, Union +from typing import Union import pytest from torchmetrics.functional.text.wip import word_information_preserved