Skip to content

Commit

Permalink
Fix typing pyre fix me issues (pytorch#1480)
Browse files Browse the repository at this point in the history
Summary:

Fix typing fixme issues and switch slice to pyre-ignore, since this is related to earlier Python version limitation

Differential Revision: D67726226
  • Loading branch information
Vivek Miglani authored and facebook-github-bot committed Dec 31, 2024
1 parent da20ee7 commit bcb53da
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions captum/_utils/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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], ...]]
Expand All @@ -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!
Expand Down

0 comments on commit bcb53da

Please sign in to comment.