|
50 | 50 | if TYPE_CHECKING: |
51 | 51 | from pytato.distributed import DistributedSendRefHolder, DistributedRecv |
52 | 52 |
|
53 | | -T = TypeVar("T", Array, AbstractResultWithNamedArrays) |
| 53 | +ArrayOrNames = Union[Array, AbstractResultWithNamedArrays] |
| 54 | +T = TypeVar("T", bound=ArrayOrNames) |
54 | 55 | CombineT = TypeVar("CombineT") # used in CombineMapper |
55 | 56 | CachedMapperT = TypeVar("CachedMapperT") # used in CachedMapper |
56 | 57 | IndexOrShapeExpr = TypeVar("IndexOrShapeExpr") |
57 | | -ArrayOrNames = Union[Array, AbstractResultWithNamedArrays] |
58 | 58 | R = FrozenSet[Array] |
59 | 59 |
|
60 | 60 | __doc__ = """ |
@@ -378,7 +378,7 @@ def rec(self, |
378 | 378 | except KeyError: |
379 | 379 | result = Mapper.rec(self, expr, |
380 | 380 | *args, |
381 | | - **kwargs) # type: ignore[type-var] |
| 381 | + **kwargs) |
382 | 382 | self._cache[key] = result |
383 | 383 | return result |
384 | 384 |
|
@@ -554,8 +554,7 @@ def rec_idx_or_size_tuple(self, situp: Tuple[IndexOrShapeExpr, ...] |
554 | 554 | def rec(self, expr: ArrayOrNames) -> CombineT: # type: ignore |
555 | 555 | if expr in self.cache: |
556 | 556 | return self.cache[expr] |
557 | | - # type-ignore reason: type not compatible with super.rec() type |
558 | | - result: CombineT = super().rec(expr) # type: ignore |
| 557 | + result: CombineT = super().rec(expr) |
559 | 558 | self.cache[expr] = result |
560 | 559 | return result |
561 | 560 |
|
@@ -961,9 +960,7 @@ def rec(self, expr: ArrayOrNames) -> None: # type: ignore |
961 | 960 | if id(expr) in self._visited_ids: |
962 | 961 | return |
963 | 962 |
|
964 | | - # type-ignore reason: super().rec expects either 'Array' or |
965 | | - # 'AbstractResultWithNamedArrays', passed 'ArrayOrNames' |
966 | | - super().rec(expr) # type: ignore |
| 963 | + super().rec(expr) |
967 | 964 | self._visited_ids.add(id(expr)) |
968 | 965 |
|
969 | 966 | # }}} |
@@ -1061,8 +1058,7 @@ def __init__(self, nsuccessors: Mapping[Array, int]): |
1061 | 1058 | def rec(self, expr: ArrayOrNames) -> MPMSMaterializerAccumulator: # type: ignore |
1062 | 1059 | if expr in self.cache: |
1063 | 1060 | return self.cache[expr] |
1064 | | - # type-ignore reason: type not compatible with super.rec() type |
1065 | | - result: MPMSMaterializerAccumulator = super().rec(expr) # type: ignore |
| 1061 | + result: MPMSMaterializerAccumulator = super().rec(expr) |
1066 | 1062 | self.cache[expr] = result |
1067 | 1063 | return result |
1068 | 1064 |
|
|
0 commit comments