From a08f04b426380d13c96b455dd1f985f5c18f960a Mon Sep 17 00:00:00 2001 From: Vivek Miglani Date: Mon, 30 Dec 2024 16:00:37 -0800 Subject: [PATCH] Fix typing pyre fix me issues (#1480) Summary: Fix typing fixme issues and switch slice to pyre-ignore, since this is related to earlier Python version limitation Differential Revision: D67726226 --- captum/_utils/typing.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/captum/_utils/typing.py b/captum/_utils/typing.py index 80cf22d45..efa437649 100644 --- a/captum/_utils/typing.py +++ b/captum/_utils/typing.py @@ -21,8 +21,9 @@ TensorOrTupleOfTensorsGeneric = TypeVar( "TensorOrTupleOfTensorsGeneric", Tensor, Tuple[Tensor, ...] ) -# pyre-fixme[24]: Generic type `tuple` expects at least 1 type parameter. -TupleOrTensorOrBoolGeneric = TypeVar("TupleOrTensorOrBoolGeneric", Tuple, Tensor, bool) +TupleOrTensorOrBoolGeneric = TypeVar( + "TupleOrTensorOrBoolGeneric", Tuple[Tensor, ...], Tensor, bool +) ModuleOrModuleList = TypeVar("ModuleOrModuleList", Module, List[Module]) TargetType = Union[None, int, Tuple[int, ...], Tensor, List[Tuple[int, ...]], List[int]] BaselineTupleType = Union[None, Tuple[Union[Tensor, int, float], ...]] @@ -46,7 +47,7 @@ # falling back to slice type. SliceIntType = slice[int, int, int] except TypeError: - # pyre-fixme[24]: Generic type `slice` expects 3 type parameters. + # pyre-ignore[24]: Generic type `slice` expects 3 type parameters. SliceIntType = slice # type: ignore # Necessary for Python >=3.7 and <3.9!